From a784a1b359b5eecfc357feb842d20eed1a3691e0 Mon Sep 17 00:00:00 2001 From: Ivan Chiang Date: Wed, 15 Oct 2025 03:27:26 +0000 Subject: [PATCH 001/844] Reapply "[PM] Check unknown sources user restriction for intent installation" This reverts commit 29962260bd043c197e411b690e862a318b31bae5. Fix the issues and reland the patch. Bypass the unknown source user restrictions check when either of the following two conditions is met: 1. An installer with the INSTALL_PACKAGES permission initiated the installation via the PackageInstaller APIs and not via an ACTION_VIEW or ACTION_INSTALL_PACKAGE intent. 2. An installer is a privileged app and initiated the installer via the ACTION_INSTALL_PACKAGE or ACTION_VIEW intent, but it has set the EXTRA_NOT_UNKNOWN_SOURCE flag to be true in the intent. Flag: EXEMPT BUGFIX Bug: 438352252 Test: atest CtsDevicePolicyManagerTestCases:MixedProfileOwnerTest#testPackageInstallUserRestrictions Test: atest CtsDevicePolicyManagerTestCases:MixedManagedProfileOwnerTest#testPackageInstallUserRestrictions Test: atest CtsPackageInstallTestCases:IntentTest Test: atest CtsPackageInstallSessionTestCases:SessionTest Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:81f83fdb0944d0d8a3337d2578d73dd77d60143b Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:6e0b7c02e54a0c8f26ecb2eefd136677df7decfc Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:9d20d0ae8fef770df8788e287feee1bdaa1d82fe Merged-In: Ib917acb2c4738f6a4758b8ca149b80943f00acca Change-Id: Ib917acb2c4738f6a4758b8ca149b80943f00acca --- .../packageinstaller/InstallStart.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java b/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java index d28b15fae4548..26fad0f345c57 100644 --- a/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java +++ b/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java @@ -178,7 +178,20 @@ && checkPermission(Manifest.permission.INSTALL_PACKAGES, /* pid= */ -1, mAbortInstall = true; } - checkDevicePolicyRestrictions(isTrustedSource); + // Bypass the unknown source user restrictions check when either of the following + // two conditions is met: + // 1. An installer with the INSTALL_PACKAGES permission initiated the + // installation via the PackageInstaller APIs and not via an + // ACTION_VIEW or ACTION_INSTALL_PACKAGE intent. + // 2. An installer is a privileged app and initiated the installer via + // the ACTION_INSTALL_PACKAGE or ACTION_VIEW intent, but it has set the + // EXTRA_NOT_UNKNOWN_SOURCE flag to be true in the intent. + final boolean isIntentInstall = + Intent.ACTION_VIEW.equals(intentAction) + || Intent.ACTION_INSTALL_PACKAGE.equals(intentAction); + final boolean bypassUnknownSourceRestrictions = + (!isIntentInstall && isInstallPkgPermissionGranted) || isPrivilegedAndKnown; + checkDevicePolicyRestrictions(bypassUnknownSourceRestrictions); final String installerPackageNameFromIntent = getIntent().getStringExtra( Intent.EXTRA_INSTALLER_PACKAGE_NAME); @@ -344,9 +357,9 @@ private boolean isCallerSessionOwner(int callingUid, int sessionId) { return callingUid == installerUid; } - private void checkDevicePolicyRestrictions(boolean isTrustedSource) { + private void checkDevicePolicyRestrictions(boolean bypassUnknownSourceRestrictions) { String[] restrictions; - if(isTrustedSource) { + if (bypassUnknownSourceRestrictions) { restrictions = new String[] { UserManager.DISALLOW_INSTALL_APPS }; } else { restrictions = new String[] { From 91f7abe90b8e40481266cea4ba5ee1d8d3433431 Mon Sep 17 00:00:00 2001 From: Ivan Chiang Date: Tue, 18 Nov 2025 07:40:08 +0000 Subject: [PATCH 002/844] [PM] Check unknown sources for intent installation Bypass the unknown source check for the device policy and the AppOps permission when either of the following two conditions is met: 1. An installer with the INSTALL_PACKAGES permission initiated the installation via the PackageInstaller APIs and not via an ACTION_VIEW or ACTION_INSTALL_PACKAGE intent. 2. An installer is a privileged app and it has set the EXTRA_NOT_UNKNOWN_SOURCE flag to be true in the intent. Flag: EXEMPT BUGFIX Bug: 461467954 Test: atest CtsDevicePolicyManagerTestCases:MixedProfileOwnerTest#testPackageInstallUserRestrictions Test: atest CtsDevicePolicyManagerTestCases:MixedManagedProfileOwnerTest#testPackageInstallUserRestrictions Test: atest CtsPackageInstallTestCases:IntentTest Test: atest CtsPackageInstallSessionTestCases:SessionTest Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:3a8cafbc916bb16f08093cd138a4f3d4dc71b5a0 DISABLE_TOPIC_PROTECTOR Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:2037b1942fa03b2bcef1a594391a9066843e12b9 Merged-In: I66e863cf06566ddc08ad78a61dd82a548cde5e4c Change-Id: I66e863cf06566ddc08ad78a61dd82a548cde5e4c --- .../packageinstaller/InstallStart.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java b/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java index 26fad0f345c57..d1642719470ec 100644 --- a/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java +++ b/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java @@ -131,7 +131,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { boolean isDocumentsManager = checkPermission(Manifest.permission.MANAGE_DOCUMENTS, -1, callingUid) == PackageManager.PERMISSION_GRANTED; boolean isSystemDownloadsProvider = PackageUtil.getSystemDownloadsProviderInfo( - mPackageManager, callingUid) != null; + mPackageManager, callingUid) != null; // By default, the originatingUid is callingUid. If the caller is the system download // provider or the documents manager, we parse the originatingUid from the @@ -151,7 +151,18 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { && checkPermission(Manifest.permission.INSTALL_PACKAGES, /* pid= */ -1, originatingUid) == PackageManager.PERMISSION_GRANTED; - boolean isTrustedSource = isPrivilegedAndKnown || isInstallPkgPermissionGranted; + // Bypass the unknown source user restrictions check when either of the following + // two conditions is met: + // 1. An installer with the INSTALL_PACKAGES permission initiated the + // installation via the PackageInstaller APIs and not via an + // ACTION_VIEW or ACTION_INSTALL_PACKAGE intent. + // 2. An installer is a privileged app and it has set the + // EXTRA_NOT_UNKNOWN_SOURCE flag to be true in the intent. + final boolean isIntentInstall = + Intent.ACTION_VIEW.equals(intentAction) + || Intent.ACTION_INSTALL_PACKAGE.equals(intentAction); + final boolean isTrustedSource = + (!isIntentInstall && isInstallPkgPermissionGranted) || isPrivilegedAndKnown; // In general case, the originatingUid is callingUid. If callingUid is INVALID_UID, return // InstallAborted in the check above. When the originatingUid is INVALID_UID here, it means @@ -178,20 +189,7 @@ && checkPermission(Manifest.permission.INSTALL_PACKAGES, /* pid= */ -1, mAbortInstall = true; } - // Bypass the unknown source user restrictions check when either of the following - // two conditions is met: - // 1. An installer with the INSTALL_PACKAGES permission initiated the - // installation via the PackageInstaller APIs and not via an - // ACTION_VIEW or ACTION_INSTALL_PACKAGE intent. - // 2. An installer is a privileged app and initiated the installer via - // the ACTION_INSTALL_PACKAGE or ACTION_VIEW intent, but it has set the - // EXTRA_NOT_UNKNOWN_SOURCE flag to be true in the intent. - final boolean isIntentInstall = - Intent.ACTION_VIEW.equals(intentAction) - || Intent.ACTION_INSTALL_PACKAGE.equals(intentAction); - final boolean bypassUnknownSourceRestrictions = - (!isIntentInstall && isInstallPkgPermissionGranted) || isPrivilegedAndKnown; - checkDevicePolicyRestrictions(bypassUnknownSourceRestrictions); + checkDevicePolicyRestrictions(isTrustedSource); final String installerPackageNameFromIntent = getIntent().getStringExtra( Intent.EXTRA_INSTALLER_PACKAGE_NAME); @@ -357,9 +355,9 @@ private boolean isCallerSessionOwner(int callingUid, int sessionId) { return callingUid == installerUid; } - private void checkDevicePolicyRestrictions(boolean bypassUnknownSourceRestrictions) { + private void checkDevicePolicyRestrictions(boolean isTrustedSource) { String[] restrictions; - if (bypassUnknownSourceRestrictions) { + if (isTrustedSource) { restrictions = new String[] { UserManager.DISALLOW_INSTALL_APPS }; } else { restrictions = new String[] { From 6f67bbc2f886af63c386f21ea1fc1b22839120ba Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Tue, 11 Nov 2025 15:32:59 -0500 Subject: [PATCH 003/844] Prevent long press on profile notifs when locked Test: NotificationGutsManagerTest Bug: 378087531 Flag: EXEMPT BUGFIX (cherry picked from commit a6280c4ccf96685eed5dc57c2bd9cbbe04209bf1) Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:2533e349017a749e8b6bf3039958c3cc7428f754 Merged-In: Ic4ab842763d2d9473adcfc426a64434aec5c6ed2 Change-Id: Ic4ab842763d2d9473adcfc426a64434aec5c6ed2 --- .../row/NotificationGutsManager.java | 10 +++ .../NotificationGutsManagerWithScenesTest.kt | 85 +++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java index 06cab55e31e06..19d09d4a5b081 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java @@ -805,6 +805,10 @@ boolean openGutsInternal( } final ExpandableNotificationRow row = (ExpandableNotificationRow) view; + if (affectedByWorkProfileLock(row)) { + return false; + } + if (row.isNotificationRowLongClickable()) { view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } @@ -875,6 +879,12 @@ public void run() { return true; } + boolean affectedByWorkProfileLock(ExpandableNotificationRow row) { + int userId = row.getEntry().getSbn().getNormalizedUserId(); + return mUserManager.isManagedProfile(userId) + && mLockscreenUserManager.isLockscreenPublicMode(userId); + } + /** * @param gutsListener the listener for open and close guts events */ diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerWithScenesTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerWithScenesTest.kt index b607266fdefa1..a467e83cb7008 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerWithScenesTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerWithScenesTest.kt @@ -86,9 +86,13 @@ import kotlin.test.assertEquals import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import org.junit.Assert +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Test import org.junit.runner.RunWith +import org.mockito.ArgumentMatchers.anyBoolean +import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mock import org.mockito.MockitoAnnotations import org.mockito.invocation.InvocationOnMock @@ -514,6 +518,87 @@ class NotificationGutsManagerWithScenesTest : SysuiTestCase() { ) } + @Test + fun testShowGuts_lockedPrimary_yes() { + whenever(userManager.isManagedProfile(anyInt())).thenReturn(false) + whenever(notificationLockscreenUserManager.isLockscreenPublicMode(anyInt())) + .thenReturn(true) + + val guts = spy(NotificationGuts(mContext)) + whenever(guts.post(any())).thenAnswer { invocation: InvocationOnMock -> + handler.post(((invocation.arguments[0] as Runnable))) + null + } + + // Test doesn't support animation since the guts view is not attached. + doNothing().whenever(guts).openControls(anyInt(), anyInt(), anyBoolean(), any()) + + val realRow = createTestNotificationRow() + val menuItem = createTestMenuItem(realRow) + + val row = spy(realRow) + whenever(row.windowToken).thenReturn(Binder()) + whenever(row.guts).thenReturn(guts) + + assertTrue(gutsManager.openGutsInternal(row, 0, 0, menuItem)) + executor.runAllReady() + verify(guts).openControls(anyInt(), anyInt(), anyBoolean(), any()) + } + + @Test + fun testShowGuts_unlockedWork_yes() { + whenever(userManager.isManagedProfile(anyInt())).thenReturn(true) + whenever(notificationLockscreenUserManager.isLockscreenPublicMode(anyInt())) + .thenReturn(false) + + val guts = spy(NotificationGuts(mContext)) + whenever(guts.post(any())).thenAnswer { invocation: InvocationOnMock -> + handler.post(((invocation.arguments[0] as Runnable))) + null + } + + // Test doesn't support animation since the guts view is not attached. + doNothing().whenever(guts).openControls(anyInt(), anyInt(), anyBoolean(), any()) + + val realRow = createTestNotificationRow() + val menuItem = createTestMenuItem(realRow) + + val row = spy(realRow) + whenever(row.windowToken).thenReturn(Binder()) + whenever(row.guts).thenReturn(guts) + + assertTrue(gutsManager.openGutsInternal(row, 0, 0, menuItem)) + executor.runAllReady() + verify(guts).openControls(anyInt(), anyInt(), anyBoolean(), any()) + } + + @Test + fun testShowGuts_lockedWork_no() { + whenever(userManager.isManagedProfile(anyInt())).thenReturn(true) + whenever(notificationLockscreenUserManager.isLockscreenPublicMode(anyInt())) + .thenReturn(true) + + val guts = spy(NotificationGuts(mContext)) + whenever(guts.post(any())).thenAnswer { invocation: InvocationOnMock -> + handler.post(((invocation.arguments[0] as Runnable))) + null + } + + // Test doesn't support animation since the guts view is not attached. + doNothing().whenever(guts).openControls(anyInt(), anyInt(), anyBoolean(), any()) + + val realRow = createTestNotificationRow() + val menuItem = createTestMenuItem(realRow) + + val row = spy(realRow) + whenever(row.windowToken).thenReturn(Binder()) + whenever(row.guts).thenReturn(guts) + + assertFalse(gutsManager.openGutsInternal(row, 0, 0, menuItem)) + executor.runAllReady() + verify(guts, never()).openControls(anyInt(), anyInt(), anyBoolean(), any()) + } + private fun createTestNotificationRow( block: NotificationEntryBuilder.() -> Unit = {} ): ExpandableNotificationRow { From 3900a857273f115cfc7d29146c5e14b5472cfce4 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Wed, 12 Nov 2025 12:09:31 -0500 Subject: [PATCH 004/844] Be more strict about content types for message array Now with fewer class cast exceptions Test: ConversationNotification Test: NotificationManagerServiceTest Bug: 433746973 Flag: EXEMPT BUGFIX (cherry picked from commit 71d4afae00c7d6d9238f8ec82303e1e13da50fbb) Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:f64c1e377842d9a8df814bcbad831bd4ce01583d Merged-In: I3022e010de95f14dcd0d09d123684ee265101e0a Change-Id: I3022e010de95f14dcd0d09d123684ee265101e0a --- core/java/android/app/Notification.java | 18 ++-- .../NotificationManagerServiceTest.java | 102 +++++++++++++++++- 2 files changed, 108 insertions(+), 12 deletions(-) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 354e594cf7303..85921a77c6b43 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -3236,8 +3236,8 @@ public void visitUris(@NonNull Consumer visitor) { person.visitUris(visitor); } - final Parcelable[] messages = extras.getParcelableArray(EXTRA_MESSAGES, - Parcelable.class); + final Bundle[] messages = + getParcelableArrayFromBundle(extras, EXTRA_MESSAGES, Bundle.class); if (!ArrayUtils.isEmpty(messages)) { for (MessagingStyle.Message message : MessagingStyle.Message .getMessagesFromBundleArray(messages)) { @@ -3245,8 +3245,8 @@ public void visitUris(@NonNull Consumer visitor) { } } - final Parcelable[] historic = extras.getParcelableArray(EXTRA_HISTORIC_MESSAGES, - Parcelable.class); + final Parcelable[] historic = + getParcelableArrayFromBundle(extras, EXTRA_HISTORIC_MESSAGES, Bundle.class); if (!ArrayUtils.isEmpty(historic)) { for (MessagingStyle.Message message : MessagingStyle.Message .getMessagesFromBundleArray(historic)) { @@ -8501,8 +8501,8 @@ public boolean showsChronometer() { */ public boolean hasImage() { if (isStyle(MessagingStyle.class) && extras != null) { - final Parcelable[] messages = extras.getParcelableArray(EXTRA_MESSAGES, - Parcelable.class); + final Bundle[] messages = + getParcelableArrayFromBundle(extras, EXTRA_MESSAGES, Bundle.class); if (!ArrayUtils.isEmpty(messages)) { for (MessagingStyle.Message m : MessagingStyle.Message .getMessagesFromBundleArray(messages)) { @@ -9794,10 +9794,10 @@ protected void restoreFromExtras(Bundle extras) { mUser = user; } mConversationTitle = extras.getCharSequence(EXTRA_CONVERSATION_TITLE); - Parcelable[] messages = extras.getParcelableArray(EXTRA_MESSAGES, Parcelable.class); + Bundle[] messages = getParcelableArrayFromBundle(extras, EXTRA_MESSAGES, Bundle.class); mMessages = Message.getMessagesFromBundleArray(messages); - Parcelable[] histMessages = extras.getParcelableArray(EXTRA_HISTORIC_MESSAGES, - Parcelable.class); + Bundle[] histMessages = getParcelableArrayFromBundle( + extras, EXTRA_HISTORIC_MESSAGES, Bundle.class); mHistoricMessages = Message.getMessagesFromBundleArray(histMessages); mIsGroupConversation = extras.getBoolean(EXTRA_IS_GROUP_CONVERSATION); mUnreadMessageCount = extras.getInt(EXTRA_CONVERSATION_UNREAD_MESSAGE_COUNT); diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index 7dc0921db4104..7be8cba2d23bf 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -30,6 +30,8 @@ import static android.app.Flags.FLAG_NM_SUMMARIZATION_UI; import static android.app.Flags.FLAG_UI_RICH_ONGOING; import static android.app.Notification.EXTRA_ALLOW_DURING_SETUP; +import static android.app.Notification.EXTRA_MESSAGES; +import static android.app.Notification.EXTRA_MESSAGING_PERSON; import static android.app.Notification.EXTRA_PICTURE; import static android.app.Notification.EXTRA_PICTURE_ICON; import static android.app.Notification.EXTRA_PREFER_SMALL_ICON; @@ -87,6 +89,7 @@ import static android.app.PendingIntent.FLAG_IMMUTABLE; import static android.app.PendingIntent.FLAG_MUTABLE; import static android.app.PendingIntent.FLAG_ONE_SHOT; +import static android.app.PendingIntent.FLAG_UPDATE_CURRENT; import static android.app.StatusBarManager.ACTION_KEYGUARD_PRIVATE_NOTIFICATIONS_CHANGED; import static android.app.StatusBarManager.EXTRA_KM_PRIVATE_NOTIFS_ALLOWED; import static android.app.backup.NotificationLoggingConstants.DATA_TYPE_ZEN_CONFIG; @@ -246,11 +249,13 @@ import android.compat.testing.PlatformCompatChangeRule; import android.content.BroadcastReceiver; import android.content.ComponentName; +import android.content.ContentProvider; import android.content.ContentUris; import android.content.Context; import android.content.IIntentSender; import android.content.Intent; import android.content.IntentFilter; +import android.content.UriPermission; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; @@ -267,6 +272,7 @@ import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Color; +import android.graphics.Rect; import android.graphics.drawable.Icon; import android.media.AudioAttributes; import android.media.AudioManager; @@ -1535,6 +1541,96 @@ private void verifyToastShownForTestPackage(String text, int displayId) { eq(TOAST_DURATION), any(), eq(displayId)); } + @Test + public void testNoUriGrantsForBadMessagesList() throws RemoteException { + Uri targetUri = Uri.parse("content://com.android.contacts/display_photo/1"); + + // create message person + Person person = new Person.Builder() + .setName("Name") + .setIcon(Icon.createWithContentUri(targetUri)) + .setKey("user_123") + .setBot(false) + .build(); + + // create MessagingStyle + Notification.MessagingStyle messagingStyle = new Notification.MessagingStyle(person) + .setConversationTitle("Bug discussion") + .setGroupConversation(true) + .addMessage("Hi,look my photo", System.currentTimeMillis() - 60000, person) + .addMessage("Oho, you used my contacts photo", + System.currentTimeMillis() - 30000, "Friend"); + + // create Notification + Notification notification = new Notification.Builder(mContext, TEST_CHANNEL_ID) + .setSmallIcon(R.drawable.sym_def_app_icon) + .setContentTitle("") + .setContentText("") + .setAutoCancel(true) + .setStyle(messagingStyle) + .setCategory(Notification.CATEGORY_MESSAGE) + .setFlag(Notification.FLAG_GROUP_SUMMARY, true) + .build(); + notification.contentIntent = createPendingIntent("open"); + + notification.extras.remove(EXTRA_MESSAGING_PERSON); + + // add BadClipDescription to avoid visitUri check uris in EXTRA_MESSAGES value + ArrayList parcelableArray = + new ArrayList<>(List.of(notification.extras.getParcelableArray(EXTRA_MESSAGES))); + parcelableArray.add(new MyParceledListSlice()); + notification.extras.putParcelableArray( + EXTRA_MESSAGES, parcelableArray.toArray(new Parcelable[0])); + try { + mBinderService.enqueueNotificationWithTag(mPkg, mPkg, + "testNoUriGrantsForBadMessagesList", + 1, notification, mContext.getUserId()); + waitForIdle(); + fail("should have failed to parse messages"); + } catch (java.lang.ArrayStoreException e) { + verify(mUgmInternal, never()).checkGrantUriPermission( + anyInt(), any(), eq(ContentProvider.getUriWithoutUserId(targetUri)), + anyInt(), anyInt()); + } + } + + private class MyParceledListSlice extends Intent { + @Override + public void writeToParcel(Parcel dest, int i) { + Parcel test = Parcel.obtain(); + test.writeString(this.getClass().getName()); + int strLength = test.dataSize(); + test.recycle(); + dest.setDataPosition(dest.dataPosition() - strLength); + dest.writeString("android.content.pm.ParceledListSlice"); + + dest.writeInt(1); + dest.writeString(UriPermission.class.getName()); + dest.writeInt(0); // use binder + dest.writeStrongBinder(new Binder() { + private int callingPid = -1; + @Override + public boolean onTransact(int code, Parcel data, Parcel reply, int flags) + throws RemoteException { + if (code == 1) { + reply.writeNoException(); + reply.writeInt(1); + if (getCallingUid() == 1000 && callingPid == -1) { + reply.writeParcelable(new Rect(), 0); + callingPid = getCallingPid(); + } else { + reply.writeInt(-1); + reply.writeInt(-1); + reply.writeLong(0); + } + return true; + } + return super.onTransact(code, data, reply, flags); + } + }); + } + } + @Test public void testDefaultAssistant_overrideDefault() { final int userId = mContext.getUserId(); @@ -8589,7 +8685,7 @@ public void testVisitUris() throws Exception { Bundle extras = new Bundle(); extras.putParcelable(Notification.EXTRA_AUDIO_CONTENTS_URI, audioContents); extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, backgroundImage.toString()); - extras.putParcelable(Notification.EXTRA_MESSAGING_PERSON, person1); + extras.putParcelable(EXTRA_MESSAGING_PERSON, person1); extras.putParcelableArrayList(Notification.EXTRA_PEOPLE_LIST, new ArrayList<>(Arrays.asList(person2, person3))); extras.putParcelableArray(Notification.EXTRA_REMOTE_INPUT_HISTORY_ITEMS, @@ -8727,13 +8823,13 @@ public void testVisitUris_styleExtrasWithoutStyle() { .setSmallIcon(android.R.drawable.sym_def_app_icon); Bundle messagingExtras = new Bundle(); - messagingExtras.putParcelable(Notification.EXTRA_MESSAGING_PERSON, + messagingExtras.putParcelable(EXTRA_MESSAGING_PERSON, personWithIcon("content://user")); messagingExtras.putParcelableArray(Notification.EXTRA_HISTORIC_MESSAGES, new Bundle[] { new Notification.MessagingStyle.Message("Heyhey!", System.currentTimeMillis() - 100, personWithIcon("content://historicalMessenger")).toBundle()}); - messagingExtras.putParcelableArray(Notification.EXTRA_MESSAGES, + messagingExtras.putParcelableArray(EXTRA_MESSAGES, new Bundle[] { new Notification.MessagingStyle.Message("Are you there?", System.currentTimeMillis(), personWithIcon("content://messenger")).toBundle()}); From 5afaea5631c1cd643c8e212775c061ab1df60e46 Mon Sep 17 00:00:00 2001 From: Ian Baker Date: Tue, 16 Dec 2025 03:16:24 -0800 Subject: [PATCH 005/844] MediaSession: Enforce max name length on broadcast receivers too The previous change in ag/35590474 only checked the length of component names set via MediaSession.setMediaButtonReceiver(PendingIntent) [1] and not via MediaSession.setMediaButtonBroadcastReceiver(android.content.ComponentName) [2] as highlighted in b/433250316#comment72. [1] https://developer.android.com/reference/android/media/session/MediaSession#setMediaButtonBroadcastReceiver(android.content.ComponentName) [2] https://developer.android.com/reference/android/media/session/MediaSession#setMediaButtonBroadcastReceiver(android.content.ComponentName) Bug: 433250316 Test: Presubmit Flag: EXEMPT BUGFIX Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:d09400d72573c2e6124ae28dd9bb68139c9598a5 Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:23c44648eaddf4cb17ff6b77975a5f43c1293048 Merged-In: I7ef6bb0015f2501559793129ca62881911e7b9eb Change-Id: I7ef6bb0015f2501559793129ca62881911e7b9eb --- .../media/MediaButtonReceiverHolder.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/media/MediaButtonReceiverHolder.java b/services/core/java/com/android/server/media/MediaButtonReceiverHolder.java index 866651d4c3715..94a0eb0654261 100644 --- a/services/core/java/com/android/server/media/MediaButtonReceiverHolder.java +++ b/services/core/java/com/android/server/media/MediaButtonReceiverHolder.java @@ -137,6 +137,9 @@ public static MediaButtonReceiverHolder create( } public static MediaButtonReceiverHolder create(int userId, ComponentName broadcastReceiver) { + if (componentNameTooLong(broadcastReceiver)) { + throw new IllegalArgumentException("receiver name too long"); + } return new MediaButtonReceiverHolder(userId, null, broadcastReceiver, COMPONENT_TYPE_BROADCAST); } @@ -403,20 +406,27 @@ private static ComponentName getComponentName(PendingIntent pendingIntent, int c if (componentInfo != null && TextUtils.equals(componentInfo.packageName, pendingIntent.getCreatorPackage()) && componentInfo.packageName != null && componentInfo.name != null) { - int componentNameLength = - componentInfo.packageName.length() + componentInfo.name.length() + 1; - if (componentNameLength > MAX_COMPONENT_NAME_LENGTH) { + ComponentName componentName = + new ComponentName(componentInfo.packageName, componentInfo.name); + if (componentNameTooLong(componentName)) { Log.w(TAG, "detected and ignored component name with overly long package" + " or name, pi=" + pendingIntent); continue; } - return new ComponentName(componentInfo.packageName, componentInfo.name); + return componentName; } } return null; } + private static boolean componentNameTooLong(ComponentName componentName) { + return componentName.getPackageName().length() + + componentName.getClassName().length() + + 1 + > MAX_COMPONENT_NAME_LENGTH; + } + /** * Retrieves the {@link ComponentInfo} from a {@link ResolveInfo} instance. Similar to {@link * ResolveInfo#getComponentInfo()}, but returns {@code null} if this {@link ResolveInfo} points From d5566a5c706dd0018160fe2b8766461b6c2354ec Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Tue, 18 Nov 2025 22:34:11 +0000 Subject: [PATCH 006/844] Remove any revoked associations after reboot Test: manually Bug: 442392902 Flag: EXEMPT bugfix Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:13714bcfaff6ef1c16d0aa3d359b1c8bc1859ac3 Merged-In: I94b96d98608d6702e1d3a9581e135280149bf7e1 Change-Id: I94b96d98608d6702e1d3a9581e135280149bf7e1 --- .../server/companion/CompanionDeviceManagerService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java index a25d13207e8ec..0879ec7ad5418 100644 --- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java @@ -34,6 +34,7 @@ import static com.android.internal.util.Preconditions.checkState; import static com.android.server.companion.association.DisassociationProcessor.REASON_API; import static com.android.server.companion.association.DisassociationProcessor.REASON_PKG_DATA_CLEARED; +import static com.android.server.companion.association.DisassociationProcessor.REASON_REVOKED; import static com.android.server.companion.utils.PackageUtils.enforceUsesCompanionDeviceFeature; import static com.android.server.companion.utils.PackageUtils.isRestrictedSettingsAllowed; import static com.android.server.companion.utils.PermissionsUtils.enforceCallerCanManageAssociationsForPackage; @@ -219,6 +220,11 @@ public void onStart() { // Init association stores mAssociationStore.refreshCache(); + // Remove any revoked associations after reboot. + for (AssociationInfo ai : mAssociationStore.getRevokedAssociations()) { + mDisassociationProcessor.disassociate(ai.getId(), REASON_REVOKED); + } + // Init UUID store mObservableUuidStore.getObservableUuidsForUser(getContext().getUserId()); From e1a82137d2eafa0cd5b3c65eccac32d0102d5f0e Mon Sep 17 00:00:00 2001 From: Jayachandran C Date: Thu, 23 Oct 2025 11:32:16 -0700 Subject: [PATCH 007/844] Block overriding satellite carrier config keys on user builds Add a blocklist to CarrierConfigLoader.overrideConfig to prevent certain sensitive carrier config keys from being overridden on user builds. The following keys are now blocklisted: KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL KEY_SATELLITE_DATA_SUPPORT_MODE_INT Attempting to override these keys on a user build will result in a SecurityException. This restriction does not affect userdebug or eng builds, where overriding these values for testing purposes is still allowed. Test: Added CarrierConfigLoaderTest#testOverrideConfig_blockedKeys to verify the new logic. Flag: EXEMPT BUGFIX Bug: 442272360 Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:9127724a48d3cf4386c2ea1f4369f4042b484bbe Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:ebdb85bd47db13c7d4893814c194ee3dbb0176a9 Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:14d4b99129806b97340fd1b6b3db103cef4d5152 Merged-In: I8bc6f72854ce664b70b852f49c4136cbba31d5e5 Change-Id: I8bc6f72854ce664b70b852f49c4136cbba31d5e5 --- .../android/telephony/TelephonyManager.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index fe8796270ac25..b8087c3b0213c 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -18220,6 +18220,23 @@ public void clearSignalStrengthUpdateRequest(@NonNull SignalStrengthUpdateReques } } + /** + * Get the modem service name. + * @return the service name of the modem service which bind to. + * @hide + */ + public String getModemService() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.getModemService(); + } + } catch (RemoteException ex) { + Rlog.e(TAG, "getModemService RemoteException", ex); + } + return null; + } + /** * The unattended reboot was prepared successfully. * @hide From b112ffd8dff471d8ff09520da9932e2ed0776c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Hern=C3=A1ndez?= Date: Wed, 20 Aug 2025 15:57:28 +0200 Subject: [PATCH 008/844] Limit the number of services (NLSes, etc) that can be approved per user Trying to activate additional packages/components will be silently rejected. Bug: 428701593 Test: atest ManagedServicesTest NotificationManagerServiceTest Flag: com.android.server.notification.limit_managed_services_count (cherry picked from commit a132684a093d9e1750100b39d4e4168f2d27d349) Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:182548fd95b0f245385e5dc45efd2cbd4cd35b57 Merged-In: Iddd8044997c41f97369b768f4da5e49efc43ad06 Change-Id: Iddd8044997c41f97369b768f4da5e49efc43ad06 --- .../com/android/server/notification/ManagedServices.java | 8 +++----- .../server/notification/NotificationManagerService.java | 6 +++--- .../android/server/notification/ManagedServicesTest.java | 2 -- .../notification/NotificationManagerServiceTest.java | 1 - 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/services/core/java/com/android/server/notification/ManagedServices.java b/services/core/java/com/android/server/notification/ManagedServices.java index 54cf810fc0397..1dd298cb67b33 100644 --- a/services/core/java/com/android/server/notification/ManagedServices.java +++ b/services/core/java/com/android/server/notification/ManagedServices.java @@ -978,8 +978,7 @@ protected boolean setPackageOrComponentEnabled(String pkgOrComponent, int userId if (approvedItem != null) { int uid = getUidForPackageOrComponent(pkgOrComponent, userId); if (enabled) { - if (!Flags.limitManagedServicesCount() - || approved.size() < MAX_SERVICE_ENTRIES) { + if (approved.size() < MAX_SERVICE_ENTRIES) { approved.add(approvedItem); if (uid != Process.INVALID_UID) { approvedUids.add(uid); @@ -1006,8 +1005,7 @@ protected boolean setPackageOrComponentEnabled(String pkgOrComponent, int userId mUserSetServices.put(userId, userSetServices); } if (userSet) { - if (!Flags.limitManagedServicesCount() - || userSetServices.size() < MAX_SERVICE_ENTRIES) { + if (userSetServices.size() < MAX_SERVICE_ENTRIES) { userSetServices.add(pkgOrComponent); } } else { @@ -1016,7 +1014,7 @@ protected boolean setPackageOrComponentEnabled(String pkgOrComponent, int userId } } - if (!Flags.limitManagedServicesCount() || changed) { + if (changed) { rebindServices(false, userId); } diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 1b2042fc8532c..11ea74dae665b 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -7006,7 +7006,7 @@ public void setNotificationPolicyAccessGrantedForUser( pkg, userId, mConditionProviders.getRequiredPermission())) { boolean changed = mConditionProviders.setPackageOrComponentEnabled(pkg, userId, /* isPrimary= */ true, granted); - if (Flags.limitManagedServicesCount() && !changed) { + if (!changed) { return; } @@ -7276,7 +7276,7 @@ public void setNotificationListenerAccessGrantedForUser(ComponentName listener, boolean changed = mListeners.setPackageOrComponentEnabled( listener.flattenToString(), userId, /* isPrimary= */ true, granted, userSet); - if (Flags.limitManagedServicesCount() && !changed) { + if (!changed) { return; } @@ -13809,7 +13809,7 @@ protected boolean setPackageOrComponentEnabled(String pkgOrComponent, int userId boolean isPrimary, boolean enabled, boolean userSet) { boolean changed = super.setPackageOrComponentEnabled(pkgOrComponent, userId, isPrimary, enabled, userSet); - if (Flags.limitManagedServicesCount() && !changed) { + if (!changed) { return false; } diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java index 97f9f9ceb4aff..0de1d377bd09a 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java @@ -2586,7 +2586,6 @@ public void isUidAllowed_multipleApprovedUids_returnsTrueForBoth() { } @Test - @EnableFlags(Flags.FLAG_LIMIT_MANAGED_SERVICES_COUNT) public void setPackageOrComponentEnabled_tooManyPackages_stopsAdding() { ManagedServices service = new TestManagedServices(getContext(), mLock, mUserProfiles, mIpm, APPROVAL_BY_PACKAGE); @@ -2614,7 +2613,6 @@ public void setPackageOrComponentEnabled_tooManyPackages_stopsAdding() { } @Test - @EnableFlags(Flags.FLAG_LIMIT_MANAGED_SERVICES_COUNT) public void setPackageOrComponentEnabled_tooManyChanges_stopsAddingToUserSet() { ManagedServices service = new TestManagedServices(getContext(), mLock, mUserProfiles, mIpm, APPROVAL_BY_PACKAGE); diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index 7be8cba2d23bf..f96fd66caca6d 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -6478,7 +6478,6 @@ public void testSetListenerAccessForUser_revokeWithNameTooLong_okay() throws Exc } @Test - @EnableFlags(Flags.FLAG_LIMIT_MANAGED_SERVICES_COUNT) public void testSetListenerAccessForUser_tooManyListeners_skipsFollowups() throws Exception { UserHandle user = UserHandle.of(mContext.getUserId() + 10); ComponentName c = ComponentName.unflattenFromString("package/Component"); From 0fc31d3e302917f77f23dc7004efb8a5a286301b Mon Sep 17 00:00:00 2001 From: Song Chun Fan Date: Tue, 11 Nov 2025 00:03:48 +0000 Subject: [PATCH 009/844] [UidMigration] fix update uninstallation with sharedUserMaxSdkVersion When a system app is re-enabled after the update is uninstalled, when the system app has shared uid, the current code doesn't support directly reusing the disabled package setting. Instead, the preloaded version is re-scanned and installed as a new app, which can bring breaking behavior of changed UIDs when the manifest has sharedUserMaxSdkVersion. This change fixes the bug where registerExistingAppId fails when it comes to shared uid, therefore directly reuses the disabled package setting, consistent with the behavior for non-shared-uid system apps. FLAG: EXEMPT BUGFIX Test: manually with system-app-test.sh BUG: 454062218 (cherry picked from commit 6b5ea2f7fbf50313d46e54e0d8f8c18c398e4869) Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:4b32b0bd6876ecc25d60d95431763bf618699880 Merged-In: I417cec27697a210416027e862a5e5d207d268b82 Change-Id: I417cec27697a210416027e862a5e5d207d268b82 --- .../core/java/com/android/server/pm/Settings.java | 14 +++++++++----- .../src/com/android/server/pm/MockSystem.kt | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java index d4bc94593c38e..479d62c96965f 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -945,8 +945,8 @@ PackageSetting enableSystemPackageLPw(String name) { p.getPkgState().setUpdatedSystemApp(false); final AndroidPackageInternal pkg = p.getPkg(); PackageSetting ret = addPackageLPw(name, p.getRealName(), p.getPath(), p.getAppId(), - p.getFlags(), p.getPrivateFlags(), mDomainVerificationManager.generateNewId(), - pkg == null ? false : pkg.isSdkLibrary()); + p.getFlags(), p.getPrivateFlags(), mDomainVerificationManager.generateNewId(), + pkg == null ? false : pkg.isSdkLibrary(), p.hasSharedUser()); if (ret != null) { ret.setLegacyNativeLibraryPath(p.getLegacyNativeLibraryPath()); ret.setPrimaryCpuAbi(p.getPrimaryCpuAbiLegacy()); @@ -966,6 +966,7 @@ PackageSetting enableSystemPackageLPw(String name) { ret.setRestrictUpdateHash(p.getRestrictUpdateHash()); ret.setScannedAsStoppedSystemApp(p.isScannedAsStoppedSystemApp()); ret.setInstallSource(p.getInstallSource()); + ret.setSharedUserAppId(p.getSharedUserAppId()); } mDisabledSysPackages.remove(name); return ret; @@ -987,7 +988,8 @@ void removeDisabledSystemPackageLPw(String name) { } PackageSetting addPackageLPw(String name, String realName, File codePath, int uid, - int pkgFlags, int pkgPrivateFlags, @NonNull UUID domainSetId, boolean isSdkLibrary) { + int pkgFlags, int pkgPrivateFlags, @NonNull UUID domainSetId, boolean isSdkLibrary, + boolean hasSharedUser) { PackageSetting p = mPackages.get(name); if (p != null) { if (p.getAppId() == uid) { @@ -1000,7 +1002,8 @@ PackageSetting addPackageLPw(String name, String realName, File codePath, int ui p = new PackageSetting(name, realName, codePath, pkgFlags, pkgPrivateFlags, domainSetId) .setAppId(uid); if ((uid == Process.INVALID_UID && isSdkLibrary && Flags.disallowSdkLibsToBeApps()) - || mAppIds.registerExistingAppId(uid, p, name)) { + || mAppIds.registerExistingAppId(uid, p, name) + || hasSharedUser) { mPackages.put(name, p); return p; } @@ -4332,7 +4335,8 @@ private void readPackageLPw(TypedXmlPullParser parser, ArrayList read } else if (appId > 0 || (appId == Process.INVALID_UID && isSdkLibrary && Flags.disallowSdkLibsToBeApps())) { packageSetting = addPackageLPw(name.intern(), realName, new File(codePathStr), - appId, pkgFlags, pkgPrivateFlags, domainSetId, isSdkLibrary); + appId, pkgFlags, pkgPrivateFlags, domainSetId, isSdkLibrary, + /* hasSharedUser= */ false); if (PackageManagerService.DEBUG_SETTINGS) Log.i(PackageManagerService.TAG, "Reading package " + name + ": appId=" + appId + " pkg=" + packageSetting); diff --git a/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt b/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt index 520ab62374ca2..554ae0f48e2a8 100644 --- a/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt +++ b/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt @@ -171,7 +171,7 @@ class MockSystem(withSession: (StaticMockitoSessionBuilder) -> Unit = {}) { null } whenever(mocks.settings.addPackageLPw(nullable(), nullable(), nullable(), nullable(), - nullable(), nullable(), nullable(), nullable())) { + nullable(), nullable(), nullable(), nullable(), nullable())) { val name: String = getArgument(0) val pendingAdd = mPendingPackageAdds.firstOrNull { it.first == name } ?: return@whenever null From 7ef86e61cb9391c280c223f05ef1cee6e79c7e4e Mon Sep 17 00:00:00 2001 From: Pranav Vashi Date: Thu, 7 Sep 2023 21:42:22 +0530 Subject: [PATCH 010/844] base: Add stub files Signed-off-by: Pranav Vashi --- core/res/res/values/cr_arrays.xml | 8 ++++++++ core/res/res/values/cr_attrs.xml | 12 ++++++++++++ core/res/res/values/cr_colors.xml | 8 ++++++++ core/res/res/values/cr_config.xml | 8 ++++++++ core/res/res/values/cr_dimens.xml | 8 ++++++++ core/res/res/values/cr_strings.xml | 8 ++++++++ core/res/res/values/cr_styles.xml | 8 ++++++++ core/res/res/values/cr_symbols.xml | 8 ++++++++ packages/SystemUI/res/values-night/cr_colors.xml | 8 ++++++++ packages/SystemUI/res/values/cr_arrays.xml | 8 ++++++++ packages/SystemUI/res/values/cr_attrs.xml | 8 ++++++++ packages/SystemUI/res/values/cr_colors.xml | 8 ++++++++ packages/SystemUI/res/values/cr_config.xml | 8 ++++++++ packages/SystemUI/res/values/cr_dimens.xml | 8 ++++++++ packages/SystemUI/res/values/cr_strings.xml | 8 ++++++++ packages/SystemUI/res/values/cr_styles.xml | 8 ++++++++ packages/SystemUI/res/values/cr_symbols.xml | 8 ++++++++ 17 files changed, 140 insertions(+) create mode 100644 core/res/res/values/cr_arrays.xml create mode 100644 core/res/res/values/cr_attrs.xml create mode 100644 core/res/res/values/cr_colors.xml create mode 100644 core/res/res/values/cr_config.xml create mode 100644 core/res/res/values/cr_dimens.xml create mode 100644 core/res/res/values/cr_strings.xml create mode 100644 core/res/res/values/cr_styles.xml create mode 100644 core/res/res/values/cr_symbols.xml create mode 100644 packages/SystemUI/res/values-night/cr_colors.xml create mode 100644 packages/SystemUI/res/values/cr_arrays.xml create mode 100644 packages/SystemUI/res/values/cr_attrs.xml create mode 100644 packages/SystemUI/res/values/cr_colors.xml create mode 100644 packages/SystemUI/res/values/cr_config.xml create mode 100644 packages/SystemUI/res/values/cr_dimens.xml create mode 100644 packages/SystemUI/res/values/cr_strings.xml create mode 100644 packages/SystemUI/res/values/cr_styles.xml create mode 100644 packages/SystemUI/res/values/cr_symbols.xml diff --git a/core/res/res/values/cr_arrays.xml b/core/res/res/values/cr_arrays.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/core/res/res/values/cr_arrays.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/core/res/res/values/cr_attrs.xml b/core/res/res/values/cr_attrs.xml new file mode 100644 index 0000000000000..359efbead321f --- /dev/null +++ b/core/res/res/values/cr_attrs.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/core/res/res/values/cr_colors.xml b/core/res/res/values/cr_colors.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/core/res/res/values/cr_colors.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/core/res/res/values/cr_config.xml b/core/res/res/values/cr_config.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/core/res/res/values/cr_config.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/core/res/res/values/cr_dimens.xml b/core/res/res/values/cr_dimens.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/core/res/res/values/cr_dimens.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/core/res/res/values/cr_strings.xml b/core/res/res/values/cr_strings.xml new file mode 100644 index 0000000000000..f64316a150bb9 --- /dev/null +++ b/core/res/res/values/cr_strings.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/core/res/res/values/cr_styles.xml b/core/res/res/values/cr_styles.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/core/res/res/values/cr_styles.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/core/res/res/values/cr_symbols.xml b/core/res/res/values/cr_symbols.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/core/res/res/values/cr_symbols.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/packages/SystemUI/res/values-night/cr_colors.xml b/packages/SystemUI/res/values-night/cr_colors.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/packages/SystemUI/res/values-night/cr_colors.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/packages/SystemUI/res/values/cr_arrays.xml b/packages/SystemUI/res/values/cr_arrays.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/packages/SystemUI/res/values/cr_arrays.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/packages/SystemUI/res/values/cr_attrs.xml b/packages/SystemUI/res/values/cr_attrs.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/packages/SystemUI/res/values/cr_attrs.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/packages/SystemUI/res/values/cr_colors.xml b/packages/SystemUI/res/values/cr_colors.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/packages/SystemUI/res/values/cr_colors.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/packages/SystemUI/res/values/cr_config.xml b/packages/SystemUI/res/values/cr_config.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/packages/SystemUI/res/values/cr_config.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/packages/SystemUI/res/values/cr_dimens.xml b/packages/SystemUI/res/values/cr_dimens.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/packages/SystemUI/res/values/cr_dimens.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/packages/SystemUI/res/values/cr_strings.xml b/packages/SystemUI/res/values/cr_strings.xml new file mode 100644 index 0000000000000..f64316a150bb9 --- /dev/null +++ b/packages/SystemUI/res/values/cr_strings.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/packages/SystemUI/res/values/cr_styles.xml b/packages/SystemUI/res/values/cr_styles.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/packages/SystemUI/res/values/cr_styles.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/packages/SystemUI/res/values/cr_symbols.xml b/packages/SystemUI/res/values/cr_symbols.xml new file mode 100644 index 0000000000000..ae31375594fee --- /dev/null +++ b/packages/SystemUI/res/values/cr_symbols.xml @@ -0,0 +1,8 @@ + + + + + From 4ca7a5160da9c764c8721e3487f4d9b036341116 Mon Sep 17 00:00:00 2001 From: Bruno Martins Date: Mon, 17 Sep 2018 11:52:04 +0100 Subject: [PATCH 011/844] fw/b: Add support for runtime toggle of navbar Co-authored-by: Adnan Begovic Co-authored-by: jhenrique09 Co-authored-by: LuK1337 Co-authored-by: Paul Keith Co-authored-by: Timo Wendt Change-Id: I4a6d3f89bc171c3921875b24c077cb78c03517ad Signed-off-by: Pranav Vashi --- .../server/power/PowerManagerService.java | 27 +++++++++---- .../com/android/server/wm/DisplayPolicy.java | 38 ++++++++++++++++++- 2 files changed, 56 insertions(+), 9 deletions(-) diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index ff600c7d0a2b1..25dca815a9fdd 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -1250,6 +1250,8 @@ interface PowerPropertiesWrapper { private static native boolean nativeSetPowerMode(int mode, boolean enabled); private static native boolean nativeForceSuspend(); + private boolean mForceNavbar; + // Whether proximity check on wake is enabled by default private boolean mProximityWakeEnabledByDefaultConfig; @@ -1621,6 +1623,9 @@ private void systemReady() { resolver.registerContentObserver(LineageSettings.Secure.getUriFor( LineageSettings.Secure.KEYBOARD_BRIGHTNESS), false, mSettingsObserver, UserHandle.USER_ALL); + resolver.registerContentObserver(LineageSettings.System.getUriFor( + LineageSettings.System.FORCE_SHOW_NAVBAR), + false, mSettingsObserver, UserHandle.USER_ALL); // Register for broadcasts from other components of the system. IntentFilter filter = new IntentFilter(); @@ -1768,6 +1773,10 @@ private void updateSettingsLocked() { LineageSettings.Secure.KEYBOARD_BRIGHTNESS, mKeyboardBrightnessDefault, UserHandle.USER_CURRENT); + mForceNavbar = LineageSettings.System.getIntForUser(resolver, + LineageSettings.System.FORCE_SHOW_NAVBAR, + 0, UserHandle.USER_CURRENT) == 1; + mDirty |= DIRTY_SETTINGS; } @@ -3314,15 +3323,17 @@ private void updateUserActivitySummaryLocked(long now, int dirty) { if (wakefulness == WAKEFULNESS_AWAKE) { if (mButtonsLight != null) { float buttonBrightness = BRIGHTNESS_OFF_FLOAT; - if (isValidBrightness( - mButtonBrightnessOverrideFromWindowManager)) { - if (mButtonBrightnessOverrideFromWindowManager > - PowerManager.BRIGHTNESS_MIN) { - buttonBrightness = - mButtonBrightnessOverrideFromWindowManager; + if (!mForceNavbar) { + if (isValidBrightness( + mButtonBrightnessOverrideFromWindowManager)) { + if (mButtonBrightnessOverrideFromWindowManager > + PowerManager.BRIGHTNESS_MIN) { + buttonBrightness = + mButtonBrightnessOverrideFromWindowManager; + } + } else if (isValidButtonBrightness(mButtonBrightness)) { + buttonBrightness = mButtonBrightness; } - } else if (isValidButtonBrightness(mButtonBrightness)) { - buttonBrightness = mButtonBrightness; } if (!mButtonLightOnKeypressOnly) { diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index b05de11ffc613..66f47d7b46be1 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -85,10 +85,12 @@ import android.app.LoadedApk; import android.app.ResourcesManager; import android.app.WindowConfiguration; +import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.content.res.Resources; +import android.database.ContentObserver; import android.graphics.Insets; import android.graphics.PixelFormat; import android.graphics.Rect; @@ -149,6 +151,8 @@ import com.android.server.wallpaper.WallpaperManagerInternal; import com.android.wm.shell.Flags; +import lineageos.providers.LineageSettings; + import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; @@ -252,6 +256,7 @@ UiModeManagerInternal getUiModeManagerInternal() { private volatile boolean mHasStatusBar; private volatile boolean mHasNavigationBar; + private volatile boolean mForceNavbar; // Can the navigation bar ever move to the side? private volatile boolean mNavigationBarCanMove; private volatile boolean mNavigationBarAlwaysShowOnSideGesture; @@ -395,6 +400,8 @@ UiModeManagerInternal getUiModeManagerInternal() { private RefreshRatePolicy mRefreshRatePolicy; + private SettingsObserver mSettingsObserver; + /** * If true, attach the navigation bar to the current transition app. * The value is read from config_attachNavBarToAppDuringTransition and could be overlaid by RRO @@ -432,6 +439,24 @@ public void handleMessage(Message msg) { } } + private class SettingsObserver extends ContentObserver { + public SettingsObserver(Handler handler) { + super(handler); + + ContentResolver resolver = mContext.getContentResolver(); + resolver.registerContentObserver(LineageSettings.System.getUriFor( + LineageSettings.System.FORCE_SHOW_NAVBAR), false, this, + UserHandle.USER_ALL); + + updateSettings(); + } + + @Override + public void onChange(boolean selfChange) { + updateSettings(); + } + } + DisplayPolicy(WindowManagerService service, DisplayContent displayContent) { mService = service; mContext = displayContent.isDefaultDisplay ? service.mContext @@ -686,6 +711,9 @@ public void onAppTransitionFinishedLocked(IBinder token) { } else if ("0".equals(navBarOverride)) { mHasNavigationBar = true; } + + // Register content observer only for main display + mSettingsObserver = new SettingsObserver(mHandler); } else { mHasStatusBar = false; mHasNavigationBar = mDisplayContent.isSystemDecorationsSupported(); @@ -732,6 +760,14 @@ void systemReady() { } } + public void updateSettings() { + ContentResolver resolver = mContext.getContentResolver(); + + mForceNavbar = LineageSettings.System.getIntForUser(resolver, + LineageSettings.System.FORCE_SHOW_NAVBAR, 0, + UserHandle.USER_CURRENT) == 1; + } + private int getDisplayId() { return mDisplayContent.getDisplayId(); } @@ -780,7 +816,7 @@ public int getDockMode() { } public boolean hasNavigationBar() { - return mHasNavigationBar; + return mHasNavigationBar || mForceNavbar; } void updateHasNavigationBarIfNeeded() { From b953f33c77c602c7d4866fe5ee7e74d8536d9ef6 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Thu, 28 Dec 2017 21:55:45 +0100 Subject: [PATCH 012/844] Allow screen unpinning on devices without navbar Change-Id: Iedfc08f4d95bbee3c8578c0d2450b90739e63603 Screen Pinning: Show correct text for on screen nav. Similar to I09c2ef661bff272cb4f7ca43bac0e45f4b20a4d4, we're not getting an instance of PhoneWindowManager which we can rely on to update dynamically. TICKET: OPO-393 Change-Id: Iacf8221066461fb6940dd88432e665812545c3ff Signed-off-by: Pranav Vashi --- packages/SystemUI/res/values/cm_strings.xml | 6 ++++++ .../navigationbar/ScreenPinningNotify.java | 16 +++++++++++++++- .../recents/ScreenPinningRequest.java | 16 ++++++++++------ .../server/policy/PhoneWindowManager.java | 19 ++++++++++++++++++- 4 files changed, 49 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/res/values/cm_strings.xml b/packages/SystemUI/res/values/cm_strings.xml index f918477d575bc..381dc02c91103 100644 --- a/packages/SystemUI/res/values/cm_strings.xml +++ b/packages/SystemUI/res/values/cm_strings.xml @@ -129,4 +129,10 @@ Remove the 3 second wait HEVC encoding Use the more efficient HEVC encoder + + + This keeps it in view until you unpin. Touch & hold Back to unpin. + + + To unpin this screen, touch & hold Back button diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/ScreenPinningNotify.java b/packages/SystemUI/src/com/android/systemui/navigationbar/ScreenPinningNotify.java index 1e40dd9945d28..06994346210fd 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/ScreenPinningNotify.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/ScreenPinningNotify.java @@ -17,8 +17,10 @@ package com.android.systemui.navigationbar; import android.content.Context; +import android.os.RemoteException; import android.os.SystemClock; import android.util.Slog; +import android.view.WindowManagerGlobal; import android.widget.Toast; import com.android.systemui.SysUIToast; @@ -60,7 +62,9 @@ public void showEscapeToast(boolean isGestureNavEnabled, boolean isRecentsButton if (mLastToast != null) { mLastToast.cancel(); } - mLastToast = makeAllUserToastAndShow(isGestureNavEnabled + mLastToast = makeAllUserToastAndShow(!hasSoftNavigationBar() + ? R.string.screen_pinning_toast_no_navbar + : isGestureNavEnabled ? R.string.screen_pinning_toast_gesture_nav : isRecentsButtonVisible ? R.string.screen_pinning_toast @@ -73,4 +77,14 @@ private Toast makeAllUserToastAndShow(int resId) { toast.show(); return toast; } + + private boolean hasSoftNavigationBar() { + try { + return WindowManagerGlobal.getWindowManagerService() + .hasNavigationBar(mContext.getDisplayId()); + } catch (RemoteException e) { + Slog.e(TAG, "Failed to check soft navigation bar", e); + return false; + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java index a1281ec23f92b..d83ccfc16f206 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java +++ b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java @@ -302,16 +302,20 @@ && hasSoftNavigationBar(mContext.getDisplayId()) && !isLargeScreen(mContext)) { mLayout.findViewById(R.id.screen_pinning_recents_group).setVisibility(VISIBLE); mLayout.findViewById(R.id.screen_pinning_home_bg_light).setVisibility(INVISIBLE); mLayout.findViewById(R.id.screen_pinning_home_bg).setVisibility(INVISIBLE); - descriptionStringResId = touchExplorationEnabled - ? R.string.screen_pinning_description_accessible - : R.string.screen_pinning_description; + descriptionStringResId = !hasSoftNavigationBar(displayId) + ? R.string.screen_pinning_description_no_navbar + : touchExplorationEnabled + ? R.string.screen_pinning_description_accessible + : R.string.screen_pinning_description; } else { mLayout.findViewById(R.id.screen_pinning_recents_group).setVisibility(INVISIBLE); mLayout.findViewById(R.id.screen_pinning_home_bg_light).setVisibility(VISIBLE); mLayout.findViewById(R.id.screen_pinning_home_bg).setVisibility(VISIBLE); - descriptionStringResId = touchExplorationEnabled - ? R.string.screen_pinning_description_recents_invisible_accessible - : R.string.screen_pinning_description_recents_invisible; + descriptionStringResId = !hasSoftNavigationBar(displayId) + ? R.string.screen_pinning_description_no_navbar + : touchExplorationEnabled + ? R.string.screen_pinning_description_recents_invisible_accessible + : R.string.screen_pinning_description_recents_invisible; } NavigationBarView navigationBarView = diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 6ecbf2b3942bd..57c45002f8ce7 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -1720,7 +1720,10 @@ private void powerVeryLongPress() { } private void backLongPress() { - if (hasLongPressOnBackBehavior()) { + if (unpinActivity()) { + mBackKeyHandled = true; + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, "Back - Long Press"); + } else if (hasLongPressOnBackBehavior()) { mBackKeyHandled = true; long now = SystemClock.uptimeMillis(); @@ -4317,6 +4320,20 @@ private boolean dispatchKeyToKeyHandlers(KeyEvent event) { return false; } + private boolean unpinActivity() { + if (!hasNavigationBar()) { + try { + if (ActivityTaskManager.getService().isInLockTaskMode()) { + ActivityTaskManager.getService().stopSystemLockTaskMode(); + return true; + } + } catch (RemoteException e) { + // ignore + } + } + return false; + } + // TODO(b/117479243): handle it in InputPolicy /** {@inheritDoc} */ @Override From ad8bce70a24853a5dc653e5d26647a1d266463b1 Mon Sep 17 00:00:00 2001 From: Luca Stefani Date: Thu, 22 May 2025 17:13:25 +0200 Subject: [PATCH 013/844] fixup! Firewall: Transport-based toggle support (1/3) Strip unwanted policies when updating background restriction rules and fix one strict equality with a bit check. Change-Id: I51628940f64fe98c930168dc0fe2e487f63ccfde Signed-off-by: Pranav Vashi --- .../server/net/NetworkPolicyManagerService.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java index d81103ca52d5e..5e4f941864839 100644 --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java @@ -3461,10 +3461,10 @@ private void setUidPolicyUncheckedUL(int uid, int oldPolicy, int policy, boolean if (!isUidValidForAllowlistRulesUL(uid)) { notifyApp = false; } else { - final boolean wasDenied = oldPolicy == POLICY_REJECT_METERED_BACKGROUND; - final boolean isDenied = policy == POLICY_REJECT_METERED_BACKGROUND; - final boolean wasAllowed = oldPolicy == POLICY_ALLOW_METERED_BACKGROUND; - final boolean isAllowed = policy == POLICY_ALLOW_METERED_BACKGROUND; + final boolean wasDenied = (oldPolicy & POLICY_REJECT_METERED_BACKGROUND) != 0; + final boolean isDenied = (policy & POLICY_REJECT_METERED_BACKGROUND) != 0; + final boolean wasAllowed = (oldPolicy & POLICY_ALLOW_METERED_BACKGROUND) != 0; + final boolean isAllowed = (policy & POLICY_ALLOW_METERED_BACKGROUND) != 0; final boolean wasBlocked = wasDenied || (mRestrictBackground && !wasAllowed); final boolean isBlocked = isDenied || (mRestrictBackground && !isAllowed); if ((wasAllowed && (!isAllowed || isDenied)) @@ -3874,7 +3874,7 @@ private int getRestrictBackgroundStatusInternal(int uid) { } finally { Binder.restoreCallingIdentity(token); } - if (policy == POLICY_REJECT_METERED_BACKGROUND) { + if ((policy & POLICY_REJECT_METERED_BACKGROUND) != 0) { // App is restricted. return RESTRICT_BACKGROUND_STATUS_ENABLED; } From 55346f065addb2d9976f6d78d85fe1f325ce0409 Mon Sep 17 00:00:00 2001 From: Pranav Vashi Date: Mon, 9 Mar 2026 20:24:51 +0530 Subject: [PATCH 014/844] Revert "LineageStatusBarItemHolder: Implement receivers removal methods" This reverts commit a9589527dd926c7fadece0135d58306ab57e99f0. --- .../statusbar/LineageStatusBarItemHolder.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LineageStatusBarItemHolder.java b/packages/SystemUI/src/com/android/systemui/statusbar/LineageStatusBarItemHolder.java index c2053fa573612..ba8b14c8ecd82 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/LineageStatusBarItemHolder.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/LineageStatusBarItemHolder.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2018-2026 The LineageOS project + * Copyright (C) 2018 The LineageOS project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -145,13 +145,4 @@ public void addVisibilityReceiver(LineageStatusBarItem.VisibilityReceiver visibi mVisibilityReceivers.add(visibilityReceiver); visibilityReceiver.onVisibilityChanged(mItemHolderIsVisible); } - - public void removeDarkReceiver(LineageStatusBarItem.DarkReceiver darkReceiver) { - mDarkReceivers.remove(darkReceiver); - } - - public void removeVisibilityReceiver( - LineageStatusBarItem.VisibilityReceiver visibilityReceiver) { - mVisibilityReceivers.remove(visibilityReceiver); - } } From 75080d9dd7ee371548212e5c71d89d0bf89a1f1c Mon Sep 17 00:00:00 2001 From: Pranav Vashi Date: Thu, 19 Feb 2026 10:11:48 +0530 Subject: [PATCH 015/844] Revert "SystemUI: Network Traffic" This reverts commit a0758a4d29891d4384989a830846f6d137703e06. --- packages/SystemUI/LineageManifest.xml | 5 +- packages/SystemUI/res/layout/status_bar.xml | 51 ------------------- .../phone/PhoneStatusBarTransitions.java | 15 ------ .../ui/binder/HomeStatusBarViewBinder.kt | 10 ---- 4 files changed, 1 insertion(+), 80 deletions(-) diff --git a/packages/SystemUI/LineageManifest.xml b/packages/SystemUI/LineageManifest.xml index 7b1b48de3fb0c..52bd7d2f6165c 100644 --- a/packages/SystemUI/LineageManifest.xml +++ b/packages/SystemUI/LineageManifest.xml @@ -1,7 +1,7 @@ - - diff --git a/packages/SystemUI/res/layout/status_bar.xml b/packages/SystemUI/res/layout/status_bar.xml index 63c344cbfbd70..8d895c9b9fbd3 100644 --- a/packages/SystemUI/res/layout/status_bar.xml +++ b/packages/SystemUI/res/layout/status_bar.xml @@ -118,23 +118,6 @@ android:orientation="horizontal" android:clipChildren="false"/> - - - - - - @@ -169,23 +152,6 @@ android:gravity="center_vertical|end" android:clipChildren="false"> - - - - - - - - - - - - - diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarTransitions.java index 7fc61dbfcf118..6676a7f7cdf8f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarTransitions.java @@ -25,8 +25,6 @@ import com.android.systemui.res.R; import com.android.systemui.shared.statusbar.phone.BarTransitions; -import org.lineageos.internal.statusbar.NetworkTraffic; - public final class PhoneStatusBarTransitions extends BarTransitions { private static final float ICON_ALPHA_WHEN_NOT_OPAQUE = 1; private static final float ICON_ALPHA_WHEN_LIGHTS_OUT_BATTERY_CLOCK = 0.5f; @@ -37,7 +35,6 @@ public final class PhoneStatusBarTransitions extends BarTransitions { private boolean mIsHeadsUp; private View mStartSide, mStatusIcons, mBattery; - private NetworkTraffic mNetworkTrafficStart, mNetworkTrafficCenter, mNetworkTrafficEnd; private Animator mCurrentAnimation; /** @@ -49,13 +46,7 @@ public PhoneStatusBarTransitions(PhoneStatusBarView statusBarView, View backgrou mIconAlphaWhenOpaque = res.getFraction(R.dimen.status_bar_icon_drawing_alpha, 1, 1); mStartSide = statusBarView.findViewById(R.id.status_bar_start_side_except_heads_up); mStatusIcons = statusBarView.findViewById(R.id.statusIcons); - mNetworkTrafficStart = statusBarView.findViewById(R.id.network_traffic_start); - mNetworkTrafficCenter = statusBarView.findViewById(R.id.network_traffic_center); - mNetworkTrafficEnd = statusBarView.findViewById(R.id.network_traffic_end); mBattery = statusBarView.findViewById(R.id.battery); - mNetworkTrafficStart.setViewPosition(0); /* start side display */ - mNetworkTrafficCenter.setViewPosition(1); /* center display */ - mNetworkTrafficEnd.setViewPosition(2); /* end side display */ applyModeBackground(-1, getMode(), false /*animate*/); applyMode(getMode(), false /*animate*/); } @@ -124,9 +115,6 @@ private void applyMode(int mode, boolean animate) { anims.playTogether( animateTransitionTo(mStartSide, newStartSideAlpha), animateTransitionTo(mStatusIcons, newStatusIconsAlpha), - animateTransitionTo(mNetworkTrafficStart, newStatusIconsAlpha), - animateTransitionTo(mNetworkTrafficCenter, newStatusIconsAlpha), - animateTransitionTo(mNetworkTrafficEnd, newStatusIconsAlpha), animateTransitionTo(mBattery, newBatteryAlpha) ); if (isLightsOut(mode)) { @@ -137,9 +125,6 @@ private void applyMode(int mode, boolean animate) { } else { mStartSide.setAlpha(newStartSideAlpha); mStatusIcons.setAlpha(newStatusIconsAlpha); - mNetworkTrafficStart.setAlpha(newStatusIconsAlpha); - mNetworkTrafficCenter.setAlpha(newStatusIconsAlpha); - mNetworkTrafficEnd.setAlpha(newStatusIconsAlpha); mBattery.setAlpha(newBatteryAlpha); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/HomeStatusBarViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/HomeStatusBarViewBinder.kt index 5b305b712cee8..1ca814b4fa6da 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/HomeStatusBarViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/HomeStatusBarViewBinder.kt @@ -124,8 +124,6 @@ constructor( val leftClock: Clock = view.requireViewById(R.id.clock) val centerClock: Clock = view.findViewById(R.id.clock_center) val rightClock: Clock = view.findViewById(R.id.clock_right) - val networkTrafficCenterView = view.findViewById(R.id.network_traffic_holder_center) - val networkTrafficStartView = view.findViewById(R.id.network_traffic_holder_start) val notificationIconsArea = view.requireViewById(R.id.notificationIcons) // CollapsedStatusBarFragment doesn't need this @@ -486,19 +484,13 @@ constructor( // animating, then we can use the baseVis default animation if (animState.isAnimatingChip()) { // Just apply the visibility of the view, but don't animate - networkTrafficCenterView.visibility = baseVis.visibility - networkTrafficStartView.visibility = baseVis.visibility systemInfoView.visibility = baseVis.visibility // Now apply the animation state, with its animator when (animState) { AnimatingIn -> { - systemEventChipAnimateIn?.invoke(networkTrafficCenterView) - systemEventChipAnimateIn?.invoke(networkTrafficStartView) systemEventChipAnimateIn?.invoke(systemInfoView) } AnimatingOut -> { - systemEventChipAnimateOut?.invoke(networkTrafficCenterView) - systemEventChipAnimateOut?.invoke(networkTrafficStartView) systemEventChipAnimateOut?.invoke(systemInfoView) } else -> { @@ -506,8 +498,6 @@ constructor( } } } else { - networkTrafficCenterView.adjustVisibility(baseVis) - networkTrafficStartView.adjustVisibility(baseVis) systemInfoView.adjustVisibility(baseVis) } } From aed9c04a518119366f48a956561d63207afd3a4f Mon Sep 17 00:00:00 2001 From: Pranav Vashi Date: Thu, 19 Feb 2026 10:12:01 +0530 Subject: [PATCH 016/844] Revert "SystemUI: Add Lineage statusbar item holder" This reverts commit fab583eb9e6ff481a1a65529117ae42fe407df2f. --- .../statusbar/LineageStatusBarItemHolder.java | 148 ------------------ 1 file changed, 148 deletions(-) delete mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/LineageStatusBarItemHolder.java diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LineageStatusBarItemHolder.java b/packages/SystemUI/src/com/android/systemui/statusbar/LineageStatusBarItemHolder.java deleted file mode 100644 index ba8b14c8ecd82..0000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/LineageStatusBarItemHolder.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * Copyright (C) 2018 The LineageOS project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.systemui.statusbar; - -import android.content.Context; -import android.graphics.Rect; -import android.util.AttributeSet; -import android.view.View; -import android.widget.RelativeLayout; - -import com.android.systemui.Dependency; -import com.android.systemui.plugins.DarkIconDispatcher; -import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; -import com.android.systemui.res.R; - -import org.lineageos.internal.statusbar.LineageStatusBarItem; - -import java.util.ArrayList; - -public class LineageStatusBarItemHolder extends RelativeLayout - implements LineageStatusBarItem.Manager { - private static final String TAG = "LineageStatusBarItemHolder"; - - private ArrayList mDarkReceivers = - new ArrayList(); - private ArrayList mVisibilityReceivers = - new ArrayList(); - - private ArrayList mLastAreas; - private float mLastDarkIntensity; - private int mLastTint; - - private boolean mItemHolderIsVisible; - - private Context mContext; - - public LineageStatusBarItemHolder(Context context) { - this(context, null); - } - - public LineageStatusBarItemHolder(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public LineageStatusBarItemHolder(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - mContext = context; - mItemHolderIsVisible = false; - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - - setOnSystemUiVisibilityChangeListener(mSystemUiVisibilityChangeListener); - updateStatusBarVisibility(getSystemUiVisibility()); - - Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mDarkReceiver); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - setOnSystemUiVisibilityChangeListener(null); - Dependency.get(DarkIconDispatcher.class).removeDarkReceiver(mDarkReceiver); - } - - // Propagate systemui tint updates to registered receivers. - - private DarkReceiver mDarkReceiver = new DarkReceiver() { - @Override - public void onDarkChanged(ArrayList areas, float darkIntensity, int tint) { - mLastAreas = areas; - mLastDarkIntensity = darkIntensity; - mLastTint = tint; - for (LineageStatusBarItem.DarkReceiver r : mDarkReceivers) { - r.onDarkChanged(areas, darkIntensity, tint); - } - } - }; - - // Collect and propagate item holder visibility to - // registered receivers. - // - // We watch both our own view visibility and systemui visibility. - // Latest change in either direction wins (and has been observed - // thus far to always be correct). - - @Override - public void onVisibilityAggregated(boolean isVisible) { - super.onVisibilityAggregated(isVisible); - updateVisibilityReceivers(isVisible); - } - - private View.OnSystemUiVisibilityChangeListener mSystemUiVisibilityChangeListener = - new View.OnSystemUiVisibilityChangeListener() { - @Override - public void onSystemUiVisibilityChange(int visibility) { - updateStatusBarVisibility(visibility); - } - }; - - private void updateStatusBarVisibility(int visibility) { - final boolean isVisible = - (visibility & SYSTEM_UI_FLAG_FULLSCREEN) == 0 - || (visibility & SYSTEM_UI_FLAG_LOW_PROFILE) != 0; - updateVisibilityReceivers(isVisible); - } - - private void updateVisibilityReceivers(boolean isVisible) { - if (isVisible == mItemHolderIsVisible) { - return; - } - mItemHolderIsVisible = isVisible; - for (LineageStatusBarItem.VisibilityReceiver r : mVisibilityReceivers) { - r.onVisibilityChanged(mItemHolderIsVisible); - } - } - - // LineageStatusBarItem.Manager methods - - public void addDarkReceiver(LineageStatusBarItem.DarkReceiver darkReceiver) { - darkReceiver.setFillColors( - mContext.getColor(R.color.dark_mode_icon_color_dual_tone_fill), - mContext.getColor(R.color.light_mode_icon_color_dual_tone_fill)); - mDarkReceivers.add(darkReceiver); - darkReceiver.onDarkChanged(mLastAreas, mLastDarkIntensity, mLastTint); - } - - public void addVisibilityReceiver(LineageStatusBarItem.VisibilityReceiver visibilityReceiver) { - mVisibilityReceivers.add(visibilityReceiver); - visibilityReceiver.onVisibilityChanged(mItemHolderIsVisible); - } -} From f3e5d1a18f5dd879b72b397c15ded76c90ef8772 Mon Sep 17 00:00:00 2001 From: Pranav Vashi Date: Wed, 13 Jul 2022 21:05:54 +0530 Subject: [PATCH 017/844] SystemUI: Update black theme package overlay Signed-off-by: Pranav Vashi --- .../src/com/android/systemui/theme/ThemeOverlayApplier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java index fe928c381156c..9bfc193a508e3 100644 --- a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java +++ b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java @@ -68,7 +68,7 @@ public class ThemeOverlayApplier implements Dumpable { static final String SYSUI_PACKAGE = "com.android.systemui"; static final String OVERLAY_BLACK_THEME = - "org.lineageos.overlay.customization.blacktheme"; + "com.android.system.theme.black"; static final String OVERLAY_CATEGORY_DYNAMIC_COLOR = "android.theme.customization.dynamic_color"; From 29d69d78219cc0cee27b1f3046eb079388da638f Mon Sep 17 00:00:00 2001 From: Pranav Vashi Date: Wed, 7 Oct 2020 13:11:29 +0530 Subject: [PATCH 018/844] base: Export bodyFontFamily and bodyFontFamilyMedium symbols * So that they can be used in apps like launcher and settings. Signed-off-by: Pranav Vashi --- core/res/res/values/symbols.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 819b7cc28e5af..0da4e5964131f 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -4265,6 +4265,7 @@ + From 0bbed38ef0e82f24727796c83d116aced5bdf743 Mon Sep 17 00:00:00 2001 From: Pranav Vashi Date: Sun, 29 Dec 2019 19:31:38 +0530 Subject: [PATCH 019/844] Wire up default fonts with config Signed-off-by: Pranav Vashi --- core/res/res/layout/time_picker_material.xml | 2 +- core/res/res/values/config.xml | 4 ++-- .../res/values/donottranslate_material.xml | 24 +++++++++---------- core/res/res/values/styles.xml | 4 ++-- core/res/res/values/styles_material.xml | 16 ++++++------- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/core/res/res/layout/time_picker_material.xml b/core/res/res/layout/time_picker_material.xml index 75973798219ef..ee733f1f39e86 100644 --- a/core/res/res/layout/time_picker_material.xml +++ b/core/res/res/layout/time_picker_material.xml @@ -44,7 +44,7 @@ android:paddingTop="20dp" android:paddingBottom="20dp" android:includeFontPadding="false" - android:fontFamily="sans-serif-medium" + android:fontFamily="@string/config_bodyFontFamilyMedium" android:textSize="34sp" android:textColor="@color/white" android:text="@string/time_picker_header_text"/> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index fbe4c3280e492..40dec4659c271 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -5398,7 +5398,7 @@ 90 - + sans-serif @@ -5483,7 +5483,7 @@ true - @string/font_family_button_material + sans-serif-medium sans-serif diff --git a/core/res/res/values/donottranslate_material.xml b/core/res/res/values/donottranslate_material.xml index 9cf9f6cfa86df..24ae4d430a947 100644 --- a/core/res/res/values/donottranslate_material.xml +++ b/core/res/res/values/donottranslate_material.xml @@ -16,17 +16,17 @@ - sans-serif-light - sans-serif - sans-serif - sans-serif - sans-serif - sans-serif-medium - sans-serif - sans-serif - sans-serif-medium - sans-serif - sans-serif - sans-serif-medium + @string/config_lightFontFamily + @string/config_bodyFontFamily + @string/config_bodyFontFamily + @string/config_bodyFontFamily + @string/config_headlineFontFamily + @string/config_headlineFontFamilyMedium + @string/config_headlineFontFamily + @string/config_bodyFontFamily + @string/config_bodyFontFamilyMedium + @string/config_bodyFontFamily + @string/config_bodyFontFamily + @string/config_headlineFontFamilyMedium diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 7f720ade62f12..159289a209235 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -283,7 +283,7 @@ please see styles_device_defaults.xml. @@ -999,7 +999,7 @@ please see styles_device_defaults.xml. diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml index 4f714af08e2a0..9c32b1fd8a8e7 100644 --- a/core/res/res/values/styles_material.xml +++ b/core/res/res/values/styles_material.xml @@ -429,7 +429,7 @@ please see styles_device_defaults.xml. From 82c6986ebf490d8f46e6448988122a141832bcde Mon Sep 17 00:00:00 2001 From: Pranav Vashi Date: Sun, 5 Jun 2022 01:53:48 +0530 Subject: [PATCH 020/844] base: Use font configs instead hardcoded fonts Signed-off-by: Pranav Vashi Signed-off-by: AnierinB --- .../res/layout/accessibility_button_chooser_item.xml | 2 +- .../layout/accessibility_enable_service_warning.xml | 12 ++++++------ .../layout/accessibility_shortcut_chooser_item.xml | 4 ++-- core/res/res/layout/immersive_mode_cling.xml | 6 +++--- core/res/res/layout/input_method_switch_dialog.xml | 2 +- core/res/res/layout/input_method_switch_item.xml | 4 ++-- .../res/layout/input_method_switch_item_header.xml | 2 +- packages/SystemUI/res/layout/contaminant_dialog.xml | 4 ++-- .../SystemUI/res/layout/immersive_mode_cling.xml | 6 +++--- .../res/layout/shutdown_dialog_finder_active.xml | 6 +++--- packages/SystemUI/res/layout/smart_action_button.xml | 2 +- packages/SystemUI/res/layout/smart_reply_button.xml | 2 +- packages/SystemUI/res/values/styles.xml | 6 +++--- .../android/systemui/volume/SegmentedButtons.java | 10 ++++++++-- 14 files changed, 37 insertions(+), 31 deletions(-) diff --git a/core/res/res/layout/accessibility_button_chooser_item.xml b/core/res/res/layout/accessibility_button_chooser_item.xml index 33d6fa2862f76..70905ca19192d 100644 --- a/core/res/res/layout/accessibility_button_chooser_item.xml +++ b/core/res/res/layout/accessibility_button_chooser_item.xml @@ -45,7 +45,7 @@ android:textAppearance="?attr/textAppearanceSmall" android:textColor="?attr/textColorPrimary" android:textSize="12sp" - android:fontFamily="sans-serif-condensed" + android:fontFamily="@*android:string/config_bodyFontFamily" android:gravity="top|center_horizontal" android:minLines="2" android:maxLines="2" diff --git a/core/res/res/layout/accessibility_enable_service_warning.xml b/core/res/res/layout/accessibility_enable_service_warning.xml index 01ef10177c5a3..fc6f498375193 100644 --- a/core/res/res/layout/accessibility_enable_service_warning.xml +++ b/core/res/res/layout/accessibility_enable_service_warning.xml @@ -51,7 +51,7 @@ android:gravity="center" android:textSize="20sp" android:textColor="?android:attr/textColorPrimary" - android:fontFamily="google-sans-medium"/> + android:fontFamily="@*android:string/config_headlineFontFamily"/> + android:fontFamily="@*android:string/config_bodyFontFamily"/> + android:fontFamily="@*android:string/config_headlineFontFamily"/> + android:fontFamily="@*android:string/config_bodyFontFamily"/> + android:fontFamily="@*android:string/config_headlineFontFamily"/> + android:fontFamily="@*android:string/config_bodyFontFamily" /> + android:fontFamily="@*android:string/config_bodyFontFamily"/> + android:fontFamily="@*android:string/config_bodyFontFamily"/> diff --git a/core/res/res/layout/immersive_mode_cling.xml b/core/res/res/layout/immersive_mode_cling.xml index 4e869b76b5100..385c7191365ce 100644 --- a/core/res/res/layout/immersive_mode_cling.xml +++ b/core/res/res/layout/immersive_mode_cling.xml @@ -44,7 +44,7 @@ android:text="@string/immersive_cling_title" android:textColor="@androidprv:color/materialColorOnSurface" android:textSize="24sp" - android:fontFamily="google-sans" /> + android:fontFamily="@*android:string/config_headlineFontFamily" /> + android:fontFamily="@*android:string/config_bodyFontFamily" />