Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 053dbad9 authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by Android (Google) Code Review
Browse files

Merge changes from topic "AppOpsFgBackgroundMode"

* changes:
  Package manager is not ready when reading app-ops state
  Use setUidMode when reading state
  Expose syntax for app-ops settings as test-api
  Callback startWatchingMode with the right op
  Force update uid state when pending uid state is applied
  Notify all packages is uid-mode is changed
parents 8301f05c fe2fc3a9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -183,6 +183,9 @@ package android.app {
    field public static final int HISTORICAL_MODE_DISABLED = 0; // 0x0
    field public static final int HISTORICAL_MODE_ENABLED_ACTIVE = 1; // 0x1
    field public static final int HISTORICAL_MODE_ENABLED_PASSIVE = 2; // 0x2
    field public static final String KEY_BG_STATE_SETTLE_TIME = "bg_state_settle_time";
    field public static final String KEY_FG_SERVICE_STATE_SETTLE_TIME = "fg_service_state_settle_time";
    field public static final String KEY_TOP_STATE_SETTLE_TIME = "top_state_settle_time";
    field public static final String OPSTR_ACCEPT_HANDOVER = "android:accept_handover";
    field public static final String OPSTR_ACCESS_NOTIFICATIONS = "android:access_notifications";
    field public static final String OPSTR_ACTIVATE_VPN = "android:activate_vpn";
+46 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.app.usage.UsageStatsManager;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledAfter;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.ContentResolver;
import android.content.Context;
@@ -100,6 +102,18 @@ import java.util.function.Supplier;
 */
@SystemService(Context.APP_OPS_SERVICE)
public class AppOpsManager {
    /**
     * This is a subtle behavior change to {@link #startWatchingMode}.
     *
     * Before this change the system called back for the switched op. After the change the system
     * will call back for the actually requested op or all switched ops if no op is specified.
     *
     * @hide
     */
    @ChangeId
    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q)
    public static final long CALL_BACK_ON_CHANGED_LISTENER_WITH_SWITCHED_OP_CHANGE = 148180766L;

    /**
     * <p>App ops allows callers to:</p>
     *
@@ -147,6 +161,38 @@ public class AppOpsManager {

    static IBinder sClientId;

    /**
     * How many seconds we want for a drop in uid state from top to settle before applying it.
     *
     * <>Set a parameter to {@link android.provider.Settings.Global#APP_OPS_CONSTANTS}
     *
     * @hide
     */
    @TestApi
    public static final String KEY_TOP_STATE_SETTLE_TIME = "top_state_settle_time";

    /**
     * How many second we want for a drop in uid state from foreground to settle before applying it.
     *
     * <>Set a parameter to {@link android.provider.Settings.Global#APP_OPS_CONSTANTS}
     *
     * @hide
     */
    @TestApi
    public static final String KEY_FG_SERVICE_STATE_SETTLE_TIME =
            "fg_service_state_settle_time";

    /**
     * How many seconds we want for a drop in uid state from background to settle before applying
     * it.
     *
     * <>Set a parameter to {@link android.provider.Settings.Global#APP_OPS_CONSTANTS}
     *
     * @hide
     */
    @TestApi
    public static final String KEY_BG_STATE_SETTLE_TIME = "bg_state_settle_time";

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(flag = true, prefix = { "HISTORICAL_MODE_" }, value = {
+2 −2
Original line number Diff line number Diff line
@@ -2617,7 +2617,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        mProcessCpuThread.start();
        mBatteryStatsService.publish();
        mAppOpsService.publish(mContext);
        mAppOpsService.publish();
        Slog.d("AppOps", "AppOpsService published");
        LocalServices.addService(ActivityManagerInternal.class, mInternal);
        mActivityTaskManager.onActivityManagerInternalAdded();
@@ -19510,7 +19510,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
        public AppOpsService getAppOpsService(File file, Handler handler) {
            return new AppOpsService(file, handler);
            return new AppOpsService(file, handler, getContext());
        }
        public Handler getUiHandler(ActivityManagerService service) {
+161 −79

File changed.

Preview size limit exceeded, changes collapsed.

Loading