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

Commit 96a91f11 authored by Bryce Lee's avatar Bryce Lee Committed by android-build-merger
Browse files

Merge "Don't resume activity if user is locked and encryption is unsupported"...

Merge "Don't resume activity if user is locked and encryption is unsupported" into oc-mr1-dev am: 1327cdc5
am: 004f9a30

Change-Id: Ifcbb0d3fbde8f87052509d5ef0a0b57e013e2245
parents 8ee6ecc1 004f9a30
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1508,6 +1508,11 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE) != 0;
    }

    /** @hide */
    public boolean isEncryptionAware() {
        return isDirectBootAware() || isPartiallyDirectBootAware();
    }

    /**
     * @hide
     */
+8 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ import android.os.RemoteException;
import android.os.SystemClock;
import android.os.Trace;
import android.os.UserHandle;
import android.os.storage.StorageManager;
import android.service.voice.IVoiceInteractionSession;
import android.util.EventLog;
import android.util.Log;
@@ -2020,6 +2021,13 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo

    /** Checks whether the activity should be shown for current user. */
    public boolean okToShowLocked() {
        // We cannot show activities when the device is locked and the application is not
        // encryption aware.
        if (!StorageManager.isUserKeyUnlocked(userId)
                && !info.applicationInfo.isEncryptionAware()) {
            return false;
        }

        return (info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0
                || (mStackSupervisor.isCurrentProfileLocked(userId)
                && service.mUserController.isUserRunningLocked(userId, 0 /* flags */));
+1 −2
Original line number Diff line number Diff line
@@ -3884,8 +3884,7 @@ public class PackageManagerService extends IPackageManager.Stub
                throw new SecurityException("Package " + packageName + " is currently frozen!");
            }
            if (!userKeyUnlocked && !(ps.pkg.applicationInfo.isDirectBootAware()
                    || ps.pkg.applicationInfo.isPartiallyDirectBootAware())) {
            if (!userKeyUnlocked && !ps.pkg.applicationInfo.isEncryptionAware()) {
                throw new SecurityException("Package " + packageName + " is not encryption aware!");
            }
        }