diff options
Diffstat (limited to 'core/java')
7 files changed, 60 insertions, 53 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(); diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java index f9d27bb46592..00206fc38d1d 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -1534,7 +1534,11 @@ public class ChooserActivity extends ResolverActivity { if (driList.get(i).getResolvedComponentName().equals( resultList.get(j).getTargetComponent())) { ShortcutManager.ShareShortcutInfo shareShortcutInfo = resultList.get(j); - ChooserTarget chooserTarget = convertToChooserTarget(shareShortcutInfo); + // Incoming results are ordered but without a score. Create a score + // based on the index in order to be sorted appropriately when joined + // with legacy direct share api results. + float score = Math.max(1.0f - (0.05f * j), 0.0f); + ChooserTarget chooserTarget = convertToChooserTarget(shareShortcutInfo, score); chooserTargets.add(chooserTarget); if (mDirectShareAppTargetCache != null && appTargets != null) { mDirectShareAppTargetCache.put(chooserTarget, appTargets.get(j)); @@ -1580,7 +1584,8 @@ public class ChooserActivity extends ResolverActivity { return false; } - private ChooserTarget convertToChooserTarget(ShortcutManager.ShareShortcutInfo shareShortcut) { + private ChooserTarget convertToChooserTarget(ShortcutManager.ShareShortcutInfo shareShortcut, + float score) { ShortcutInfo shortcutInfo = shareShortcut.getShortcutInfo(); Bundle extras = new Bundle(); extras.putString(Intent.EXTRA_SHORTCUT_ID, shortcutInfo.getId()); @@ -1591,7 +1596,7 @@ public class ChooserActivity extends ResolverActivity { null, // The ranking score for this target (0.0-1.0); the system will omit items with low // scores when there are too many Direct Share items. - 1.0f, + score, // The name of the component to be launched if this target is chosen. shareShortcut.getTargetComponent().clone(), // The extra values here will be merged into the Intent when this target is chosen. diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index f905ea2dc6f2..58ce03baa136 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -889,7 +889,8 @@ public class ResolverActivity extends Activity { : mAdapterView.getCheckedItemPosition(); boolean hasIndexBeenFiltered = !mAdapter.hasFilteredItem(); ResolveInfo ri = mAdapter.resolveInfoForPosition(which, hasIndexBeenFiltered); - if (!ri.handleAllWebDataURI && id == R.id.button_always) { + if (mUseLayoutForBrowsables + && !ri.handleAllWebDataURI && id == R.id.button_always) { showSettingsForSelected(ri); } else { startSelected(which, id == R.id.button_always, hasIndexBeenFiltered); diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index 6f4f3374ac73..fe66cf9aab7d 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -1311,7 +1311,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind return semiTransparentBarColor; } else if ((flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0) { return Color.BLACK; - } else if (scrimTransparent && barColor == Color.TRANSPARENT) { + } else if (scrimTransparent && Color.alpha(barColor) == 0) { boolean light = (sysuiVis & lightSysuiFlag) != 0; return light ? SCRIM_LIGHT : semiTransparentBarColor; } else { |
