blob: 5b1dda58994854400843ca97acec0e0cf1a673ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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;
}
}
|