diff options
author | Parménides GV <parmegv@sdf.org> | 2014-12-01 20:01:49 +0100 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2014-12-01 20:01:49 +0100 |
commit | b4d6003265e49e537ec3fae16740de7885864520 (patch) | |
tree | fa4728712320ba459760906390851a09930f7712 /ics-openvpn-stripped | |
parent | 48cd0f2fa3094b5a6b7b07d6413d77bdbc9bbc20 (diff) | |
parent | a59f2e0083b05fd94e2d0d2c1fcfeaa42b851531 (diff) |
Merge branch 'bug/EIP-class-is-too-big-#6350' into develop
Diffstat (limited to 'ics-openvpn-stripped')
-rw-r--r-- | ics-openvpn-stripped/main/src/main/java/de/blinkt/openvpn/core/GetRestrictionReceiver.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/ics-openvpn-stripped/main/src/main/java/de/blinkt/openvpn/core/GetRestrictionReceiver.java b/ics-openvpn-stripped/main/src/main/java/de/blinkt/openvpn/core/GetRestrictionReceiver.java new file mode 100644 index 00000000..5b1dda58 --- /dev/null +++ b/ics-openvpn-stripped/main/src/main/java/de/blinkt/openvpn/core/GetRestrictionReceiver.java @@ -0,0 +1,47 @@ +package de.blinkt.openvpn.core; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.RestrictionEntry; +import android.os.Build; +import android.os.Bundle; + +import java.util.ArrayList; + +import se.leap.bitmaskclient.R; + +/** + * Created by arne on 25.07.13. + */ +@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) +public class GetRestrictionReceiver extends BroadcastReceiver { + @Override + public void onReceive(final Context context, Intent intent) { + final PendingResult result = goAsync(); + + new Thread() { + @Override + public void run() { + final Bundle extras = new Bundle(); + + ArrayList<RestrictionEntry> restrictionEntries = initRestrictions(context); + + extras.putParcelableArrayList(Intent.EXTRA_RESTRICTIONS_LIST, restrictionEntries); + result.setResult(Activity.RESULT_OK,null,extras); + result.finish(); + } + }.run(); + } + + private ArrayList<RestrictionEntry> initRestrictions(Context context) { + ArrayList<RestrictionEntry> restrictions = new ArrayList<RestrictionEntry>(); + RestrictionEntry allowChanges = new RestrictionEntry("allow_changes",false); + allowChanges.setTitle(context.getString(R.string.allow_vpn_changes)); + restrictions.add(allowChanges); + + return restrictions; + } +} |