diff options
12 files changed, 86 insertions, 19 deletions
diff --git a/config/hiddenapi-light-greylist.txt b/config/hiddenapi-light-greylist.txt index ba1718a88d3b..b1f1f1c26c94 100644 --- a/config/hiddenapi-light-greylist.txt +++ b/config/hiddenapi-light-greylist.txt @@ -176,6 +176,7 @@ Landroid/app/backup/BackupHelperDispatcher$Header;->chunkSize:I Landroid/app/backup/BackupHelperDispatcher$Header;->keyPrefix:Ljava/lang/String; Landroid/app/backup/FullBackup;->backupToTar(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/backup/FullBackupDataOutput;)I Landroid/app/backup/FullBackupDataOutput;->addSize(J)V +Landroid/app/backup/FullBackupDataOutput;-><init>(Landroid/os/ParcelFileDescriptor;)V Landroid/app/backup/FullBackupDataOutput;->mData:Landroid/app/backup/BackupDataOutput; Landroid/app/ContentProviderHolder;->info:Landroid/content/pm/ProviderInfo; Landroid/app/ContentProviderHolder;-><init>(Landroid/content/pm/ProviderInfo;)V diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java index cab6744e3c81..2752fa9f1eb3 100644 --- a/core/java/android/app/ActivityManagerInternal.java +++ b/core/java/android/app/ActivityManagerInternal.java @@ -69,6 +69,13 @@ public abstract class ActivityManagerInternal { AppProtoEnums.APP_TRANSITION_SNAPSHOT; // 4 /** + * Type for {@link #notifyAppTransitionStarting}: The transition was started because it was a + * recents animation and we only needed to wait on the wallpaper. + */ + public static final int APP_TRANSITION_RECENTS_ANIM = + AppProtoEnums.APP_TRANSITION_RECENTS_ANIM; // 5 + + /** * The bundle key to extract the assist data. */ public static final String ASSIST_KEY_DATA = "data"; diff --git a/core/java/android/app/StatsManager.java b/core/java/android/app/StatsManager.java index b12e3bc04a4d..7325daa7630b 100644 --- a/core/java/android/app/StatsManager.java +++ b/core/java/android/app/StatsManager.java @@ -103,12 +103,12 @@ public final class StatsManager { try { IStatsManager service = getIStatsManagerLocked(); if (service == null) { - if (DEBUG) Slog.d(TAG, "Failed to find statsd when adding configuration"); + Slog.e(TAG, "Failed to find statsd when adding configuration"); return false; } return service.addConfiguration(configKey, config); } catch (RemoteException e) { - if (DEBUG) Slog.d(TAG, "Failed to connect to statsd when adding configuration"); + Slog.e(TAG, "Failed to connect to statsd when adding configuration"); return false; } } @@ -126,12 +126,12 @@ public final class StatsManager { try { IStatsManager service = getIStatsManagerLocked(); if (service == null) { - if (DEBUG) Slog.d(TAG, "Failed to find statsd when removing configuration"); + Slog.e(TAG, "Failed to find statsd when removing configuration"); return false; } return service.removeConfiguration(configKey); } catch (RemoteException e) { - if (DEBUG) Slog.d(TAG, "Failed to connect to statsd when removing configuration"); + Slog.e(TAG, "Failed to connect to statsd when removing configuration"); return false; } } @@ -173,7 +173,7 @@ public final class StatsManager { try { IStatsManager service = getIStatsManagerLocked(); if (service == null) { - Slog.w(TAG, "Failed to find statsd when adding broadcast subscriber"); + Slog.e(TAG, "Failed to find statsd when adding broadcast subscriber"); return false; } if (pendingIntent != null) { @@ -184,7 +184,7 @@ public final class StatsManager { return service.unsetBroadcastSubscriber(configKey, subscriberId); } } catch (RemoteException e) { - Slog.w(TAG, "Failed to connect to statsd when adding broadcast subscriber", e); + Slog.e(TAG, "Failed to connect to statsd when adding broadcast subscriber", e); return false; } } @@ -210,7 +210,7 @@ public final class StatsManager { try { IStatsManager service = getIStatsManagerLocked(); if (service == null) { - Slog.d(TAG, "Failed to find statsd when registering data listener."); + Slog.e(TAG, "Failed to find statsd when registering data listener."); return false; } if (pendingIntent == null) { @@ -222,7 +222,7 @@ public final class StatsManager { } } catch (RemoteException e) { - Slog.d(TAG, "Failed to connect to statsd when registering data listener."); + Slog.e(TAG, "Failed to connect to statsd when registering data listener."); return false; } } @@ -241,12 +241,12 @@ public final class StatsManager { try { IStatsManager service = getIStatsManagerLocked(); if (service == null) { - if (DEBUG) Slog.d(TAG, "Failed to find statsd when getting data"); + Slog.e(TAG, "Failed to find statsd when getting data"); return null; } return service.getData(configKey); } catch (RemoteException e) { - if (DEBUG) Slog.d(TAG, "Failed to connecto statsd when getting data"); + Slog.e(TAG, "Failed to connect to statsd when getting data"); return null; } } @@ -265,12 +265,12 @@ public final class StatsManager { try { IStatsManager service = getIStatsManagerLocked(); if (service == null) { - if (DEBUG) Slog.d(TAG, "Failed to find statsd when getting metadata"); + Slog.e(TAG, "Failed to find statsd when getting metadata"); return null; } return service.getMetadata(); } catch (RemoteException e) { - if (DEBUG) Slog.d(TAG, "Failed to connecto statsd when getting metadata"); + Slog.e(TAG, "Failed to connect to statsd when getting metadata"); return null; } } diff --git a/core/java/android/content/SyncResult.java b/core/java/android/content/SyncResult.java index 4f86af985dc6..f67d7f53d1c1 100644 --- a/core/java/android/content/SyncResult.java +++ b/core/java/android/content/SyncResult.java @@ -79,7 +79,17 @@ public final class SyncResult implements Parcelable { /** * Used to indicate to the SyncManager that future sync requests that match the request's - * Account and authority should be delayed at least this many seconds. + * Account and authority should be delayed until a time in seconds since Java epoch. + * + * <p>For example, if you want to delay the next sync for at least 5 minutes, then: + * <pre> + * result.delayUntil = (System.currentTimeMillis() / 1000) + 5 * 60; + * </pre> + * + * <p>By default, when a sync fails, the system retries later with an exponential back-off + * with the system default initial delay time, which always wins over {@link #delayUntil} -- + * i.e. if the system back-off time is larger than {@link #delayUntil}, {@link #delayUntil} + * will essentially be ignored. */ public long delayUntil; diff --git a/core/java/android/security/ConfirmationDialog.java b/core/java/android/security/ConfirmationDialog.java index f6127e184139..1697106c3782 100644 --- a/core/java/android/security/ConfirmationDialog.java +++ b/core/java/android/security/ConfirmationDialog.java @@ -227,12 +227,32 @@ public class ConfirmationDialog { return uiOptionsAsFlags; } + private boolean isAccessibilityServiceRunning() { + boolean serviceRunning = false; + try { + ContentResolver contentResolver = mContext.getContentResolver(); + int a11yEnabled = Settings.Secure.getInt(contentResolver, + Settings.Secure.ACCESSIBILITY_ENABLED); + if (a11yEnabled == 1) { + serviceRunning = true; + } + } catch (SettingNotFoundException e) { + Log.w(TAG, "Unexpected SettingNotFoundException"); + e.printStackTrace(); + } + return serviceRunning; + } + /** * Requests a confirmation prompt to be presented to the user. * * When the prompt is no longer being presented, one of the methods in * {@link ConfirmationCallback} is called on the supplied callback object. * + * Confirmation dialogs may not be available when accessibility services are running so this + * may fail with a {@link ConfirmationNotAvailableException} exception even if + * {@link #isSupported} returns {@code true}. + * * @param executor the executor identifying the thread that will receive the callback. * @param callback the callback to use when the dialog is done showing. * @throws IllegalArgumentException if the prompt text is too long or malfomed. @@ -245,6 +265,9 @@ public class ConfirmationDialog { if (mCallback != null) { throw new ConfirmationAlreadyPresentingException(); } + if (isAccessibilityServiceRunning()) { + throw new ConfirmationNotAvailableException(); + } mCallback = callback; mExecutor = executor; diff --git a/core/proto/android/app/enums.proto b/core/proto/android/app/enums.proto index 5eb05be1a1d1..1754e426fe93 100644 --- a/core/proto/android/app/enums.proto +++ b/core/proto/android/app/enums.proto @@ -32,6 +32,9 @@ enum AppTransitionReasonEnum { APP_TRANSITION_TIMEOUT = 3; // The transition was started because of a we drew a task snapshot. APP_TRANSITION_SNAPSHOT = 4; + // The transition was started because it was a recents animation and we only needed to wait on + // the wallpaper. + APP_TRANSITION_RECENTS_ANIM = 5; } // ActivityManager.java PROCESS_STATEs diff --git a/packages/SettingsLib/res/values/strings.xml b/packages/SettingsLib/res/values/strings.xml index e77db82a520c..fe785c2e5c91 100644 --- a/packages/SettingsLib/res/values/strings.xml +++ b/packages/SettingsLib/res/values/strings.xml @@ -887,13 +887,13 @@ <string name="power_remaining_duration_only_short"><xliff:g id="time">%1$s</xliff:g> left</string> <!-- [CHAR_LIMIT=100] Label for enhanced estimated time that phone will run out of battery --> - <string name="power_discharge_by_enhanced">Will last until about <xliff:g id="time">%1$s</xliff:g> based on your usage (<xliff:g id="level">%2$s</xliff:g>)</string> + <string name="power_discharge_by_enhanced">Should last until about <xliff:g id="time">%1$s</xliff:g> based on your usage (<xliff:g id="level">%2$s</xliff:g>)</string> <!-- [CHAR_LIMIT=100] Label for enhanced estimated time that phone will run out of battery with no percentage --> - <string name="power_discharge_by_only_enhanced">Will last until about <xliff:g id="time">%1$s</xliff:g> based on your usage</string> + <string name="power_discharge_by_only_enhanced">Should last until about <xliff:g id="time">%1$s</xliff:g> based on your usage</string> <!-- [CHAR_LIMIT=100] Label for estimated time that phone will run out of battery --> - <string name="power_discharge_by">Will last until about <xliff:g id="time">%1$s</xliff:g> (<xliff:g id="level">%2$s</xliff:g>)</string> + <string name="power_discharge_by">Should last until about <xliff:g id="time">%1$s</xliff:g> (<xliff:g id="level">%2$s</xliff:g>)</string> <!-- [CHAR_LIMIT=100] Label for estimated time that phone will run out of battery --> - <string name="power_discharge_by_only">Will last until about <xliff:g id="time">%1$s</xliff:g></string> + <string name="power_discharge_by_only">Should last until about <xliff:g id="time">%1$s</xliff:g></string> <!-- [CHAR_LIMIT=60] label for estimated remaining duration of battery when under a certain amount --> <string name="power_remaining_less_than_duration_only">Less than <xliff:g id="threshold">%1$s</xliff:g> remaining</string> diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java index 5758467766a8..c11687b35856 100644 --- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java +++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java @@ -40,7 +40,7 @@ public class PowerUtilTest { public static final long TEN_MINUTES_MILLIS = Duration.ofMinutes(10).toMillis(); public static final long THREE_DAYS_MILLIS = Duration.ofDays(3).toMillis(); public static final long THIRTY_HOURS_MILLIS = Duration.ofHours(30).toMillis(); - public static final String NORMAL_CASE_EXPECTED_PREFIX = "Will last until about"; + public static final String NORMAL_CASE_EXPECTED_PREFIX = "Should last until about"; public static final String ENHANCED_SUFFIX = " based on your usage"; // matches a time (ex: '1:15 PM', '2 AM') public static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* (AM)|(PM)"; diff --git a/services/core/java/com/android/server/am/ActivityMetricsLogger.java b/services/core/java/com/android/server/am/ActivityMetricsLogger.java index 352b75704d6e..724dd3fd9847 100644 --- a/services/core/java/com/android/server/am/ActivityMetricsLogger.java +++ b/services/core/java/com/android/server/am/ActivityMetricsLogger.java @@ -299,7 +299,7 @@ class ActivityMetricsLogger { final boolean otherWindowModesLaunching = mWindowingModeTransitionInfo.size() > 0 && info == null; - if ((resultCode < 0 || launchedActivity == null || !processSwitch + if ((!isLoggableResultCode(resultCode) || launchedActivity == null || !processSwitch || windowingMode == WINDOWING_MODE_UNDEFINED) && !otherWindowModesLaunching) { // Failed to launch or it was not a process switch, so we don't care about the timing. @@ -322,6 +322,14 @@ class ActivityMetricsLogger { } /** + * @return True if we should start logging an event for an activity start that returned + * {@code resultCode} and that we'll indeed get a windows drawn event. + */ + private boolean isLoggableResultCode(int resultCode) { + return resultCode == START_SUCCESS || resultCode == START_TASK_TO_FRONT; + } + + /** * Notifies the tracker that all windows of the app have been drawn. */ void notifyWindowsDrawn(int windowingMode, long timestamp) { diff --git a/services/core/java/com/android/server/am/RecentsAnimation.java b/services/core/java/com/android/server/am/RecentsAnimation.java index 91215685f35f..da56ffd57bf3 100644 --- a/services/core/java/com/android/server/am/RecentsAnimation.java +++ b/services/core/java/com/android/server/am/RecentsAnimation.java @@ -16,6 +16,7 @@ package com.android.server.am; +import static android.app.ActivityManager.START_TASK_TO_FRONT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; @@ -95,6 +96,8 @@ class RecentsAnimation implements RecentsAnimationCallbacks { } } + mStackSupervisor.getActivityMetricsLogger().notifyActivityLaunching(); + mService.setRunningRemoteAnimation(mCallingPid, true); mWindowManager.deferSurfaceLayout(); @@ -143,6 +146,9 @@ class RecentsAnimation implements RecentsAnimationCallbacks { // If we updated the launch-behind state, update the visibility of the activities after // we fetch the visible tasks to be controlled by the animation mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, PRESERVE_WINDOWS); + + mStackSupervisor.getActivityMetricsLogger().notifyActivityLaunched(START_TASK_TO_FRONT, + homeActivity); } finally { mWindowManager.continueSurfaceLayout(); Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java index 0b0df6ff588d..3e72a713272a 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -16,13 +16,16 @@ package com.android.server.wm; +import static android.app.ActivityManagerInternal.APP_TRANSITION_RECENTS_ANIM; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; +import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; import static android.view.RemoteAnimationTarget.MODE_CLOSING; import static android.view.WindowManager.INPUT_CONSUMER_RECENTS_ANIMATION; import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; +import static com.android.server.wm.WindowManagerService.H.NOTIFY_APP_TRANSITION_STARTING; import static com.android.server.wm.proto.RemoteAnimationAdapterWrapperProto.TARGET; import static com.android.server.wm.proto.AnimationAdapterProto.REMOTE; @@ -37,6 +40,7 @@ import android.util.ArraySet; import android.util.Log; import android.util.Slog;import android.util.proto.ProtoOutputStream; import android.util.SparseBooleanArray; +import android.util.SparseIntArray; import android.util.proto.ProtoOutputStream; import android.view.IRecentsAnimationController; import android.view.IRecentsAnimationRunner; @@ -279,6 +283,10 @@ public class RecentsAnimationController { } catch (RemoteException e) { Slog.e(TAG, "Failed to start recents animation", e); } + final SparseIntArray reasons = new SparseIntArray(); + reasons.put(WINDOWING_MODE_FULLSCREEN, APP_TRANSITION_RECENTS_ANIM); + mService.mH.obtainMessage(NOTIFY_APP_TRANSITION_STARTING, + reasons).sendToTarget(); } void cancelAnimation() { diff --git a/services/tests/uiservicestests/AndroidManifest.xml b/services/tests/uiservicestests/AndroidManifest.xml index fc459a0fc5b8..4c7046676adb 100644 --- a/services/tests/uiservicestests/AndroidManifest.xml +++ b/services/tests/uiservicestests/AndroidManifest.xml @@ -27,6 +27,7 @@ <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" /> <uses-permission android:name="android.permission.ACCESS_VOICE_INTERACTION_SERVICE" /> <uses-permission android:name="android.permission.DEVICE_POWER" /> + <uses-permission android:name="android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY" /> <application android:debuggable="true"> <uses-library android:name="android.test.runner" /> |