Loading packages/SystemUI/src/com/android/systemui/ForegroundServiceControllerImpl.java +12 −4 Original line number Diff line number Diff line Loading @@ -34,6 +34,10 @@ import java.util.Arrays; */ public class ForegroundServiceControllerImpl implements ForegroundServiceController { // shelf life of foreground services before they go bad public static final long FG_SERVICE_GRACE_MILLIS = 5000; private static final String TAG = "FgServiceController"; private static final boolean DBG = false; Loading Loading @@ -72,7 +76,7 @@ public class ForegroundServiceControllerImpl if (isDungeonNotification(sbn)) { // if you remove the dungeon entirely, we take that to mean there are // no running services userServices.setRunningServices(null); userServices.setRunningServices(null, 0); return true; } else { // this is safe to call on any notification, not just FLAG_FOREGROUND_SERVICE Loading @@ -94,7 +98,7 @@ public class ForegroundServiceControllerImpl final Bundle extras = sbn.getNotification().extras; if (extras != null) { final String[] svcs = extras.getStringArray(Notification.EXTRA_FOREGROUND_APPS); userServices.setRunningServices(svcs); // null ok userServices.setRunningServices(svcs, sbn.getNotification().when); } } else { userServices.removeNotification(sbn.getPackageName(), sbn.getKey()); Loading @@ -118,9 +122,11 @@ public class ForegroundServiceControllerImpl */ private static class UserServices { private String[] mRunning = null; private long mServiceStartTime = 0; private ArrayMap<String, ArraySet<String>> mNotifications = new ArrayMap<>(1); public void setRunningServices(String[] pkgs) { public void setRunningServices(String[] pkgs, long serviceStartTime) { mRunning = pkgs != null ? Arrays.copyOf(pkgs, pkgs.length) : null; mServiceStartTime = serviceStartTime; } public void addNotification(String pkg, String key) { if (mNotifications.get(pkg) == null) { Loading @@ -142,7 +148,9 @@ public class ForegroundServiceControllerImpl return found; } public boolean isDungeonNeeded() { if (mRunning != null) { if (mRunning != null && System.currentTimeMillis() - mServiceStartTime >= FG_SERVICE_GRACE_MILLIS) { for (String pkg : mRunning) { final ArraySet<String> set = mNotifications.get(pkg); if (set == null || set.size() == 0) { Loading packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -287,6 +287,7 @@ public class ForegroundServiceControllerTest extends SysuiTestCase { final Bundle extras = new Bundle(); if (pkgs != null) extras.putStringArray(Notification.EXTRA_FOREGROUND_APPS, pkgs); n.extras = extras; n.when = System.currentTimeMillis() - 10000; // ten seconds ago final StatusBarNotification sbn = makeMockSBN(userid, "android", SystemMessageProto.SystemMessage.NOTE_FOREGROUND_SERVICES, null, n); Loading services/core/java/com/android/server/pm/PackageManagerService.java +4 −7 Original line number Diff line number Diff line Loading @@ -3794,19 +3794,16 @@ public class PackageManagerService extends IPackageManager.Stub * <p> * Currently, there are three cases in which this can occur: * <ol> * <li>The calling application is a "special" process. The special * processes are {@link Process#SYSTEM_UID}, {@link Process#SHELL_UID} * and {@code 0}</li> * <li>The calling application is a "special" process. Special processes * are those with a UID < {@link Process#FIRST_APPLICATION_UID}.</li> * <li>The calling application has the permission * {@link android.Manifest.permission#ACCESS_INSTANT_APPS}</li> * {@link android.Manifest.permission#ACCESS_INSTANT_APPS}.</li> * <li>The calling application is the default launcher on the * system partition.</li> * </ol> */ private boolean canViewInstantApps(int callingUid, int userId) { if (callingUid == Process.SYSTEM_UID || callingUid == Process.SHELL_UID || callingUid == Process.ROOT_UID) { if (callingUid < Process.FIRST_APPLICATION_UID) { return true; } if (mContext.checkCallingOrSelfPermission( tools/aapt/Command.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -757,12 +757,8 @@ int doDump(Bundle* bundle) AssetManager assets; int32_t assetsCookie; if (!assets.addAssetPath(String8(filename), &assetsCookie)) { fprintf(stderr, "ERROR: dump failed because assets could not be loaded\n"); return 1; } // Now add any dependencies passed in. // Add any dependencies passed in. for (size_t i = 0; i < bundle->getPackageIncludes().size(); i++) { const String8& assetPath = bundle->getPackageIncludes()[i]; if (!assets.addAssetPath(assetPath, NULL)) { Loading @@ -771,6 +767,11 @@ int doDump(Bundle* bundle) } } if (!assets.addAssetPath(String8(filename), &assetsCookie)) { fprintf(stderr, "ERROR: dump failed because assets could not be loaded\n"); return 1; } // Make a dummy config for retrieving resources... we need to supply // non-default values for some configs so that we can retrieve resources // in the app that don't have a default. The most important of these is Loading tools/aapt/ResourceTable.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -4847,6 +4847,7 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle, const String16 animatedVector16("animated-vector"); const String16 pathInterpolator16("pathInterpolator"); const String16 objectAnimator16("objectAnimator"); const String16 gradient16("gradient"); const int minSdk = getMinSdkVersion(bundle); if (minSdk >= SDK_LOLLIPOP_MR1) { Loading Loading @@ -4874,7 +4875,8 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle, if (bundle->getNoVersionVectors() && (node->getElementName() == vector16 || node->getElementName() == animatedVector16 || node->getElementName() == objectAnimator16 || node->getElementName() == pathInterpolator16)) { node->getElementName() == pathInterpolator16 || node->getElementName() == gradient16)) { // We were told not to version vector tags, so skip the children here. continue; } Loading Loading
packages/SystemUI/src/com/android/systemui/ForegroundServiceControllerImpl.java +12 −4 Original line number Diff line number Diff line Loading @@ -34,6 +34,10 @@ import java.util.Arrays; */ public class ForegroundServiceControllerImpl implements ForegroundServiceController { // shelf life of foreground services before they go bad public static final long FG_SERVICE_GRACE_MILLIS = 5000; private static final String TAG = "FgServiceController"; private static final boolean DBG = false; Loading Loading @@ -72,7 +76,7 @@ public class ForegroundServiceControllerImpl if (isDungeonNotification(sbn)) { // if you remove the dungeon entirely, we take that to mean there are // no running services userServices.setRunningServices(null); userServices.setRunningServices(null, 0); return true; } else { // this is safe to call on any notification, not just FLAG_FOREGROUND_SERVICE Loading @@ -94,7 +98,7 @@ public class ForegroundServiceControllerImpl final Bundle extras = sbn.getNotification().extras; if (extras != null) { final String[] svcs = extras.getStringArray(Notification.EXTRA_FOREGROUND_APPS); userServices.setRunningServices(svcs); // null ok userServices.setRunningServices(svcs, sbn.getNotification().when); } } else { userServices.removeNotification(sbn.getPackageName(), sbn.getKey()); Loading @@ -118,9 +122,11 @@ public class ForegroundServiceControllerImpl */ private static class UserServices { private String[] mRunning = null; private long mServiceStartTime = 0; private ArrayMap<String, ArraySet<String>> mNotifications = new ArrayMap<>(1); public void setRunningServices(String[] pkgs) { public void setRunningServices(String[] pkgs, long serviceStartTime) { mRunning = pkgs != null ? Arrays.copyOf(pkgs, pkgs.length) : null; mServiceStartTime = serviceStartTime; } public void addNotification(String pkg, String key) { if (mNotifications.get(pkg) == null) { Loading @@ -142,7 +148,9 @@ public class ForegroundServiceControllerImpl return found; } public boolean isDungeonNeeded() { if (mRunning != null) { if (mRunning != null && System.currentTimeMillis() - mServiceStartTime >= FG_SERVICE_GRACE_MILLIS) { for (String pkg : mRunning) { final ArraySet<String> set = mNotifications.get(pkg); if (set == null || set.size() == 0) { Loading
packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -287,6 +287,7 @@ public class ForegroundServiceControllerTest extends SysuiTestCase { final Bundle extras = new Bundle(); if (pkgs != null) extras.putStringArray(Notification.EXTRA_FOREGROUND_APPS, pkgs); n.extras = extras; n.when = System.currentTimeMillis() - 10000; // ten seconds ago final StatusBarNotification sbn = makeMockSBN(userid, "android", SystemMessageProto.SystemMessage.NOTE_FOREGROUND_SERVICES, null, n); Loading
services/core/java/com/android/server/pm/PackageManagerService.java +4 −7 Original line number Diff line number Diff line Loading @@ -3794,19 +3794,16 @@ public class PackageManagerService extends IPackageManager.Stub * <p> * Currently, there are three cases in which this can occur: * <ol> * <li>The calling application is a "special" process. The special * processes are {@link Process#SYSTEM_UID}, {@link Process#SHELL_UID} * and {@code 0}</li> * <li>The calling application is a "special" process. Special processes * are those with a UID < {@link Process#FIRST_APPLICATION_UID}.</li> * <li>The calling application has the permission * {@link android.Manifest.permission#ACCESS_INSTANT_APPS}</li> * {@link android.Manifest.permission#ACCESS_INSTANT_APPS}.</li> * <li>The calling application is the default launcher on the * system partition.</li> * </ol> */ private boolean canViewInstantApps(int callingUid, int userId) { if (callingUid == Process.SYSTEM_UID || callingUid == Process.SHELL_UID || callingUid == Process.ROOT_UID) { if (callingUid < Process.FIRST_APPLICATION_UID) { return true; } if (mContext.checkCallingOrSelfPermission(
tools/aapt/Command.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -757,12 +757,8 @@ int doDump(Bundle* bundle) AssetManager assets; int32_t assetsCookie; if (!assets.addAssetPath(String8(filename), &assetsCookie)) { fprintf(stderr, "ERROR: dump failed because assets could not be loaded\n"); return 1; } // Now add any dependencies passed in. // Add any dependencies passed in. for (size_t i = 0; i < bundle->getPackageIncludes().size(); i++) { const String8& assetPath = bundle->getPackageIncludes()[i]; if (!assets.addAssetPath(assetPath, NULL)) { Loading @@ -771,6 +767,11 @@ int doDump(Bundle* bundle) } } if (!assets.addAssetPath(String8(filename), &assetsCookie)) { fprintf(stderr, "ERROR: dump failed because assets could not be loaded\n"); return 1; } // Make a dummy config for retrieving resources... we need to supply // non-default values for some configs so that we can retrieve resources // in the app that don't have a default. The most important of these is Loading
tools/aapt/ResourceTable.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -4847,6 +4847,7 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle, const String16 animatedVector16("animated-vector"); const String16 pathInterpolator16("pathInterpolator"); const String16 objectAnimator16("objectAnimator"); const String16 gradient16("gradient"); const int minSdk = getMinSdkVersion(bundle); if (minSdk >= SDK_LOLLIPOP_MR1) { Loading Loading @@ -4874,7 +4875,8 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle, if (bundle->getNoVersionVectors() && (node->getElementName() == vector16 || node->getElementName() == animatedVector16 || node->getElementName() == objectAnimator16 || node->getElementName() == pathInterpolator16)) { node->getElementName() == pathInterpolator16 || node->getElementName() == gradient16)) { // We were told not to version vector tags, so skip the children here. continue; } Loading