diff options
12 files changed, 79 insertions, 26 deletions
diff --git a/core/java/android/webkit/MimeTypeMap.java b/core/java/android/webkit/MimeTypeMap.java index fc23c54e834e..358fdc78c0a0 100644 --- a/core/java/android/webkit/MimeTypeMap.java +++ b/core/java/android/webkit/MimeTypeMap.java @@ -19,7 +19,7 @@ package android.webkit; import android.annotation.Nullable; import android.text.TextUtils; -import libcore.net.MimeMap; +import libcore.content.type.MimeMap; import java.util.regex.Pattern; diff --git a/core/java/com/android/internal/compat/IPlatformCompat.aidl b/core/java/com/android/internal/compat/IPlatformCompat.aidl index e415b41459ab..4d8378a34599 100644 --- a/core/java/com/android/internal/compat/IPlatformCompat.aidl +++ b/core/java/com/android/internal/compat/IPlatformCompat.aidl @@ -43,11 +43,6 @@ interface IPlatformCompat /** * Reports that a compatibility change is affecting an app process now. * - * <p>Same as {@link #reportChange(long, ApplicationInfo)}, except it receives a package name - * instead of an {@link ApplicationInfo} - * object, and finds an app info object based on the package name. Returns {@code true} if - * there is no installed package by that name. - * * <p>Note: for changes that are gated using {@link #isChangeEnabled(long, String)}, * you do not need to call this API directly. The change will be reported for you. * @@ -57,6 +52,17 @@ interface IPlatformCompat void reportChangeByPackageName(long changeId, in String packageName); /** + * Reports that a compatibility change is affecting an app process now. + * + * <p>Note: for changes that are gated using {@link #isChangeEnabled(long, int)}, + * you do not need to call this API directly. The change will be reported for you. + * + * @param changeId The ID of the compatibility change taking effect. + * @param uid The UID of the app in question. + */ + void reportChangeByUid(long changeId, int uid); + + /** * Query if a given compatibility change is enabled for an app process. This method should * be called when implementing functionality on behalf of the affected app. * @@ -95,4 +101,28 @@ interface IPlatformCompat * @return {@code true} if the change is enabled for the current app. */ boolean isChangeEnabledByPackageName(long changeId, in String packageName); + + /** + * Query if a given compatibility change is enabled for an app process. This method should + * be called when implementing functionality on behalf of the affected app. + * + * <p>Same as {@link #isChangeEnabled(long, ApplicationInfo)}, except it receives a uid + * instead of an {@link ApplicationInfo} object, and finds an app info object based on the + * uid (or objects if there's more than one package associated with the UID). + * Returns {@code true} if there are no installed packages for the required UID, or if the + * change is enabled for ALL of the installed packages associated with the provided UID. Please + * use a more specific API if you want a different behaviour for multi-package UIDs. + * + * <p>If this method returns {@code true}, the calling code should implement the compatibility + * change, resulting in differing behaviour compared to earlier releases. If this method + * returns {@code false}, the calling code should behave as it did in earlier releases. + * + * <p>It will also report the change as {@link #reportChange(long, int)} would, so there is + * no need to call that method directly. + * + * @param changeId The ID of the compatibility change in question. + * @param uid The UID of the app in question. + * @return {@code true} if the change is enabled for the current app. + */ + boolean isChangeEnabledByUid(long changeId, int uid); }
\ No newline at end of file diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java index 9fff447c2478..103c79d22530 100644 --- a/core/java/com/android/internal/os/RuntimeInit.java +++ b/core/java/com/android/internal/os/RuntimeInit.java @@ -35,7 +35,7 @@ import com.android.server.NetworkManagementSocketTagger; import dalvik.system.RuntimeHooks; import dalvik.system.VMRuntime; -import libcore.net.MimeMap; +import libcore.content.type.MimeMap; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; diff --git a/core/java/com/android/internal/util/MimeIconUtils.java b/core/java/com/android/internal/util/MimeIconUtils.java index 2230c3134301..31ea5b2bf07c 100644 --- a/core/java/com/android/internal/util/MimeIconUtils.java +++ b/core/java/com/android/internal/util/MimeIconUtils.java @@ -27,7 +27,7 @@ import android.util.ArrayMap; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; -import libcore.net.MimeMap; +import libcore.content.type.MimeMap; import java.util.Locale; import java.util.Objects; diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp index 20fb0b036fea..ecddda90809b 100644 --- a/core/jni/android_os_Debug.cpp +++ b/core/jni/android_os_Debug.cpp @@ -321,6 +321,9 @@ static void load_maps(int pid, stats_t* stats, bool* foundSwapPss) } else if (base::StartsWith(name, "/memfd:jit-cache")) { which_heap = HEAP_DALVIK_OTHER; sub_heap = HEAP_DALVIK_OTHER_APP_CODE_CACHE; + } else if (base::StartsWith(name, "/memfd:jit-zygote-cache")) { + which_heap = HEAP_DALVIK_OTHER; + sub_heap = HEAP_DALVIK_OTHER_ZYGOTE_CODE_CACHE; } else if (base::StartsWith(name, "[anon:")) { which_heap = HEAP_UNKNOWN; if (base::StartsWith(name, "[anon:dalvik-")) { diff --git a/core/tests/bugreports/Android.bp b/core/tests/bugreports/Android.bp index d3bf0dd7a7e8..e9d5bb135e02 100644 --- a/core/tests/bugreports/Android.bp +++ b/core/tests/bugreports/Android.bp @@ -20,7 +20,6 @@ android_test { "android.test.base", ], static_libs: ["androidx.test.rules", "truth-prebuilt"], - test_suites: ["general-tests"], sdk_version: "test_current", platform_apis: true, } diff --git a/media/java/android/media/MediaFile.java b/media/java/android/media/MediaFile.java index 8887c7c57ccb..09221a37cb13 100644 --- a/media/java/android/media/MediaFile.java +++ b/media/java/android/media/MediaFile.java @@ -23,7 +23,7 @@ import android.annotation.Nullable; import android.annotation.UnsupportedAppUsage; import android.mtp.MtpConstants; -import libcore.net.MimeMap; +import libcore.content.type.MimeMap; import java.util.HashMap; diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaFileTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaFileTest.java index 38f0175579ad..481f4796951d 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaFileTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaFileTest.java @@ -31,7 +31,7 @@ import android.mtp.MtpConstants; import androidx.test.runner.AndroidJUnit4; -import libcore.net.MimeMap; +import libcore.content.type.MimeMap; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/mime/java/android/content/type/DefaultMimeMapFactory.java b/mime/java/android/content/type/DefaultMimeMapFactory.java index 13039a4ab1e2..03b685df644e 100644 --- a/mime/java/android/content/type/DefaultMimeMapFactory.java +++ b/mime/java/android/content/type/DefaultMimeMapFactory.java @@ -16,7 +16,7 @@ package android.content.type; -import libcore.net.MimeMap; +import libcore.content.type.MimeMap; import java.io.BufferedReader; import java.io.IOException; diff --git a/services/core/java/com/android/server/compat/PlatformCompat.java b/services/core/java/com/android/server/compat/PlatformCompat.java index 8e09d0e5958e..852b26d1ff07 100644 --- a/services/core/java/com/android/server/compat/PlatformCompat.java +++ b/services/core/java/com/android/server/compat/PlatformCompat.java @@ -47,7 +47,8 @@ public class PlatformCompat extends IPlatformCompat.Stub { @Override public void reportChange(long changeId, ApplicationInfo appInfo) { - reportChange(changeId, appInfo, StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__STATE__LOGGED); + reportChange(changeId, appInfo.uid, + StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__STATE__LOGGED); } @Override @@ -60,13 +61,18 @@ public class PlatformCompat extends IPlatformCompat.Stub { } @Override + public void reportChangeByUid(long changeId, int uid) { + reportChange(changeId, uid, StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__STATE__LOGGED); + } + + @Override public boolean isChangeEnabled(long changeId, ApplicationInfo appInfo) { if (CompatConfig.get().isChangeEnabled(changeId, appInfo)) { - reportChange(changeId, appInfo, + reportChange(changeId, appInfo.uid, StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__STATE__ENABLED); return true; } - reportChange(changeId, appInfo, + reportChange(changeId, appInfo.uid, StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__STATE__DISABLED); return false; } @@ -81,6 +87,19 @@ public class PlatformCompat extends IPlatformCompat.Stub { } @Override + public boolean isChangeEnabledByUid(long changeId, int uid) { + String[] packages = mContext.getPackageManager().getPackagesForUid(uid); + if (packages == null || packages.length == 0) { + return true; + } + boolean enabled = true; + for (String packageName : packages) { + enabled = enabled && isChangeEnabledByPackageName(changeId, packageName); + } + return enabled; + } + + @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (!DumpUtils.checkDumpAndUsageStatsPermission(mContext, "platform_compat", pw)) return; CompatConfig.get().dumpConfig(pw); @@ -95,8 +114,7 @@ public class PlatformCompat extends IPlatformCompat.Stub { return null; } - private void reportChange(long changeId, ApplicationInfo appInfo, int state) { - int uid = appInfo.uid; + private void reportChange(long changeId, int uid, int state) { mChangeReporter.reportChange(uid, changeId, state); } } diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index f12c6896172d..a97361f6481f 100644..100755 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -1274,16 +1274,15 @@ public class NotificationManagerService extends SystemService { uidList = new int[] {intent.getIntExtra(Intent.EXTRA_UID, -1)}; } if (pkgList != null && (pkgList.length > 0)) { - for (String pkgName : pkgList) { - if (cancelNotifications) { + if (cancelNotifications) { + for (String pkgName : pkgList) { cancelAllNotificationsInt(MY_UID, MY_PID, pkgName, null, 0, 0, !queryRestart, changeUserId, reason, null); - } else if (hideNotifications) { - hideNotificationsForPackages(pkgList); - } else if (unhideNotifications) { - unhideNotificationsForPackages(pkgList); } - + } else if (hideNotifications) { + hideNotificationsForPackages(pkgList); + } else if (unhideNotifications) { + unhideNotificationsForPackages(pkgList); } } 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 5ba1eb29f6b4..0c31b143df57 100644..100755 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -3601,7 +3601,9 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mService.simulatePackageDistractionBroadcast( PackageManager.RESTRICTION_HIDE_NOTIFICATIONS, new String[] {"a", "b"}); ArgumentCaptor<List<NotificationRecord>> captorHide = ArgumentCaptor.forClass(List.class); - verify(mListeners, times(2)).notifyHiddenLocked(captorHide.capture()); + + // should be called only once. + verify(mListeners, times(1)).notifyHiddenLocked(captorHide.capture()); assertEquals(2, captorHide.getValue().size()); assertEquals("a", captorHide.getValue().get(0).sbn.getPackageName()); assertEquals("b", captorHide.getValue().get(1).sbn.getPackageName()); @@ -3610,7 +3612,9 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mService.simulatePackageDistractionBroadcast( PackageManager.RESTRICTION_HIDE_FROM_SUGGESTIONS, new String[] {"a", "b"}); ArgumentCaptor<List<NotificationRecord>> captorUnhide = ArgumentCaptor.forClass(List.class); - verify(mListeners, times(2)).notifyUnhiddenLocked(captorUnhide.capture()); + + // should be called only once. + verify(mListeners, times(1)).notifyUnhiddenLocked(captorUnhide.capture()); assertEquals(2, captorUnhide.getValue().size()); assertEquals("a", captorUnhide.getValue().get(0).sbn.getPackageName()); assertEquals("b", captorUnhide.getValue().get(1).sbn.getPackageName()); |