| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.app; |
| 18 |
|
| 19 |
import android.os.Bundle; |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
public class ComponentOptions { |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
public static final boolean PENDING_INTENT_BAL_ALLOWED_DEFAULT = true; |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
public static final String KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED = |
| 39 |
"android.pendingIntent.backgroundActivityAllowed"; |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
public static final String KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION = |
| 46 |
"android.pendingIntent.backgroundActivityAllowedByPermission"; |
| 47 |
|
| 48 |
private boolean mPendingIntentBalAllowed = PENDING_INTENT_BAL_ALLOWED_DEFAULT; |
| 49 |
private boolean mPendingIntentBalAllowedByPermission = false; |
| 50 |
|
| 51 |
ComponentOptions() { |
| 52 |
} |
| 53 |
|
| 54 |
ComponentOptions(Bundle opts) { |
| 55 |
|
| 56 |
|
| 57 |
opts.setDefusable(true); |
| 58 |
setPendingIntentBackgroundActivityLaunchAllowed( |
| 59 |
opts.getBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED, |
| 60 |
PENDING_INTENT_BAL_ALLOWED_DEFAULT)); |
| 61 |
setPendingIntentBackgroundActivityLaunchAllowedByPermission( |
| 62 |
opts.getBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION, |
| 63 |
false)); |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
public void setPendingIntentBackgroundActivityLaunchAllowed(boolean allowed) { |
| 71 |
mPendingIntentBalAllowed = allowed; |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
public boolean isPendingIntentBackgroundActivityLaunchAllowed() { |
| 79 |
return mPendingIntentBalAllowed; |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
public void setPendingIntentBackgroundActivityLaunchAllowedByPermission(boolean allowed) { |
| 87 |
mPendingIntentBalAllowedByPermission = allowed; |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
public boolean isPendingIntentBackgroundActivityLaunchAllowedByPermission() { |
| 96 |
return mPendingIntentBalAllowedByPermission; |
| 97 |
} |
| 98 |
|
| 99 |
public Bundle toBundle() { |
| 100 |
Bundle b = new Bundle(); |
| 101 |
b.putBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED, mPendingIntentBalAllowed); |
| 102 |
if (mPendingIntentBalAllowedByPermission) { |
| 103 |
b.putBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION, |
| 104 |
mPendingIntentBalAllowedByPermission); |
| 105 |
} |
| 106 |
return b; |
| 107 |
} |
| 108 |
} |