summaryrefslogtreecommitdiff
path: root/framework-s/java
diff options
context:
space:
mode:
author Jay Thomas Sullivan <jaysullivan@google.com> 2024-02-02 12:13:04 -0800
committer Jay Thomas Sullivan <jaysullivan@google.com> 2024-02-02 15:46:07 -0800
commit3714a521e1942d58e8e8322ce86b662e9a3999d9 (patch)
treea5730f40fefbc80e42392b3a93b84d267d4a4043 /framework-s/java
parent0792b14796cb7346ebafc6fd430cf7c4a6ffad30 (diff)
[ECM] Make AtomicInteger static
In a recent commit, I introduced an AtomicInteger to generate unique request codes that should never repeat. But, I mistakenly made it a instance variable. Make it static so it will be unique across instances of this class. Bug: 26056958 Test: atest CtsPermissionUiTestCases:android.permissionui.cts.EnhancedConfirmationManagerTest Change-Id: I04d0b7f2be854cf84155811b15282a66bbc92199
Diffstat (limited to 'framework-s/java')
-rw-r--r--framework-s/java/android/app/ecm/EnhancedConfirmationManager.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java b/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java
index d80e18f2f..86aa222c6 100644
--- a/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java
+++ b/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java
@@ -229,7 +229,7 @@ public final class EnhancedConfirmationManager {
private final @NonNull IEnhancedConfirmationManager mService;
- private final @NonNull AtomicInteger mNextRequestCode;
+ private static final AtomicInteger sNextRequestCode = new AtomicInteger(1);
/**
* @hide
@@ -239,7 +239,6 @@ public final class EnhancedConfirmationManager {
mContext = context;
mPackageManager = context.getPackageManager();
mService = service;
- mNextRequestCode = new AtomicInteger(1);
}
/**
@@ -349,7 +348,7 @@ public final class EnhancedConfirmationManager {
Intent intent = new Intent(Settings.ACTION_SHOW_RESTRICTED_SETTING_DIALOG);
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName);
intent.putExtra(Intent.EXTRA_UID, getPackageUid(packageName));
- return PendingIntent.getActivity(mContext, mNextRequestCode.getAndIncrement(),
+ return PendingIntent.getActivity(mContext, sNextRequestCode.getAndIncrement(),
intent, PendingIntent.FLAG_IMMUTABLE);
}