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

Commit 68655767 authored by Anna Zhuravleva's avatar Anna Zhuravleva
Browse files

Log calling package on PS unlock

Set calling package extra to the disable quiet mode
after unlock intent.

Bug: 313915731
Test: ./out/host/linux-x86/bin/statsd_testdrive 103
https: //paste.googleplex.com/5940481662386176
Change-Id: Id623c4f470fb352e4c3eaba8afc6cf2f7e4053b6
parent 4a4bbbfb
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -532,9 +532,10 @@ public class UserManagerService extends IUserManager.Stub {
            }
            final IntentSender target = intent.getParcelableExtra(Intent.EXTRA_INTENT, android.content.IntentSender.class);
            final int userId = intent.getIntExtra(Intent.EXTRA_USER_ID, UserHandle.USER_NULL);
            final String callingPackage = intent.getStringExtra(Intent.EXTRA_PACKAGE_NAME);
            // Call setQuietModeEnabled on bg thread to avoid ANR
            BackgroundThread.getHandler().post(() ->
                    setQuietModeEnabled(userId, false, target, /* callingPackage */ null));
                    setQuietModeEnabled(userId, false, target, callingPackage));
        }
    };

@@ -1410,7 +1411,7 @@ public class UserManagerService extends IUserManager.Stub {
                    if (onlyIfCredentialNotRequired) {
                        return false;
                    }
                    showConfirmCredentialToDisableQuietMode(userId, target);
                    showConfirmCredentialToDisableQuietMode(userId, target, callingPackage);
                    return false;
                }
            }
@@ -1434,7 +1435,7 @@ public class UserManagerService extends IUserManager.Stub {
                if (onlyIfCredentialNotRequired) {
                    return false;
                }
                showConfirmCredentialToDisableQuietMode(userId, target);
                showConfirmCredentialToDisableQuietMode(userId, target, callingPackage);
                return false;
            }
            setQuietModeEnabled(userId, false /* enableQuietMode */, target, callingPackage);
@@ -1592,7 +1593,7 @@ public class UserManagerService extends IUserManager.Stub {
     * Show confirm credential screen to unlock user in order to turn off quiet mode.
     */
    private void showConfirmCredentialToDisableQuietMode(
            @UserIdInt int userId, @Nullable IntentSender target) {
            @UserIdInt int userId, @Nullable IntentSender target, @Nullable String callingPackage) {
        if (android.app.admin.flags.Flags.quietModeCredentialBugFix()) {
            // TODO (b/308121702) It may be brittle to rely on user states to check profile state
            int state;
@@ -1623,6 +1624,7 @@ public class UserManagerService extends IUserManager.Stub {
        }
        callBackIntent.putExtra(Intent.EXTRA_USER_ID, userId);
        callBackIntent.setPackage(mContext.getPackageName());
        callBackIntent.putExtra(Intent.EXTRA_PACKAGE_NAME, callingPackage);
        callBackIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        final PendingIntent pendingIntent = PendingIntent.getBroadcast(
                mContext,