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

Commit 2d763bd5 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Merge cherrypicks of [6072697, 6072075, 6072758, 6072124, 6072885, 6072886,...

Merge cherrypicks of [6072697, 6072075, 6072758, 6072124, 6072885, 6072886, 6072887, 6072580, 6072581, 6072582, 6072583, 6072584, 6072132, 6072195, 6072133, 6072077, 6072134, 6072078, 6072211, 6072762, 6072763, 6072908, 6072909, 6072910, 6072911, 6072912, 6072913, 6072914, 6072930, 6072212, 6072743] into pi-qpr2-release

Change-Id: I84387b1e56f01c89624d23bfe525cb585f7444d7
parents ded9a473 6c613fd7
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;
@@ -447,6 +448,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 != null && groupState.mGroup != null) {
            if (granted) {