Optimize bg check flow.
No longer need to look up the application info, target SDK is explicitly passed in to the check. For the external method, we change this to just checked to see if background is completely disabled, which doesn't need a target SDK check (and is the only thing any of the current clients care about). Now allow SystemUI to put targets of notification pending intents on the temporary whitelist when they fire, so developers can avoid dealing with background restrictions in this case (if the user interacts with their notification, they will temporarily be considered in the foreground). Remove any thoughts of enforing restrictions on registerReceiver(), so we don't need to deal with target SDK versions there (which can't be done all that efficiently). Also bring back the old "allow starts coming from foreground apps" only for the MODE_IGNORE app op, since it should provide some better compatibility. Test: ran them. Change-Id: Id4ea7f992d12ce4bd8e54f1dbaeb4a460a3dee59
This commit is contained in:
@@ -520,17 +520,17 @@ public class ActivityManager {
|
||||
/** @hide Flag for registerUidObserver: report uid has become active. */
|
||||
public static final int UID_OBSERVER_ACTIVE = 1<<3;
|
||||
|
||||
/** @hide Mode for {@link IActivityManager#getAppStartMode}: normal free-to-run operation. */
|
||||
/** @hide Mode for {@link IActivityManager#isAppStartModeDisabled}: normal free-to-run operation. */
|
||||
public static final int APP_START_MODE_NORMAL = 0;
|
||||
|
||||
/** @hide Mode for {@link IActivityManager#getAppStartMode}: delay running until later. */
|
||||
/** @hide Mode for {@link IActivityManager#isAppStartModeDisabled}: delay running until later. */
|
||||
public static final int APP_START_MODE_DELAYED = 1;
|
||||
|
||||
/** @hide Mode for {@link IActivityManager#getAppStartMode}: delay running until later, with
|
||||
/** @hide Mode for {@link IActivityManager#isAppStartModeDisabled}: delay running until later, with
|
||||
* rigid errors (throwing exception). */
|
||||
public static final int APP_START_MODE_DELAYED_RIGID = 2;
|
||||
|
||||
/** @hide Mode for {@link IActivityManager#getAppStartMode}: disable/cancel pending
|
||||
/** @hide Mode for {@link IActivityManager#isAppStartModeDisabled}: disable/cancel pending
|
||||
* launches; this is the mode for ephemeral apps. */
|
||||
public static final int APP_START_MODE_DISABLED = 3;
|
||||
|
||||
|
||||
@@ -1342,8 +1342,8 @@ class ContextImpl extends Context {
|
||||
}
|
||||
try {
|
||||
final Intent intent = ActivityManager.getService().registerReceiver(
|
||||
mMainThread.getApplicationThread(), mBasePackageName,
|
||||
rd, filter, broadcastPermission, userId);
|
||||
mMainThread.getApplicationThread(), mBasePackageName, rd, filter,
|
||||
broadcastPermission, userId);
|
||||
if (intent != null) {
|
||||
intent.setExtrasClassLoader(getClassLoader());
|
||||
intent.prepareToEnterProcess();
|
||||
|
||||
@@ -475,7 +475,7 @@ interface IActivityManager {
|
||||
void suppressResizeConfigChanges(boolean suppress);
|
||||
void moveTasksToFullscreenStack(int fromStackId, boolean onTop);
|
||||
boolean moveTopActivityToPinnedStack(int stackId, in Rect bounds);
|
||||
int getAppStartMode(int uid, in String packageName);
|
||||
boolean isAppStartModeDisabled(int uid, in String packageName);
|
||||
boolean unlockUser(int userid, in byte[] token, in byte[] secret,
|
||||
in IProgressListener listener);
|
||||
boolean isInMultiWindowMode(in IBinder token);
|
||||
|
||||
Reference in New Issue
Block a user