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

Commit cca42cd6 authored by Jorge Ruesga's avatar Jorge Ruesga
Browse files

privacyguard: Share privacy package name between activity stacks

AOSP 4.4 now has a stack supervisor with differents activity stacks for home and focus activities.
Every ActivityStack instance has a ref to this supervisor. Just share the privacy guard package name
throught the supervisor.

Patchset 2: Fix formatting

Change-Id: I5dd75cfa7f5e8b568a4302fce98809ae307c6d52
JIRA: CYAN-2874
Issue: https://jira.cyanogenmod.org/browse/CYAN-2874


Signed-off-by: default avatarJorge Ruesga <jorge@ruesga.com>
parent c0269be8
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -220,11 +220,6 @@ final class ActivityStack {
    long mLaunchStartTime = 0;
    long mFullyDrawnStartTime = 0;

    /**
     * Is the privacy guard currently enabled?
     */
    String mPrivacyGuardPackageName = null;

    /**
     * Save the most recent screenshot for reuse. This keeps Recents from taking two identical
     * screenshots, one for the Recents thumbnail and one for the pauseActivity thumbnail.
@@ -1715,23 +1710,24 @@ final class ActivityStack {

    private final void updatePrivacyGuardNotificationLocked(ActivityRecord next) {

        if (mPrivacyGuardPackageName != null && mPrivacyGuardPackageName.equals(next.packageName)) {
        String privacyGuardPackageName = mStackSupervisor.mPrivacyGuardPackageName;
        if (privacyGuardPackageName != null && privacyGuardPackageName.equals(next.packageName)) {
            return;
        }

        boolean privacy = mService.mAppOpsService.getPrivacyGuardSettingForPackage(
                next.app.uid, next.packageName);

        if (mPrivacyGuardPackageName != null && !privacy) {
        if (privacyGuardPackageName != null && !privacy) {
            Message msg = mService.mHandler.obtainMessage(
                    ActivityManagerService.CANCEL_PRIVACY_NOTIFICATION_MSG, next.userId);
            msg.sendToTarget();
            mPrivacyGuardPackageName = null;
            mStackSupervisor.mPrivacyGuardPackageName = null;
        } else if (privacy) {
            Message msg = mService.mHandler.obtainMessage(
                    ActivityManagerService.POST_PRIVACY_NOTIFICATION_MSG, next);
            msg.sendToTarget();
            mPrivacyGuardPackageName = next.packageName;
            mStackSupervisor.mPrivacyGuardPackageName = next.packageName;
        }
    }

+5 −0
Original line number Diff line number Diff line
@@ -206,6 +206,11 @@ public final class ActivityStackSupervisor {
    /** Stack id of the front stack when user switched, indexed by userId. */
    SparseIntArray mUserStackInFront = new SparseIntArray(2);

    /**
     * Is the privacy guard currently enabled? Shared between ActivityStacks
     */
    String mPrivacyGuardPackageName = null;

    public ActivityStackSupervisor(ActivityManagerService service, Context context,
            Looper looper) {
        mService = service;