diff options
| author | Xin Li <delphij@google.com> | 2019-08-14 12:04:06 -0700 |
|---|---|---|
| committer | Xin Li <delphij@google.com> | 2019-08-14 12:04:06 -0700 |
| commit | 80860803a414c1d496a5bb9c6a6dcde3777fd67b (patch) | |
| tree | 4d83f747f0654e7a0308f970107db56e1f02c803 /core/java/android | |
| parent | 5f00bf12f4df5e129bfe16fa9e8c620ec5f9d4c2 (diff) | |
| parent | 7922ef60fcf4efc454a3233b9ae7f5f76a412ffa (diff) | |
DO NOT MERGE - Merge qt-dev-plus-aosp-without-vendor (5713463) into stage-aosp-master
Bug: 134405016
Change-Id: I303c0268e8e454b0f0f460eb286812a50c9add88
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/AppOpsManager.java | 12 | ||||
| -rw-r--r-- | core/java/android/app/servertransaction/NewIntentItem.java | 15 | ||||
| -rw-r--r-- | core/java/android/content/pm/RegisteredServicesCache.java | 59 | ||||
| -rw-r--r-- | core/java/android/provider/DeviceConfig.java | 11 |
4 files changed, 49 insertions, 48 deletions
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 60f1424220f6..2f0782b413bf 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -2507,7 +2507,7 @@ public class AppOpsManager { } /** - * @return The duration of the operation in milliseconds. + * @return The duration of the operation in milliseconds. The duration is in wall time. */ public long getDuration() { return getLastDuration(MAX_PRIORITY_UID_STATE, MIN_PRIORITY_UID_STATE, OP_FLAGS_ALL); @@ -2515,7 +2515,7 @@ public class AppOpsManager { /** * Return the duration in milliseconds the app accessed this op while - * in the foreground. + * in the foreground. The duration is in wall time. * * @param flags The flags which are any combination of * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY}, @@ -2534,7 +2534,7 @@ public class AppOpsManager { /** * Return the duration in milliseconds the app accessed this op while - * in the background. + * in the background. The duration is in wall time. * * @param flags The flags which are any combination of * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY}, @@ -2553,7 +2553,7 @@ public class AppOpsManager { /** * Return the duration in milliseconds the app accessed this op for - * a given range of UID states. + * a given range of UID states. The duration is in wall time. * * @param fromUidState The UID state for which to query. Could be one of * {@link #UID_STATE_PERSISTENT}, {@link #UID_STATE_TOP}, @@ -3968,6 +3968,7 @@ public class AppOpsManager { /** * Gets the total duration the app op was accessed (performed) in the foreground. + * The duration is in wall time. * * @param flags The flags which are any combination of * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY}, @@ -3986,6 +3987,7 @@ public class AppOpsManager { /** * Gets the total duration the app op was accessed (performed) in the background. + * The duration is in wall time. * * @param flags The flags which are any combination of * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY}, @@ -4004,7 +4006,7 @@ public class AppOpsManager { /** * Gets the total duration the app op was accessed (performed) for a given - * range of UID states. + * range of UID states. The duration is in wall time. * * @param fromUidState The UID state from which to query. Could be one of * {@link #UID_STATE_PERSISTENT}, {@link #UID_STATE_TOP}, diff --git a/core/java/android/app/servertransaction/NewIntentItem.java b/core/java/android/app/servertransaction/NewIntentItem.java index 2d1883836d02..bb775fc4a5fb 100644 --- a/core/java/android/app/servertransaction/NewIntentItem.java +++ b/core/java/android/app/servertransaction/NewIntentItem.java @@ -17,6 +17,7 @@ package android.app.servertransaction; import static android.app.servertransaction.ActivityLifecycleItem.ON_RESUME; +import static android.app.servertransaction.ActivityLifecycleItem.UNDEFINED; import android.annotation.UnsupportedAppUsage; import android.app.ClientTransactionHandler; @@ -38,10 +39,11 @@ public class NewIntentItem extends ClientTransactionItem { @UnsupportedAppUsage private List<ReferrerIntent> mIntents; + private boolean mResume; @Override public int getPostExecutionState() { - return ON_RESUME; + return mResume ? ON_RESUME : UNDEFINED; } @Override @@ -58,12 +60,13 @@ public class NewIntentItem extends ClientTransactionItem { private NewIntentItem() {} /** Obtain an instance initialized with provided params. */ - public static NewIntentItem obtain(List<ReferrerIntent> intents) { + public static NewIntentItem obtain(List<ReferrerIntent> intents, boolean resume) { NewIntentItem instance = ObjectPool.obtain(NewIntentItem.class); if (instance == null) { instance = new NewIntentItem(); } instance.mIntents = intents; + instance.mResume = resume; return instance; } @@ -71,6 +74,7 @@ public class NewIntentItem extends ClientTransactionItem { @Override public void recycle() { mIntents = null; + mResume = false; ObjectPool.recycle(this); } @@ -80,11 +84,13 @@ public class NewIntentItem extends ClientTransactionItem { /** Write to Parcel. */ @Override public void writeToParcel(Parcel dest, int flags) { + dest.writeBoolean(mResume); dest.writeTypedList(mIntents, flags); } /** Read from Parcel. */ private NewIntentItem(Parcel in) { + mResume = in.readBoolean(); mIntents = in.createTypedArrayList(ReferrerIntent.CREATOR); } @@ -108,18 +114,19 @@ public class NewIntentItem extends ClientTransactionItem { return false; } final NewIntentItem other = (NewIntentItem) o; - return Objects.equals(mIntents, other.mIntents); + return mResume == other.mResume && Objects.equals(mIntents, other.mIntents); } @Override public int hashCode() { int result = 17; + result = 31 * result + (mResume ? 1 : 0); result = 31 * result + mIntents.hashCode(); return result; } @Override public String toString() { - return "NewIntentItem{intents=" + mIntents + "}"; + return "NewIntentItem{intents=" + mIntents + ",resume=" + mResume + "}"; } } diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java index b0b1874107ce..23fbefb73c50 100644 --- a/core/java/android/content/pm/RegisteredServicesCache.java +++ b/core/java/android/content/pm/RegisteredServicesCache.java @@ -17,7 +17,6 @@ package android.content.pm; import android.Manifest; -import android.annotation.Nullable; import android.annotation.UnsupportedAppUsage; import android.content.BroadcastReceiver; import android.content.ComponentName; @@ -177,8 +176,7 @@ public abstract class RegisteredServicesCache<V> { mContext.registerReceiver(mUserRemovedReceiver, userFilter); } - @VisibleForTesting - protected void handlePackageEvent(Intent intent, int userId) { + private void handlePackageEvent(Intent intent, int userId) { // Don't regenerate the services map when the package is removed or its // ASEC container unmounted as a step in replacement. The subsequent // _ADDED / _AVAILABLE call will regenerate the map in the final state. @@ -240,9 +238,6 @@ public abstract class RegisteredServicesCache<V> { public void invalidateCache(int userId) { synchronized (mServicesLock) { - if (DEBUG) { - Slog.d(TAG, "invalidating cache for " + userId + " " + mInterfaceName); - } final UserServices<V> user = findOrCreateUserLocked(userId); user.services = null; onServicesChangedLocked(userId); @@ -472,48 +467,34 @@ public abstract class RegisteredServicesCache<V> { * or null to assume that everything is affected. * @param userId the user for whom to update the services map. */ - private void generateServicesMap(@Nullable int[] changedUids, int userId) { + private void generateServicesMap(int[] changedUids, int userId) { if (DEBUG) { Slog.d(TAG, "generateServicesMap() for " + userId + ", changed UIDs = " + Arrays.toString(changedUids)); } + final ArrayList<ServiceInfo<V>> serviceInfos = new ArrayList<>(); + final List<ResolveInfo> resolveInfos = queryIntentServices(userId); + for (ResolveInfo resolveInfo : resolveInfos) { + try { + ServiceInfo<V> info = parseServiceInfo(resolveInfo); + if (info == null) { + Log.w(TAG, "Unable to load service info " + resolveInfo.toString()); + continue; + } + serviceInfos.add(info); + } catch (XmlPullParserException | IOException e) { + Log.w(TAG, "Unable to load service info " + resolveInfo.toString(), e); + } + } + synchronized (mServicesLock) { final UserServices<V> user = findOrCreateUserLocked(userId); - final boolean cacheInvalid = user.services == null; - if (cacheInvalid) { + final boolean firstScan = user.services == null; + if (firstScan) { user.services = Maps.newHashMap(); } - final ArrayList<ServiceInfo<V>> serviceInfos = new ArrayList<>(); - final List<ResolveInfo> resolveInfos = queryIntentServices(userId); - - for (ResolveInfo resolveInfo : resolveInfos) { - try { - // when changedUids == null, we want to do a rescan of everything, this means - // it's the initial scan, and containsUid will trivially return true - // when changedUids != null, we got here because a package changed, but - // invalidateCache could have been called (thus user.services == null), and we - // should query from PackageManager again - if (!cacheInvalid - && !containsUid( - changedUids, resolveInfo.serviceInfo.applicationInfo.uid)) { - if (DEBUG) { - Slog.d(TAG, "Skipping parseServiceInfo for " + resolveInfo); - } - continue; - } - ServiceInfo<V> info = parseServiceInfo(resolveInfo); - if (info == null) { - Log.w(TAG, "Unable to load service info " + resolveInfo.toString()); - continue; - } - serviceInfos.add(info); - } catch (XmlPullParserException | IOException e) { - Log.w(TAG, "Unable to load service info " + resolveInfo.toString(), e); - } - } - StringBuilder changes = new StringBuilder(); boolean changed = false; for (ServiceInfo<V> info : serviceInfos) { @@ -534,7 +515,7 @@ public abstract class RegisteredServicesCache<V> { changed = true; user.services.put(info.type, info); user.persistentServices.put(info.type, info.uid); - if (!(user.mPersistentServicesFileDidNotExist && cacheInvalid)) { + if (!(user.mPersistentServicesFileDidNotExist && firstScan)) { notifyListener(info.type, userId, false /* removed */); } } else if (previousUid == info.uid) { diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java index 920eb4b51775..e30ba38c127f 100644 --- a/core/java/android/provider/DeviceConfig.java +++ b/core/java/android/provider/DeviceConfig.java @@ -325,6 +325,17 @@ public final class DeviceConfig { */ @TestApi String KEY_SYSTEM_GESTURE_EXCLUSION_LIMIT_DP = "system_gesture_exclusion_limit_dp"; + + /** + * Key for controlling whether system gestures are implicitly excluded by windows requesting + * sticky immersive mode from apps that are targeting an SDK prior to Q. + * + * @see android.provider.DeviceConfig#NAMESPACE_WINDOW_MANAGER + * @hide + */ + @TestApi + String KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE = + "system_gestures_excluded_by_pre_q_sticky_immersive"; } private static final Object sLock = new Object(); |
