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

Commit a985dcee authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8581479 from f5c48984 to tm-qpr1-release

Change-Id: I0af64b8814bd73c04ac18bcaea8add7952e87214
parents 667d2953 f5c48984
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledAfter;
import android.compat.annotation.Disabled;
import android.compat.annotation.EnabledSince;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
@@ -282,15 +282,14 @@ public class AlarmManager {
    public static final long ENABLE_USE_EXACT_ALARM = 218533173L;

    /**
     * For apps targeting {@link Build.VERSION_CODES#TIRAMISU} or above, the permission
     * {@link Manifest.permission#SCHEDULE_EXACT_ALARM} will be denied, unless the user explicitly
     * allows it from Settings.
     * The permission {@link Manifest.permission#SCHEDULE_EXACT_ALARM} will be denied, unless the
     * user explicitly allows it from Settings.
     *
     * TODO (b/226439802): change to EnabledSince(T) after SDK finalization.
     * TODO (b/226439802): Either enable it in the next SDK or replace it with a better alternative.
     * @hide
     */
    @ChangeId
    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.S_V2)
    @Disabled
    public static final long SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT = 226439802L;

    @UnsupportedAppUsage
+2 −65
Original line number Diff line number Diff line
@@ -565,9 +565,6 @@ public class AlarmManagerService extends SystemService {
        @VisibleForTesting
        static final String KEY_KILL_ON_SCHEDULE_EXACT_ALARM_REVOKED =
                "kill_on_schedule_exact_alarm_revoked";
        @VisibleForTesting
        static final String KEY_SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT =
                "schedule_exact_alarm_denied_by_default";

        private static final long DEFAULT_MIN_FUTURITY = 5 * 1000;
        private static final long DEFAULT_MIN_INTERVAL = 60 * 1000;
@@ -612,8 +609,6 @@ public class AlarmManagerService extends SystemService {

        private static final boolean DEFAULT_KILL_ON_SCHEDULE_EXACT_ALARM_REVOKED = true;

        private static final boolean DEFAULT_SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT = true;

        // Minimum futurity of a new alarm
        public long MIN_FUTURITY = DEFAULT_MIN_FUTURITY;

@@ -701,14 +696,6 @@ public class AlarmManagerService extends SystemService {
        public boolean KILL_ON_SCHEDULE_EXACT_ALARM_REVOKED =
                DEFAULT_KILL_ON_SCHEDULE_EXACT_ALARM_REVOKED;

        /**
         * When this is {@code true}, apps with the change
         * {@link AlarmManager#SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT} enabled will not get
         * {@link Manifest.permission#SCHEDULE_EXACT_ALARM} unless the user grants it to them.
         */
        public volatile boolean SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT =
                DEFAULT_SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT;

        public boolean USE_TARE_POLICY = Settings.Global.DEFAULT_ENABLE_TARE == 1;

        private long mLastAllowWhileIdleWhitelistDuration = -1;
@@ -892,15 +879,6 @@ public class AlarmManagerService extends SystemService {
                                    KEY_KILL_ON_SCHEDULE_EXACT_ALARM_REVOKED,
                                    DEFAULT_KILL_ON_SCHEDULE_EXACT_ALARM_REVOKED);
                            break;
                        case KEY_SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT:
                            final boolean oldValue = SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT;

                            SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT = properties.getBoolean(
                                    KEY_SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT,
                                    DEFAULT_SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT);
                            handleScheduleExactAlarmDeniedByDefaultChange(oldValue,
                                    SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT);
                            break;
                        default:
                            if (name.startsWith(KEY_PREFIX_STANDBY_QUOTA) && !standbyQuotaUpdated) {
                                // The quotas need to be updated in order, so we can't just rely
@@ -971,15 +949,6 @@ public class AlarmManagerService extends SystemService {
            }
        }

        private void handleScheduleExactAlarmDeniedByDefaultChange(boolean oldValue,
                boolean newValue) {
            if (oldValue == newValue) {
                return;
            }
            mHandler.obtainMessage(AlarmHandler.CHECK_EXACT_ALARM_PERMISSION_ON_FEATURE_TOGGLE,
                    newValue).sendToTarget();
        }

        private void migrateAlarmsToNewStoreLocked() {
            final AlarmStore newStore = LAZY_BATCHING ? new LazyAlarmStore()
                    : new BatchingAlarmStore();
@@ -1156,9 +1125,6 @@ public class AlarmManagerService extends SystemService {
            pw.print(KEY_KILL_ON_SCHEDULE_EXACT_ALARM_REVOKED,
                    KILL_ON_SCHEDULE_EXACT_ALARM_REVOKED);
            pw.println();
            pw.print(KEY_SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT,
                    SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT);
            pw.println();

            pw.print(Settings.Global.ENABLE_TARE, USE_TARE_POLICY);
            pw.println();
@@ -2928,10 +2894,8 @@ public class AlarmManagerService extends SystemService {
    }

    private boolean isScheduleExactAlarmDeniedByDefault(String packageName, int userId) {
        return mConstants.SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT
                && CompatChanges.isChangeEnabled(
                AlarmManager.SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT, packageName,
                UserHandle.of(userId));
        return CompatChanges.isChangeEnabled(AlarmManager.SCHEDULE_EXACT_ALARM_DENIED_BY_DEFAULT,
                packageName, UserHandle.of(userId));
    }

    @NeverCompile // Avoid size overhead of debugging code.
@@ -4707,7 +4671,6 @@ public class AlarmManagerService extends SystemService {
        public static final int REFRESH_EXACT_ALARM_CANDIDATES = 11;
        public static final int TARE_AFFORDABILITY_CHANGED = 12;
        public static final int CHECK_EXACT_ALARM_PERMISSION_ON_UPDATE = 13;
        public static final int CHECK_EXACT_ALARM_PERMISSION_ON_FEATURE_TOGGLE = 14;

        AlarmHandler() {
            super(Looper.myLooper());
@@ -4827,32 +4790,6 @@ public class AlarmManagerService extends SystemService {
                        removeExactAlarmsOnPermissionRevoked(uid, packageName, /*killUid = */false);
                    }
                    break;
                case CHECK_EXACT_ALARM_PERMISSION_ON_FEATURE_TOGGLE:
                    final boolean defaultDenied = (Boolean) msg.obj;

                    final int[] startedUserIds = mActivityManagerInternal.getStartedUserIds();
                    for (int appId : mExactAlarmCandidates) {
                        for (int userId : startedUserIds) {
                            uid = UserHandle.getUid(userId, appId);

                            final AndroidPackage packageForUid =
                                    mPackageManagerInternal.getPackage(uid);
                            if (packageForUid == null) {
                                continue;
                            }
                            final String pkg = packageForUid.getPackageName();
                            if (defaultDenied) {
                                if (!hasScheduleExactAlarmInternal(pkg, uid)
                                        && !hasUseExactAlarmInternal(pkg, uid)) {
                                    removeExactAlarmsOnPermissionRevoked(uid, pkg, true);
                                }
                            } else if (hasScheduleExactAlarmInternal(pkg, uid)) {
                                sendScheduleExactAlarmPermissionStateChangedBroadcast(pkg,
                                        UserHandle.getUserId(uid));
                            }
                        }
                    }
                    break;
                default:
                    // nope, just ignore it
                    break;
+0 −1
Original line number Diff line number Diff line
@@ -320,7 +320,6 @@ package android.app {
    method public void setDemoted(boolean);
    method public void setFgServiceShown(boolean);
    method public void setImportanceLockedByCriticalDeviceFunction(boolean);
    method public void setImportanceLockedByOEM(boolean);
    method public void setImportantConversation(boolean);
    method public void setOriginalImportance(int);
  }
+2 −2
Original line number Diff line number Diff line
@@ -4617,8 +4617,8 @@ public class ActivityManager {
        try {
            getService().broadcastIntentWithFeature(
                    null, null, intent, null, null, Activity.RESULT_OK, null, null,
                    null /*requiredPermissions*/, null /*excludedPermissions*/, appOp, null, false,
                    true, userId);
                    null /*requiredPermissions*/, null /*excludedPermissions*/,
                    null /*excludedPackages*/, appOp, null, false, true, userId);
        } catch (RemoteException ex) {
        }
    }
+14 −14
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.app;

import static android.Manifest.permission.CONTROL_KEYGUARD;
import static android.Manifest.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS;
import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
@@ -362,9 +363,8 @@ public class ActivityOptions extends ComponentOptions {
    private static final String KEY_LAUNCH_INTO_PIP_PARAMS =
            "android.activity.launchIntoPipParams";

    /** See {@link #setDismissKeyguardIfInsecure()}. */
    private static final String KEY_DISMISS_KEYGUARD_IF_INSECURE =
            "android.activity.dismissKeyguardIfInsecure";
    /** See {@link #setDismissKeyguard()}. */
    private static final String KEY_DISMISS_KEYGUARD = "android.activity.dismissKeyguard";

    private static final String KEY_IGNORE_PENDING_INTENT_CREATOR_FOREGROUND_STATE =
            "android.activity.ignorePendingIntentCreatorForegroundState";
@@ -465,7 +465,7 @@ public class ActivityOptions extends ComponentOptions {
    private boolean mLaunchedFromBubble;
    private boolean mTransientLaunch;
    private PictureInPictureParams mLaunchIntoPipParams;
    private boolean mDismissKeyguardIfInsecure;
    private boolean mDismissKeyguard;
    private boolean mIgnorePendingIntentCreatorForegroundState;

    /**
@@ -1270,7 +1270,7 @@ public class ActivityOptions extends ComponentOptions {
        mLaunchIntoPipParams = opts.getParcelable(KEY_LAUNCH_INTO_PIP_PARAMS);
        mIsEligibleForLegacyPermissionPrompt =
                opts.getBoolean(KEY_LEGACY_PERMISSION_PROMPT_ELIGIBLE);
        mDismissKeyguardIfInsecure = opts.getBoolean(KEY_DISMISS_KEYGUARD_IF_INSECURE);
        mDismissKeyguard = opts.getBoolean(KEY_DISMISS_KEYGUARD);
        mIgnorePendingIntentCreatorForegroundState = opts.getBoolean(
                KEY_IGNORE_PENDING_INTENT_CREATOR_FOREGROUND_STATE);
    }
@@ -1869,24 +1869,24 @@ public class ActivityOptions extends ComponentOptions {
    }

    /**
     * Sets whether the insecure keyguard should go away when this activity launches. In case the
     * keyguard is secure, this option will be ignored.
     * Sets whether the keyguard should go away when this activity launches.
     *
     * @see Activity#setShowWhenLocked(boolean)
     * @see android.R.attr#showWhenLocked
     * @hide
     */
    public void setDismissKeyguardIfInsecure() {
        mDismissKeyguardIfInsecure = true;
    @RequiresPermission(CONTROL_KEYGUARD)
    public void setDismissKeyguard() {
        mDismissKeyguard = true;
    }

    /**
     * @see #setDismissKeyguardIfInsecure()
     * @see #setDismissKeyguard()
     * @return whether the insecure keyguard should go away when the activity launches.
     * @hide
     */
    public boolean getDismissKeyguardIfInsecure() {
        return mDismissKeyguardIfInsecure;
    public boolean getDismissKeyguard() {
        return mDismissKeyguard;
    }

    /**
@@ -2167,8 +2167,8 @@ public class ActivityOptions extends ComponentOptions {
            b.putBoolean(KEY_LEGACY_PERMISSION_PROMPT_ELIGIBLE,
                    mIsEligibleForLegacyPermissionPrompt);
        }
        if (mDismissKeyguardIfInsecure) {
            b.putBoolean(KEY_DISMISS_KEYGUARD_IF_INSECURE, mDismissKeyguardIfInsecure);
        if (mDismissKeyguard) {
            b.putBoolean(KEY_DISMISS_KEYGUARD, mDismissKeyguard);
        }
        if (mIgnorePendingIntentCreatorForegroundState) {
            b.putBoolean(KEY_IGNORE_PENDING_INTENT_CREATOR_FOREGROUND_STATE,
Loading