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

Commit 7afcf033 authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by android-build-merger
Browse files

Ask for PIN when granting permissions in front of lock screen am: b5302e67

am: 55c96e9b

Change-Id: I790d9c25c31f8eaef6c045246eb36ec33d042f9e
parents 660ea57e 55c96e9b
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.content.pm.PackageManager.PERMISSION_DENIED;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;

import android.app.admin.DevicePolicyManager;
import android.app.KeyguardManager;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@@ -302,6 +303,32 @@ public class GrantPermissionsActivity extends OverlayTouchActivity

    @Override
    public void onPermissionGrantResult(String name, boolean granted, boolean doNotAskAgain) {
        KeyguardManager kgm = getSystemService(KeyguardManager.class);

        if (kgm.isDeviceLocked()) {
            kgm.requestDismissKeyguard(this, new KeyguardManager.KeyguardDismissCallback() {
                        @Override
                        public void onDismissError() {
                            Log.e(LOG_TAG, "Cannot dismiss keyguard perm=" + name + " granted="
                                   + granted + " doNotAskAgain=" + doNotAskAgain);
                        }

                        @Override
                        public void onDismissCancelled() {
                            // do nothing (i.e. stay at the current permission group)
                        }

                        @Override
                        public void onDismissSucceeded() {
                            // Now the keyguard is dismissed, hence the device is not locked
                            // anymore
                            onPermissionGrantResult(name, granted, doNotAskAgain);
                        }
                    });

            return;
        }

        GroupState groupState = mRequestGrantPermissionGroups.get(name);
        if (groupState.mGroup != null) {
            if (granted) {