diff options
170 files changed, 4030 insertions, 963 deletions
diff --git a/Android.bp b/Android.bp index b3a2ef895d0a..c568d3676916 100644 --- a/Android.bp +++ b/Android.bp @@ -162,6 +162,7 @@ java_defaults { "core/java/android/hardware/biometrics/IBiometricServiceReceiver.aidl", "core/java/android/hardware/biometrics/IBiometricServiceReceiverInternal.aidl", "core/java/android/hardware/biometrics/IBiometricServiceLockoutResetCallback.aidl", + "core/java/android/hardware/display/IColorDisplayManager.aidl", "core/java/android/hardware/display/IDisplayManager.aidl", "core/java/android/hardware/display/IDisplayManagerCallback.aidl", "core/java/android/hardware/display/IVirtualDisplayCallback.aidl", diff --git a/Android.mk b/Android.mk index b7dda9a45ed8..92e33e988249 100644 --- a/Android.mk +++ b/Android.mk @@ -76,10 +76,9 @@ $(OUT_DOCS)/offline-sdk-timestamp: $(OUT_DOCS)/offline-sdk-docs-docs.zip .KATI_RESTAT: $(INTERNAL_PLATFORM_HIDDENAPI_FLAGS) $(INTERNAL_PLATFORM_HIDDENAPI_FLAGS): \ frameworks/base/tools/hiddenapi/generate_hiddenapi_lists.py \ - frameworks/base/config/hiddenapi-light-greylist.txt \ - frameworks/base/config/hiddenapi-vendor-list.txt \ + frameworks/base/config/hiddenapi-greylist.txt \ + frameworks/base/config/hiddenapi-greylist-max-p.txt \ frameworks/base/config/hiddenapi-greylist-max-o.txt \ - frameworks/base/config/hiddenapi-max-sdk-p-blacklist.txt \ frameworks/base/config/hiddenapi-force-blacklist.txt \ $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST) \ $(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST) \ @@ -88,10 +87,9 @@ $(INTERNAL_PLATFORM_HIDDENAPI_FLAGS): \ --public $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST) \ --private $(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST) \ --csv $(PRIVATE_FLAGS_INPUTS) \ - --greylist \ - frameworks/base/config/hiddenapi-light-greylist.txt \ - frameworks/base/config/hiddenapi-vendor-list.txt \ + --greylist frameworks/base/config/hiddenapi-greylist.txt \ --greylist-ignore-conflicts $(INTERNAL_PLATFORM_REMOVED_DEX_API_FILE) \ + --greylist-max-p frameworks/base/config/hiddenapi-greylist-max-p.txt \ --greylist-max-o-ignore-conflicts \ frameworks/base/config/hiddenapi-greylist-max-o.txt \ --blacklist frameworks/base/config/hiddenapi-force-blacklist.txt \ diff --git a/api/current.txt b/api/current.txt index 02236f690598..2eb90d50c1c8 100644 --- a/api/current.txt +++ b/api/current.txt @@ -37537,8 +37537,8 @@ package android.provider { field public static final java.lang.String DATE_TAKEN = "datetaken"; field public static final java.lang.String DESCRIPTION = "description"; field public static final java.lang.String IS_PRIVATE = "isprivate"; - field public static final java.lang.String LATITUDE = "latitude"; - field public static final java.lang.String LONGITUDE = "longitude"; + field public static final deprecated java.lang.String LATITUDE = "latitude"; + field public static final deprecated java.lang.String LONGITUDE = "longitude"; field public static final deprecated java.lang.String MINI_THUMB_MAGIC = "mini_thumb_magic"; field public static final java.lang.String ORIENTATION = "orientation"; field public static final deprecated java.lang.String PICASA_ID = "picasa_id"; @@ -37662,8 +37662,8 @@ package android.provider { field public static final java.lang.String DURATION = "duration"; field public static final java.lang.String IS_PRIVATE = "isprivate"; field public static final java.lang.String LANGUAGE = "language"; - field public static final java.lang.String LATITUDE = "latitude"; - field public static final java.lang.String LONGITUDE = "longitude"; + field public static final deprecated java.lang.String LATITUDE = "latitude"; + field public static final deprecated java.lang.String LONGITUDE = "longitude"; field public static final deprecated java.lang.String MINI_THUMB_MAGIC = "mini_thumb_magic"; field public static final java.lang.String RESOLUTION = "resolution"; field public static final java.lang.String TAGS = "tags"; @@ -45887,8 +45887,8 @@ package android.text.style { method public deprecated java.lang.String getLocale(); method public java.util.Locale getLocaleObject(); method public int getSpanTypeId(); - method public int getUnderlineColor(); method public java.lang.String[] getSuggestions(); + method public int getUnderlineColor(); method public void setFlags(int); method public void updateDrawState(android.text.TextPaint); method public void writeToParcel(android.os.Parcel, int); diff --git a/api/system-current.txt b/api/system-current.txt index 0f054841c669..ca06b07a217d 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -57,6 +57,7 @@ package android { field public static final java.lang.String CONFIGURE_DISPLAY_BRIGHTNESS = "android.permission.CONFIGURE_DISPLAY_BRIGHTNESS"; field public static final java.lang.String CONNECTIVITY_INTERNAL = "android.permission.CONNECTIVITY_INTERNAL"; field public static final java.lang.String CONNECTIVITY_USE_RESTRICTED_NETWORKS = "android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS"; + field public static final java.lang.String CONTROL_DISPLAY_COLOR_TRANSFORMS = "android.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS"; field public static final java.lang.String CONTROL_DISPLAY_SATURATION = "android.permission.CONTROL_DISPLAY_SATURATION"; field public static final java.lang.String CONTROL_INCALL_EXPERIENCE = "android.permission.CONTROL_INCALL_EXPERIENCE"; field public static final java.lang.String CONTROL_KEYGUARD_SECURE_NOTIFICATIONS = "android.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS"; @@ -3014,6 +3015,7 @@ package android.media.audiopolicy { package android.media.session { public final class MediaSessionManager { + method public android.media.session.ISession createSession(android.media.session.MediaSession.CallbackStub, java.lang.String, int); method public void setOnMediaKeyListener(android.media.session.MediaSessionManager.OnMediaKeyListener, android.os.Handler); method public void setOnVolumeKeyLongPressListener(android.media.session.MediaSessionManager.OnVolumeKeyLongPressListener, android.os.Handler); } @@ -3890,14 +3892,6 @@ package android.net.wifi.aware { } -package android.net.wifi.p2p { - - public class WifiP2pManager { - method public void factoryReset(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); - } - -} - package android.net.wifi.rtt { public static final class RangingRequest.Builder { @@ -5786,6 +5780,8 @@ package android.telephony { method public java.util.List<android.telephony.SubscriptionInfo> getAvailableSubscriptionInfoList(); method public java.util.List<android.telephony.SubscriptionPlan> getSubscriptionPlans(int); method public void requestEmbeddedSubscriptionInfoListRefresh(); + method public void setDefaultDataSubId(int); + method public void setDefaultSmsSubId(int); method public void setSubscriptionOverrideCongested(int, boolean, long); method public void setSubscriptionOverrideUnmetered(int, boolean, long); method public void setSubscriptionPlans(int, java.util.List<android.telephony.SubscriptionPlan>); diff --git a/config/hiddenapi-max-sdk-p-blacklist.txt b/config/hiddenapi-greylist-max-p.txt index e69de29bb2d1..e69de29bb2d1 100644 --- a/config/hiddenapi-max-sdk-p-blacklist.txt +++ b/config/hiddenapi-greylist-max-p.txt diff --git a/config/hiddenapi-light-greylist.txt b/config/hiddenapi-greylist.txt index e10f72913d22..579ef938fb1d 100644 --- a/config/hiddenapi-light-greylist.txt +++ b/config/hiddenapi-greylist.txt @@ -51,6 +51,7 @@ Landroid/app/backup/IBackupManager;->setBackupEnabled(Z)V Landroid/app/backup/IFullBackupRestoreObserver$Stub;-><init>()V Landroid/app/backup/IRestoreObserver$Stub;-><init>()V Landroid/app/DownloadManager;->restartDownload([J)V +Landroid/app/IActivityController$Stub;-><init>()V Landroid/app/IActivityManager$Stub$Proxy;->getConfiguration()Landroid/content/res/Configuration; Landroid/app/IActivityManager$Stub$Proxy;->getLaunchedFromUid(Landroid/os/IBinder;)I Landroid/app/IActivityManager$Stub$Proxy;->getProcessLimit()I @@ -62,25 +63,35 @@ Landroid/app/IActivityManager$Stub$Proxy;->updatePersistentConfiguration(Landroi Landroid/app/IActivityManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IActivityManager; Landroid/app/IActivityManager;->bindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;ILjava/lang/String;I)I Landroid/app/IActivityManager;->broadcastIntent(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;[Ljava/lang/String;ILandroid/os/Bundle;ZZI)I +Landroid/app/IActivityManager;->cancelRecentsAnimation(Z)V +Landroid/app/IActivityManager;->cancelTaskWindowTransition(I)V Landroid/app/IActivityManager;->checkPermission(Ljava/lang/String;II)I +Landroid/app/IActivityManager;->closeSystemDialogs(Ljava/lang/String;)V Landroid/app/IActivityManager;->finishActivity(Landroid/os/IBinder;ILandroid/content/Intent;I)Z Landroid/app/IActivityManager;->finishHeavyWeightApp()V Landroid/app/IActivityManager;->finishReceiver(Landroid/os/IBinder;ILjava/lang/String;Landroid/os/Bundle;ZI)V Landroid/app/IActivityManager;->forceStopPackage(Ljava/lang/String;I)V Landroid/app/IActivityManager;->getAllStackInfos()Ljava/util/List; Landroid/app/IActivityManager;->getConfiguration()Landroid/content/res/Configuration; +Landroid/app/IActivityManager;->getCurrentUser()Landroid/content/pm/UserInfo; +Landroid/app/IActivityManager;->getFilteredTasks(III)Ljava/util/List; Landroid/app/IActivityManager;->getIntentForIntentSender(Landroid/content/IIntentSender;)Landroid/content/Intent; Landroid/app/IActivityManager;->getIntentSender(ILjava/lang/String;Landroid/os/IBinder;Ljava/lang/String;I[Landroid/content/Intent;[Ljava/lang/String;ILandroid/os/Bundle;I)Landroid/content/IIntentSender; Landroid/app/IActivityManager;->getLaunchedFromPackage(Landroid/os/IBinder;)Ljava/lang/String; Landroid/app/IActivityManager;->getLaunchedFromUid(Landroid/os/IBinder;)I +Landroid/app/IActivityManager;->getLockTaskModeState()I Landroid/app/IActivityManager;->getMemoryInfo(Landroid/app/ActivityManager$MemoryInfo;)V Landroid/app/IActivityManager;->getPackageProcessState(Ljava/lang/String;Ljava/lang/String;)I Landroid/app/IActivityManager;->getProcessLimit()I +Landroid/app/IActivityManager;->getProcessMemoryInfo([I)[Landroid/os/Debug$MemoryInfo; Landroid/app/IActivityManager;->getProcessPss([I)[J Landroid/app/IActivityManager;->getProviderMimeType(Landroid/net/Uri;I)Ljava/lang/String; +Landroid/app/IActivityManager;->getRecentTasks(III)Landroid/content/pm/ParceledListSlice; +Landroid/app/IActivityManager;->getRunningAppProcesses()Ljava/util/List; Landroid/app/IActivityManager;->getServices(II)Ljava/util/List; Landroid/app/IActivityManager;->getTaskBounds(I)Landroid/graphics/Rect; Landroid/app/IActivityManager;->getTaskForActivity(Landroid/os/IBinder;Z)I +Landroid/app/IActivityManager;->getTaskSnapshot(IZ)Landroid/app/ActivityManager$TaskSnapshot; Landroid/app/IActivityManager;->handleApplicationStrictModeViolation(Landroid/os/IBinder;ILandroid/os/StrictMode$ViolationInfo;)V Landroid/app/IActivityManager;->hang(Landroid/os/IBinder;Z)V Landroid/app/IActivityManager;->isInLockTaskMode()Z @@ -98,9 +109,11 @@ Landroid/app/IActivityManager;->profileControl(Ljava/lang/String;IZLandroid/app/ Landroid/app/IActivityManager;->publishContentProviders(Landroid/app/IApplicationThread;Ljava/util/List;)V Landroid/app/IActivityManager;->registerProcessObserver(Landroid/app/IProcessObserver;)V Landroid/app/IActivityManager;->registerReceiver(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/IIntentReceiver;Landroid/content/IntentFilter;Ljava/lang/String;II)Landroid/content/Intent; +Landroid/app/IActivityManager;->registerTaskStackListener(Landroid/app/ITaskStackListener;)V Landroid/app/IActivityManager;->registerUserSwitchObserver(Landroid/app/IUserSwitchObserver;Ljava/lang/String;)V Landroid/app/IActivityManager;->removeContentProviderExternal(Ljava/lang/String;Landroid/os/IBinder;)V Landroid/app/IActivityManager;->removeStack(I)V +Landroid/app/IActivityManager;->removeTask(I)Z Landroid/app/IActivityManager;->requestBugReport(I)V Landroid/app/IActivityManager;->resizeDockedStack(Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;)V Landroid/app/IActivityManager;->resizeStack(ILandroid/graphics/Rect;ZZZI)V @@ -120,8 +133,12 @@ Landroid/app/IActivityManager;->setProcessMemoryTrimLevel(Ljava/lang/String;II)Z Landroid/app/IActivityManager;->setRequestedOrientation(Landroid/os/IBinder;I)V Landroid/app/IActivityManager;->setTaskResizeable(II)V Landroid/app/IActivityManager;->shutdown(I)Z +Landroid/app/IActivityManager;->startActivity(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;)I +Landroid/app/IActivityManager;->startActivityAsUser(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;I)I +Landroid/app/IActivityManager;->startActivityFromRecents(ILandroid/os/Bundle;)I Landroid/app/IActivityManager;->startBinderTracking()Z Landroid/app/IActivityManager;->startInstrumentation(Landroid/content/ComponentName;Ljava/lang/String;ILandroid/os/Bundle;Landroid/app/IInstrumentationWatcher;Landroid/app/IUiAutomationConnection;ILjava/lang/String;)Z +Landroid/app/IActivityManager;->startRecentsActivity(Landroid/content/Intent;Landroid/app/IAssistDataReceiver;Landroid/view/IRecentsAnimationRunner;)V Landroid/app/IActivityManager;->startSystemLockTaskMode(I)V Landroid/app/IActivityManager;->startUserInBackground(I)Z Landroid/app/IActivityManager;->stopAppSwitches()V @@ -144,12 +161,16 @@ Landroid/app/IAlarmManager$Stub;->TRANSACTION_remove:I Landroid/app/IAlarmManager$Stub;->TRANSACTION_set:I Landroid/app/IAlarmManager;->getNextAlarmClock(I)Landroid/app/AlarmManager$AlarmClockInfo; Landroid/app/IAlarmManager;->set(Ljava/lang/String;IJJJILandroid/app/PendingIntent;Landroid/app/IAlarmListener;Ljava/lang/String;Landroid/os/WorkSource;Landroid/app/AlarmManager$AlarmClockInfo;)V +Landroid/app/IAlarmManager;->setTime(J)Z Landroid/app/IApplicationThread;->scheduleBindService(Landroid/os/IBinder;Landroid/content/Intent;ZI)V Landroid/app/IApplicationThread;->scheduleCreateService(Landroid/os/IBinder;Landroid/content/pm/ServiceInfo;Landroid/content/res/CompatibilityInfo;I)V Landroid/app/IApplicationThread;->scheduleStopService(Landroid/os/IBinder;)V Landroid/app/IApplicationThread;->scheduleTrimMemory(I)V Landroid/app/IApplicationThread;->scheduleUnbindService(Landroid/os/IBinder;Landroid/content/Intent;)V Landroid/app/IAppTask;->getTaskInfo()Landroid/app/ActivityManager$RecentTaskInfo; +Landroid/app/IAssistDataReceiver$Stub;-><init>()V +Landroid/app/IAssistDataReceiver;->onHandleAssistData(Landroid/os/Bundle;)V +Landroid/app/IAssistDataReceiver;->onHandleAssistScreenshot(Landroid/graphics/Bitmap;)V Landroid/app/IInputForwarder;->forwardEvent(Landroid/view/InputEvent;)Z Landroid/app/IInstrumentationWatcher$Stub;-><init>()V Landroid/app/IInstrumentationWatcher$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IInstrumentationWatcher; @@ -236,6 +257,7 @@ Landroid/bluetooth/IBluetooth;->fetchRemoteUuids(Landroid/bluetooth/BluetoothDev Landroid/bluetooth/IBluetooth;->getAddress()Ljava/lang/String; Landroid/bluetooth/IBluetooth;->getRemoteAlias(Landroid/bluetooth/BluetoothDevice;)Ljava/lang/String; Landroid/bluetooth/IBluetooth;->isEnabled()Z +Landroid/bluetooth/IBluetooth;->sendConnectionStateChange(Landroid/bluetooth/BluetoothDevice;III)V Landroid/bluetooth/IBluetoothA2dp$Stub;-><init>()V Landroid/bluetooth/IBluetoothA2dp$Stub;->asInterface(Landroid/os/IBinder;)Landroid/bluetooth/IBluetoothA2dp; Landroid/bluetooth/IBluetoothA2dp;->connect(Landroid/bluetooth/BluetoothDevice;)Z @@ -266,6 +288,10 @@ Landroid/bluetooth/IBluetoothManager;->unregisterStateChangeCallback(Landroid/bl Landroid/bluetooth/IBluetoothManagerCallback$Stub;-><init>()V Landroid/bluetooth/IBluetoothPbap$Stub;->asInterface(Landroid/os/IBinder;)Landroid/bluetooth/IBluetoothPbap; Landroid/bluetooth/IBluetoothStateChangeCallback$Stub;-><init>()V +Landroid/companion/ICompanionDeviceDiscoveryService$Stub;-><init>()V +Landroid/companion/ICompanionDeviceDiscoveryServiceCallback;->onDeviceSelected(Ljava/lang/String;ILjava/lang/String;)V +Landroid/companion/ICompanionDeviceDiscoveryServiceCallback;->onDeviceSelectionCancel()V +Landroid/companion/IFindDeviceCallback;->onSuccess(Landroid/app/PendingIntent;)V Landroid/content/ContentProviderProxy;->mRemote:Landroid/os/IBinder; Landroid/content/IClipboard$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/content/IClipboard$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IClipboard; @@ -312,11 +338,13 @@ Landroid/content/om/IOverlayManager;->getOverlayInfo(Ljava/lang/String;I)Landroi Landroid/content/pm/IPackageDataObserver$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/content/pm/IPackageDataObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/content/pm/IPackageDataObserver$Stub$Proxy;->onRemoveCompleted(Ljava/lang/String;Z)V +Landroid/content/pm/IPackageDataObserver$Stub;-><init>()V Landroid/content/pm/IPackageDataObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageDataObserver; Landroid/content/pm/IPackageDataObserver$Stub;->DESCRIPTOR:Ljava/lang/String; Landroid/content/pm/IPackageDataObserver$Stub;->TRANSACTION_onRemoveCompleted:I Landroid/content/pm/IPackageDataObserver;->onRemoveCompleted(Ljava/lang/String;Z)V Landroid/content/pm/IPackageDeleteObserver$Stub$Proxy;-><init>(Landroid/os/IBinder;)V +Landroid/content/pm/IPackageDeleteObserver$Stub;-><init>()V Landroid/content/pm/IPackageDeleteObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageDeleteObserver; Landroid/content/pm/IPackageDeleteObserver$Stub;->DESCRIPTOR:Ljava/lang/String; Landroid/content/pm/IPackageDeleteObserver$Stub;->TRANSACTION_packageDeleted:I @@ -325,6 +353,7 @@ Landroid/content/pm/IPackageDeleteObserver2$Stub$Proxy;->mRemote:Landroid/os/IBi Landroid/content/pm/IPackageDeleteObserver2$Stub;-><init>()V Landroid/content/pm/IPackageDeleteObserver2$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageDeleteObserver2; Landroid/content/pm/IPackageDeleteObserver2;->onPackageDeleted(Ljava/lang/String;ILjava/lang/String;)V +Landroid/content/pm/IPackageDeleteObserver;->packageDeleted(Ljava/lang/String;I)V Landroid/content/pm/IPackageInstaller;->uninstall(Landroid/content/pm/VersionedPackage;Ljava/lang/String;ILandroid/content/IntentSender;I)V Landroid/content/pm/IPackageInstallerCallback$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/content/pm/IPackageInstallerCallback$Stub$Proxy;->mRemote:Landroid/os/IBinder; @@ -364,11 +393,14 @@ Landroid/content/pm/IPackageManager;->checkUidSignatures(II)I Landroid/content/pm/IPackageManager;->clearPackagePreferredActivities(Ljava/lang/String;)V Landroid/content/pm/IPackageManager;->currentToCanonicalPackageNames([Ljava/lang/String;)[Ljava/lang/String; Landroid/content/pm/IPackageManager;->deleteApplicationCacheFiles(Ljava/lang/String;Landroid/content/pm/IPackageDataObserver;)V +Landroid/content/pm/IPackageManager;->getActivityInfo(Landroid/content/ComponentName;II)Landroid/content/pm/ActivityInfo; Landroid/content/pm/IPackageManager;->getApplicationEnabledSetting(Ljava/lang/String;I)I +Landroid/content/pm/IPackageManager;->getApplicationInfo(Ljava/lang/String;II)Landroid/content/pm/ApplicationInfo; Landroid/content/pm/IPackageManager;->getAppOpPermissionPackages(Ljava/lang/String;)[Ljava/lang/String; Landroid/content/pm/IPackageManager;->getBlockUninstallForUser(Ljava/lang/String;I)Z Landroid/content/pm/IPackageManager;->getComponentEnabledSetting(Landroid/content/ComponentName;I)I Landroid/content/pm/IPackageManager;->getFlagsForUid(I)I +Landroid/content/pm/IPackageManager;->getHomeActivities(Ljava/util/List;)Landroid/content/ComponentName; Landroid/content/pm/IPackageManager;->getInstalledApplications(II)Landroid/content/pm/ParceledListSlice; Landroid/content/pm/IPackageManager;->getInstalledPackages(II)Landroid/content/pm/ParceledListSlice; Landroid/content/pm/IPackageManager;->getInstallerPackageName(Ljava/lang/String;)Ljava/lang/String; @@ -376,6 +408,7 @@ Landroid/content/pm/IPackageManager;->getInstallLocation()I Landroid/content/pm/IPackageManager;->getInstrumentationInfo(Landroid/content/ComponentName;I)Landroid/content/pm/InstrumentationInfo; Landroid/content/pm/IPackageManager;->getLastChosenActivity(Landroid/content/Intent;Ljava/lang/String;I)Landroid/content/pm/ResolveInfo; Landroid/content/pm/IPackageManager;->getNameForUid(I)Ljava/lang/String; +Landroid/content/pm/IPackageManager;->getPackageInfo(Ljava/lang/String;II)Landroid/content/pm/PackageInfo; Landroid/content/pm/IPackageManager;->getPackageInstaller()Landroid/content/pm/IPackageInstaller; Landroid/content/pm/IPackageManager;->getPackagesForUid(I)[Ljava/lang/String; Landroid/content/pm/IPackageManager;->getPackageUid(Ljava/lang/String;II)I @@ -415,6 +448,7 @@ Landroid/content/pm/IPackageStatsObserver$Stub;-><init>()V Landroid/content/pm/IPackageStatsObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageStatsObserver; Landroid/content/pm/IPackageStatsObserver$Stub;->DESCRIPTOR:Ljava/lang/String; Landroid/content/pm/IPackageStatsObserver$Stub;->TRANSACTION_onGetStatsCompleted:I +Landroid/content/pm/IPackageStatsObserver;->onGetStatsCompleted(Landroid/content/pm/PackageStats;Z)V Landroid/content/pm/IShortcutService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/content/pm/IShortcutService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IShortcutService; Landroid/content/res/ConfigurationBoundResourceCache;-><init>()V @@ -438,6 +472,7 @@ Landroid/hardware/input/IInputManager$Stub;->asInterface(Landroid/os/IBinder;)La Landroid/hardware/input/IInputManager$Stub;->TRANSACTION_injectInputEvent:I Landroid/hardware/input/IInputManager;->injectInputEvent(Landroid/view/InputEvent;I)Z Landroid/hardware/location/IActivityRecognitionHardwareClient$Stub;-><init>()V +Landroid/hardware/location/IActivityRecognitionHardwareClient;->onAvailabilityChanged(ZLandroid/hardware/location/IActivityRecognitionHardware;)V Landroid/hardware/location/IContextHubService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/location/IContextHubService; Landroid/hardware/usb/IUsbManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/hardware/usb/IUsbManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/usb/IUsbManager; @@ -447,7 +482,10 @@ Landroid/location/ICountryDetector$Stub;->asInterface(Landroid/os/IBinder;)Landr Landroid/location/ICountryListener$Stub;-><init>()V Landroid/location/IGeocodeProvider$Stub;-><init>()V Landroid/location/IGeocodeProvider$Stub;->asInterface(Landroid/os/IBinder;)Landroid/location/IGeocodeProvider; +Landroid/location/IGeocodeProvider;->getFromLocation(DDILandroid/location/GeocoderParams;Ljava/util/List;)Ljava/lang/String; +Landroid/location/IGeocodeProvider;->getFromLocationName(Ljava/lang/String;DDDDILandroid/location/GeocoderParams;Ljava/util/List;)Ljava/lang/String; Landroid/location/IGeofenceProvider$Stub;-><init>()V +Landroid/location/IGeofenceProvider;->setGeofenceHardware(Landroid/hardware/location/IGeofenceHardware;)V Landroid/location/ILocationListener$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/location/ILocationListener$Stub$Proxy;->mRemote:Landroid/os/IBinder; Landroid/location/ILocationListener$Stub;-><init>()V @@ -460,6 +498,10 @@ Landroid/location/ILocationManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/location/ILocationManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/location/ILocationManager; Landroid/location/ILocationManager$Stub;->TRANSACTION_getAllProviders:I Landroid/location/ILocationManager;->getAllProviders()Ljava/util/List; +Landroid/location/ILocationManager;->getNetworkProviderPackage()Ljava/lang/String; +Landroid/location/ILocationManager;->reportLocation(Landroid/location/Location;Z)V +Landroid/location/INetInitiatedListener$Stub;-><init>()V +Landroid/location/INetInitiatedListener;->sendNiResponse(II)Z Landroid/location/LocationManager$ListenerTransport;-><init>(Landroid/location/LocationManager;Landroid/location/LocationListener;Landroid/os/Looper;)V Landroid/Manifest$permission;->CAPTURE_SECURE_VIDEO_OUTPUT:Ljava/lang/String; Landroid/Manifest$permission;->CAPTURE_VIDEO_OUTPUT:Ljava/lang/String; @@ -486,6 +528,17 @@ Landroid/media/MediaFile;-><init>()V Landroid/media/MediaScanner$MyMediaScannerClient;-><init>(Landroid/media/MediaScanner;)V Landroid/media/projection/IMediaProjectionManager;->hasProjectionPermission(ILjava/lang/String;)Z Landroid/media/session/ISessionManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/session/ISessionManager; +Landroid/media/tv/ITvRemoteProvider$Stub;-><init>()V +Landroid/media/tv/ITvRemoteServiceInput;->clearInputBridge(Landroid/os/IBinder;)V +Landroid/media/tv/ITvRemoteServiceInput;->closeInputBridge(Landroid/os/IBinder;)V +Landroid/media/tv/ITvRemoteServiceInput;->openInputBridge(Landroid/os/IBinder;Ljava/lang/String;III)V +Landroid/media/tv/ITvRemoteServiceInput;->sendKeyDown(Landroid/os/IBinder;I)V +Landroid/media/tv/ITvRemoteServiceInput;->sendKeyUp(Landroid/os/IBinder;I)V +Landroid/media/tv/ITvRemoteServiceInput;->sendPointerDown(Landroid/os/IBinder;III)V +Landroid/media/tv/ITvRemoteServiceInput;->sendPointerSync(Landroid/os/IBinder;)V +Landroid/media/tv/ITvRemoteServiceInput;->sendPointerUp(Landroid/os/IBinder;I)V +Landroid/media/tv/ITvRemoteServiceInput;->sendTimestamp(Landroid/os/IBinder;J)V +Landroid/net/ConnectivityManager$PacketKeepaliveCallback;-><init>()V Landroid/net/IConnectivityManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/net/IConnectivityManager$Stub$Proxy;->getActiveLinkProperties()Landroid/net/LinkProperties; Landroid/net/IConnectivityManager$Stub$Proxy;->getActiveNetworkInfo()Landroid/net/NetworkInfo; @@ -499,6 +552,7 @@ Landroid/net/IConnectivityManager$Stub;->asInterface(Landroid/os/IBinder;)Landro Landroid/net/IConnectivityManager;->getActiveLinkProperties()Landroid/net/LinkProperties; Landroid/net/IConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo; Landroid/net/IConnectivityManager;->getAllNetworkInfo()[Landroid/net/NetworkInfo; +Landroid/net/IConnectivityManager;->getAllNetworkState()[Landroid/net/NetworkState; Landroid/net/IConnectivityManager;->getLastTetherError(Ljava/lang/String;)I Landroid/net/IConnectivityManager;->getNetworkInfo(I)Landroid/net/NetworkInfo; Landroid/net/IConnectivityManager;->getTetherableIfaces()[Ljava/lang/String; @@ -508,9 +562,12 @@ Landroid/net/IConnectivityManager;->getTetheredIfaces()[Ljava/lang/String; Landroid/net/IConnectivityManager;->getTetheringErroredIfaces()[Ljava/lang/String; Landroid/net/IConnectivityManager;->reportInetCondition(II)V Landroid/net/IConnectivityManager;->startLegacyVpn(Lcom/android/internal/net/VpnProfile;)V +Landroid/net/INetd$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetd; +Landroid/net/INetd;->interfaceAddAddress(Ljava/lang/String;Ljava/lang/String;I)V Landroid/net/INetworkManagementEventObserver$Stub;-><init>()V Landroid/net/INetworkPolicyListener$Stub;-><init>()V Landroid/net/INetworkPolicyManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetworkPolicyManager; +Landroid/net/INetworkPolicyManager;->getNetworkQuotaInfo(Landroid/net/NetworkState;)Landroid/net/NetworkQuotaInfo; Landroid/net/INetworkPolicyManager;->getRestrictBackground()Z Landroid/net/INetworkPolicyManager;->getUidPolicy(I)I Landroid/net/INetworkPolicyManager;->setNetworkPolicies([Landroid/net/NetworkPolicy;)V @@ -520,14 +577,19 @@ Landroid/net/INetworkPolicyManager;->snoozeLimit(Landroid/net/NetworkTemplate;)V Landroid/net/INetworkScoreService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetworkScoreService; Landroid/net/INetworkStatsService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/net/INetworkStatsService$Stub$Proxy;->getMobileIfaces()[Ljava/lang/String; +Landroid/net/INetworkStatsService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetworkStatsService; Landroid/net/INetworkStatsService;->forceUpdate()V Landroid/net/INetworkStatsService;->getDataLayerSnapshotForUid(I)Landroid/net/NetworkStats; Landroid/net/INetworkStatsService;->getMobileIfaces()[Ljava/lang/String; Landroid/net/INetworkStatsService;->openSession()Landroid/net/INetworkStatsSession; Landroid/net/INetworkStatsService;->openSessionForUsageStats(ILjava/lang/String;)Landroid/net/INetworkStatsSession; Landroid/net/INetworkStatsSession;->close()V +Landroid/net/INetworkStatsSession;->getHistoryForNetwork(Landroid/net/NetworkTemplate;I)Landroid/net/NetworkStatsHistory; +Landroid/net/INetworkStatsSession;->getHistoryForUid(Landroid/net/NetworkTemplate;IIII)Landroid/net/NetworkStatsHistory; Landroid/net/INetworkStatsSession;->getSummaryForAllUid(Landroid/net/NetworkTemplate;JJZ)Landroid/net/NetworkStats; Landroid/net/INetworkStatsSession;->getSummaryForNetwork(Landroid/net/NetworkTemplate;JJ)Landroid/net/NetworkStats; +Landroid/net/InterfaceConfiguration;-><init>()V +Landroid/net/LinkProperties$ProvisioningChange;->values()[Landroid/net/LinkProperties$ProvisioningChange; Landroid/net/MobileLinkQualityInfo;-><init>()V Landroid/net/nsd/INsdManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/nsd/INsdManager; Landroid/net/nsd/INsdManager;->getMessenger()Landroid/os/Messenger; @@ -552,7 +614,12 @@ Landroid/nfc/INfcAdapterExtras;->getDriverName(Ljava/lang/String;)Ljava/lang/Str Landroid/nfc/INfcAdapterExtras;->open(Ljava/lang/String;Landroid/os/IBinder;)Landroid/os/Bundle; Landroid/nfc/INfcAdapterExtras;->setCardEmulationRoute(Ljava/lang/String;I)V Landroid/nfc/INfcAdapterExtras;->transceive(Ljava/lang/String;[B)Landroid/os/Bundle; +Landroid/os/AsyncResult;-><init>(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Throwable;)V +Landroid/os/AsyncResult;->exception:Ljava/lang/Throwable; Landroid/os/AsyncResult;->forMessage(Landroid/os/Message;)Landroid/os/AsyncResult; +Landroid/os/AsyncResult;->forMessage(Landroid/os/Message;Ljava/lang/Object;Ljava/lang/Throwable;)Landroid/os/AsyncResult; +Landroid/os/AsyncResult;->result:Ljava/lang/Object; +Landroid/os/AsyncResult;->userObj:Ljava/lang/Object; Landroid/os/AsyncTask;->mFuture:Ljava/util/concurrent/FutureTask; Landroid/os/AsyncTask;->mStatus:Landroid/os/AsyncTask$Status; Landroid/os/AsyncTask;->mTaskInvoked:Ljava/util/concurrent/atomic/AtomicBoolean; @@ -569,18 +636,24 @@ Landroid/os/BatteryManager;->EXTRA_MAX_CHARGING_CURRENT:Ljava/lang/String; Landroid/os/BatteryManager;->EXTRA_MAX_CHARGING_VOLTAGE:Ljava/lang/String; Landroid/os/BatteryStats$Counter;-><init>()V Landroid/os/BatteryStats$Counter;->getCountLocked(I)I +Landroid/os/BatteryStats$HistoryItem;-><init>()V Landroid/os/BatteryStats$HistoryItem;->batteryHealth:B +Landroid/os/BatteryStats$HistoryItem;->batteryLevel:B Landroid/os/BatteryStats$HistoryItem;->batteryPlugType:B Landroid/os/BatteryStats$HistoryItem;->batteryStatus:B Landroid/os/BatteryStats$HistoryItem;->batteryVoltage:C Landroid/os/BatteryStats$HistoryItem;->clear()V +Landroid/os/BatteryStats$HistoryItem;->cmd:B Landroid/os/BatteryStats$HistoryItem;->CMD_UPDATE:B Landroid/os/BatteryStats$HistoryItem;->next:Landroid/os/BatteryStats$HistoryItem; Landroid/os/BatteryStats$HistoryItem;->same(Landroid/os/BatteryStats$HistoryItem;)Z Landroid/os/BatteryStats$HistoryItem;->setTo(JBLandroid/os/BatteryStats$HistoryItem;)V Landroid/os/BatteryStats$HistoryItem;->setTo(Landroid/os/BatteryStats$HistoryItem;)V Landroid/os/BatteryStats$HistoryItem;->states2:I +Landroid/os/BatteryStats$HistoryItem;->states:I +Landroid/os/BatteryStats$HistoryItem;->time:J Landroid/os/BatteryStats$Timer;-><init>()V +Landroid/os/BatteryStats$Timer;->getCountLocked(I)I Landroid/os/BatteryStats$Timer;->getTotalTimeLocked(JI)J Landroid/os/BatteryStats$Uid$Pkg$Serv;->getLaunches(I)I Landroid/os/BatteryStats$Uid$Pkg$Serv;->getStarts(I)I @@ -604,6 +677,8 @@ Landroid/os/BatteryStats$Uid$Sensor;->getHandle()I Landroid/os/BatteryStats$Uid$Sensor;->getSensorTime()Landroid/os/BatteryStats$Timer; Landroid/os/BatteryStats$Uid$Sensor;->GPS:I Landroid/os/BatteryStats$Uid$Wakelock;-><init>()V +Landroid/os/BatteryStats$Uid$Wakelock;->getWakeTime(I)Landroid/os/BatteryStats$Timer; +Landroid/os/BatteryStats$Uid;-><init>()V Landroid/os/BatteryStats$Uid;->getAudioTurnedOnTimer()Landroid/os/BatteryStats$Timer; Landroid/os/BatteryStats$Uid;->getFullWifiLockTime(JI)J Landroid/os/BatteryStats$Uid;->getMobileRadioActiveTime(I)J @@ -616,6 +691,7 @@ Landroid/os/BatteryStats$Uid;->getVideoTurnedOnTimer()Landroid/os/BatteryStats$T Landroid/os/BatteryStats$Uid;->getWakelockStats()Landroid/util/ArrayMap; Landroid/os/BatteryStats$Uid;->getWifiBatchedScanTime(IJI)J Landroid/os/BatteryStats$Uid;->getWifiMulticastTime(JI)J +Landroid/os/BatteryStats$Uid;->getWifiRunningTime(JI)J Landroid/os/BatteryStats$Uid;->getWifiScanTime(JI)J Landroid/os/BatteryStats;-><init>()V Landroid/os/BatteryStats;->computeBatteryRealtime(JI)J @@ -627,6 +703,7 @@ Landroid/os/BatteryStats;->getBatteryUptime(J)J Landroid/os/BatteryStats;->getGlobalWifiRunningTime(JI)J Landroid/os/BatteryStats;->getMobileRadioActiveTime(JI)J Landroid/os/BatteryStats;->getNetworkActivityBytes(II)J +Landroid/os/BatteryStats;->getNextHistoryLocked(Landroid/os/BatteryStats$HistoryItem;)Z Landroid/os/BatteryStats;->getPhoneOnTime(JI)J Landroid/os/BatteryStats;->getPhoneSignalStrengthTime(IJI)J Landroid/os/BatteryStats;->getScreenBrightnessTime(IJI)J @@ -640,6 +717,10 @@ Landroid/os/BatteryStats;->STATS_CURRENT:I Landroid/os/BatteryStats;->WAKE_TYPE_PARTIAL:I Landroid/os/Binder;->execTransact(IJJI)Z Landroid/os/Binder;->mObject:J +Landroid/os/Broadcaster;-><init>()V +Landroid/os/Broadcaster;->broadcast(Landroid/os/Message;)V +Landroid/os/Broadcaster;->cancelRequest(ILandroid/os/Handler;I)V +Landroid/os/Broadcaster;->request(ILandroid/os/Handler;I)V Landroid/os/Build$VERSION;->ACTIVE_CODENAMES:[Ljava/lang/String; Landroid/os/Build;->getLong(Ljava/lang/String;)J Landroid/os/Build;->getString(Ljava/lang/String;)Ljava/lang/String; @@ -713,6 +794,7 @@ Landroid/os/Environment;->buildExternalStorageAppMediaDirs(Ljava/lang/String;)[L Landroid/os/Environment;->buildExternalStorageAppObbDirs(Ljava/lang/String;)[Ljava/io/File; Landroid/os/Environment;->buildPaths([Ljava/io/File;[Ljava/lang/String;)[Ljava/io/File; Landroid/os/Environment;->getDataSystemDirectory()Ljava/io/File; +Landroid/os/Environment;->getLegacyExternalStorageDirectory()Ljava/io/File; Landroid/os/Environment;->getLegacyExternalStorageObbDirectory()Ljava/io/File; Landroid/os/Environment;->initForCurrentUser()V Landroid/os/Environment;->maybeTranslateEmulatedPathToInternal(Ljava/io/File;)Ljava/io/File; @@ -733,12 +815,15 @@ Landroid/os/FileUtils;->setPermissions(Ljava/lang/String;III)I Landroid/os/FileUtils;->stringToFile(Ljava/io/File;Ljava/lang/String;)V Landroid/os/FileUtils;->stringToFile(Ljava/lang/String;Ljava/lang/String;)V Landroid/os/FileUtils;->sync(Ljava/io/FileOutputStream;)Z +Landroid/os/Handler;-><init>(Landroid/os/Looper;Landroid/os/Handler$Callback;Z)V Landroid/os/Handler;-><init>(Z)V Landroid/os/Handler;->getIMessenger()Landroid/os/IMessenger; +Landroid/os/Handler;->getMain()Landroid/os/Handler; Landroid/os/Handler;->getPostMessage(Ljava/lang/Runnable;Ljava/lang/Object;)Landroid/os/Message; Landroid/os/Handler;->mCallback:Landroid/os/Handler$Callback; Landroid/os/Handler;->mLooper:Landroid/os/Looper; Landroid/os/Handler;->mMessenger:Landroid/os/IMessenger; +Landroid/os/HwBinder;->reportSyspropChanged()V Landroid/os/HwParcel;-><init>(Z)V Landroid/os/HwRemoteBinder;-><init>()V Landroid/os/IBatteryPropertiesRegistrar$Stub$Proxy;-><init>(Landroid/os/IBinder;)V @@ -749,16 +834,26 @@ Landroid/os/IDeviceIdleController;->addPowerSaveTempWhitelistApp(Ljava/lang/Stri Landroid/os/IDeviceIdleController;->getAppIdTempWhitelist()[I Landroid/os/IDeviceIdleController;->getFullPowerWhitelistExceptIdle()[Ljava/lang/String; Landroid/os/INetworkManagementService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V +Landroid/os/INetworkManagementService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/INetworkManagementService; +Landroid/os/INetworkManagementService;->clearInterfaceAddresses(Ljava/lang/String;)V +Landroid/os/INetworkManagementService;->disableIpv6(Ljava/lang/String;)V Landroid/os/INetworkManagementService;->disableNat(Ljava/lang/String;Ljava/lang/String;)V +Landroid/os/INetworkManagementService;->enableIpv6(Ljava/lang/String;)V Landroid/os/INetworkManagementService;->enableNat(Ljava/lang/String;Ljava/lang/String;)V Landroid/os/INetworkManagementService;->getInterfaceConfig(Ljava/lang/String;)Landroid/net/InterfaceConfiguration; Landroid/os/INetworkManagementService;->getIpForwardingEnabled()Z +Landroid/os/INetworkManagementService;->isBandwidthControlEnabled()Z Landroid/os/INetworkManagementService;->isTetheringStarted()Z Landroid/os/INetworkManagementService;->listTetheredInterfaces()[Ljava/lang/String; +Landroid/os/INetworkManagementService;->registerObserver(Landroid/net/INetworkManagementEventObserver;)V +Landroid/os/INetworkManagementService;->setInterfaceConfig(Ljava/lang/String;Landroid/net/InterfaceConfiguration;)V +Landroid/os/INetworkManagementService;->setInterfaceIpv6PrivacyExtensions(Ljava/lang/String;Z)V Landroid/os/INetworkManagementService;->setIpForwardingEnabled(Z)V +Landroid/os/INetworkManagementService;->setIPv6AddrGenMode(Ljava/lang/String;I)V Landroid/os/INetworkManagementService;->startTethering([Ljava/lang/String;)V Landroid/os/INetworkManagementService;->stopTethering()V Landroid/os/INetworkManagementService;->tetherInterface(Ljava/lang/String;)V +Landroid/os/INetworkManagementService;->unregisterObserver(Landroid/net/INetworkManagementEventObserver;)V Landroid/os/INetworkManagementService;->untetherInterface(Ljava/lang/String;)V Landroid/os/IPermissionController$Stub$Proxy;->checkPermission(Ljava/lang/String;II)Z Landroid/os/IPermissionController$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/IPermissionController; @@ -767,12 +862,15 @@ Landroid/os/IPowerManager$Stub$Proxy;->isLightDeviceIdleMode()Z Landroid/os/IPowerManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/IPowerManager; Landroid/os/IPowerManager$Stub;->TRANSACTION_acquireWakeLock:I Landroid/os/IPowerManager$Stub;->TRANSACTION_goToSleep:I +Landroid/os/IPowerManager;->goToSleep(JII)V Landroid/os/IPowerManager;->isInteractive()Z Landroid/os/IPowerManager;->nap(J)V +Landroid/os/IPowerManager;->reboot(ZLjava/lang/String;Z)V Landroid/os/IPowerManager;->releaseWakeLock(Landroid/os/IBinder;I)V Landroid/os/IPowerManager;->userActivity(JII)V Landroid/os/IPowerManager;->wakeUp(JLjava/lang/String;Ljava/lang/String;)V Landroid/os/IRecoverySystem$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/IRecoverySystem; +Landroid/os/IRemoteCallback$Stub;-><init>()V Landroid/os/IRemoteCallback;->sendResult(Landroid/os/Bundle;)V Landroid/os/IServiceManager;->checkService(Ljava/lang/String;)Landroid/os/IBinder; Landroid/os/IServiceManager;->getService(Ljava/lang/String;)Landroid/os/IBinder; @@ -798,6 +896,7 @@ Landroid/os/Message;->flags:I Landroid/os/Message;->markInUse()V Landroid/os/Message;->next:Landroid/os/Message; Landroid/os/Message;->recycleUnchecked()V +Landroid/os/Message;->setCallback(Ljava/lang/Runnable;)Landroid/os/Message; Landroid/os/Message;->target:Landroid/os/Handler; Landroid/os/Message;->toString(J)Ljava/lang/String; Landroid/os/Message;->when:J @@ -817,13 +916,16 @@ Landroid/os/Parcel;->mCreators:Ljava/util/HashMap; Landroid/os/Parcel;->mNativePtr:J Landroid/os/Parcel;->readArrayMap(Landroid/util/ArrayMap;Ljava/lang/ClassLoader;)V Landroid/os/Parcel;->readArraySet(Ljava/lang/ClassLoader;)Landroid/util/ArraySet; +Landroid/os/Parcel;->readBlob()[B Landroid/os/Parcel;->readCharSequence()Ljava/lang/CharSequence; Landroid/os/Parcel;->readCreator(Landroid/os/Parcelable$Creator;Ljava/lang/ClassLoader;)Landroid/os/Parcelable; Landroid/os/Parcel;->readExceptionCode()I Landroid/os/Parcel;->readParcelableCreator(Ljava/lang/ClassLoader;)Landroid/os/Parcelable$Creator; Landroid/os/Parcel;->readRawFileDescriptor()Ljava/io/FileDescriptor; +Landroid/os/Parcel;->readStringArray()[Ljava/lang/String; Landroid/os/Parcel;->writeArrayMap(Landroid/util/ArrayMap;)V Landroid/os/Parcel;->writeArraySet(Landroid/util/ArraySet;)V +Landroid/os/Parcel;->writeBlob([B)V Landroid/os/Parcel;->writeCharSequence(Ljava/lang/CharSequence;)V Landroid/os/Parcel;->writeParcelableCreator(Landroid/os/Parcelable;)V Landroid/os/ParcelableParcel;-><init>(Ljava/lang/ClassLoader;)V @@ -890,15 +992,27 @@ Landroid/os/Process;->SHELL_UID:I Landroid/os/Process;->VPN_UID:I Landroid/os/Process;->WIFI_UID:I Landroid/os/RecoverySystem;->verifyPackageCompatibility(Ljava/io/InputStream;)Z +Landroid/os/Registrant;-><init>(Landroid/os/Handler;ILjava/lang/Object;)V +Landroid/os/Registrant;->clear()V Landroid/os/Registrant;->getHandler()Landroid/os/Handler; Landroid/os/Registrant;->messageForRegistrant()Landroid/os/Message; +Landroid/os/Registrant;->notifyRegistrant()V +Landroid/os/Registrant;->notifyRegistrant(Landroid/os/AsyncResult;)V Landroid/os/Registrant;->notifyResult(Ljava/lang/Object;)V +Landroid/os/RegistrantList;-><init>()V Landroid/os/RegistrantList;->add(Landroid/os/Handler;ILjava/lang/Object;)V +Landroid/os/RegistrantList;->add(Landroid/os/Registrant;)V +Landroid/os/RegistrantList;->addUnique(Landroid/os/Handler;ILjava/lang/Object;)V Landroid/os/RegistrantList;->get(I)Ljava/lang/Object; +Landroid/os/RegistrantList;->notifyRegistrants()V +Landroid/os/RegistrantList;->notifyRegistrants(Landroid/os/AsyncResult;)V Landroid/os/RegistrantList;->notifyResult(Ljava/lang/Object;)V +Landroid/os/RegistrantList;->remove(Landroid/os/Handler;)V +Landroid/os/RegistrantList;->removeCleared()V Landroid/os/RegistrantList;->size()I Landroid/os/RemoteCallback;->mHandler:Landroid/os/Handler; Landroid/os/RemoteCallbackList;->mCallbacks:Landroid/util/ArrayMap; +Landroid/os/RemoteException;->rethrowFromSystemServer()Ljava/lang/RuntimeException; Landroid/os/SELinux;->checkSELinuxAccess(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z Landroid/os/SELinux;->getContext()Ljava/lang/String; Landroid/os/SELinux;->getFileContext(Ljava/lang/String;)Ljava/lang/String; @@ -920,6 +1034,7 @@ Landroid/os/ServiceManagerNative;->asInterface(Landroid/os/IBinder;)Landroid/os/ Landroid/os/ServiceManagerProxy;->getService(Ljava/lang/String;)Landroid/os/IBinder; Landroid/os/ServiceManagerProxy;->mRemote:Landroid/os/IBinder; Landroid/os/ServiceSpecificException;-><init>(ILjava/lang/String;)V +Landroid/os/ServiceSpecificException;->errorCode:I Landroid/os/SharedMemory;->getFd()I Landroid/os/ShellCommand;->peekNextArg()Ljava/lang/String; Landroid/os/StatFs;->mStat:Landroid/system/StructStatVfs; @@ -927,6 +1042,7 @@ Landroid/os/storage/IObbActionListener$Stub;-><init>()V Landroid/os/storage/IObbActionListener$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/storage/IObbActionListener; Landroid/os/storage/IStorageManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/os/storage/IStorageManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/storage/IStorageManager; +Landroid/os/storage/StorageEventListener;-><init>()V Landroid/os/StrictMode$Span;->finish()V Landroid/os/StrictMode$ThreadPolicy;->mask:I Landroid/os/StrictMode$VmPolicy$Builder;->mMask:I @@ -954,8 +1070,12 @@ Landroid/os/SystemProperties;->native_get_int(Ljava/lang/String;I)I Landroid/os/SystemProperties;->native_get_long(Ljava/lang/String;J)J Landroid/os/SystemProperties;->native_set(Ljava/lang/String;Ljava/lang/String;)V Landroid/os/SystemProperties;->PROP_NAME_MAX:I +Landroid/os/SystemProperties;->reportSyspropChanged()V Landroid/os/SystemProperties;->sChangeCallbacks:Ljava/util/ArrayList; Landroid/os/SystemProperties;->set(Ljava/lang/String;Ljava/lang/String;)V +Landroid/os/SystemService;->start(Ljava/lang/String;)V +Landroid/os/SystemService;->stop(Ljava/lang/String;)V +Landroid/os/SystemVibrator;-><init>()V Landroid/os/SystemVibrator;-><init>(Landroid/content/Context;)V Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V @@ -994,6 +1114,7 @@ Landroid/os/UserHandle;->getCallingUserId()I Landroid/os/UserHandle;->getUid(II)I Landroid/os/UserHandle;->getUserId(I)I Landroid/os/UserHandle;->isIsolated(I)Z +Landroid/os/UserHandle;->isSameApp(II)Z Landroid/os/UserHandle;->mHandle:I Landroid/os/UserHandle;->MU_ENABLED:Z Landroid/os/UserHandle;->OWNER:Landroid/os/UserHandle; @@ -1023,6 +1144,7 @@ Landroid/os/UserManager;->getUserSerialNumber(I)I Landroid/os/UserManager;->getUserStartRealtime()J Landroid/os/UserManager;->getUserUnlockRealtime()J Landroid/os/UserManager;->hasBaseUserRestriction(Ljava/lang/String;Landroid/os/UserHandle;)Z +Landroid/os/UserManager;->hasUserRestriction(Ljava/lang/String;Landroid/os/UserHandle;)Z Landroid/os/UserManager;->isDeviceInDemoMode(Landroid/content/Context;)Z Landroid/os/UserManager;->isGuestUser(I)Z Landroid/os/UserManager;->isLinkedUser()Z @@ -1072,6 +1194,7 @@ Landroid/R$styleable;->CalendarView_unfocusedMonthDateColor:I Landroid/R$styleable;->CalendarView_weekDayTextAppearance:I Landroid/R$styleable;->CalendarView_weekNumberColor:I Landroid/R$styleable;->CalendarView_weekSeparatorLineColor:I +Landroid/R$styleable;->CheckBoxPreference:[I Landroid/R$styleable;->CheckedTextView:[I Landroid/R$styleable;->CheckedTextView_checkMark:I Landroid/R$styleable;->CompoundButton:[I @@ -1382,7 +1505,18 @@ Landroid/speech/IRecognitionListener;->onEvent(ILandroid/os/Bundle;)V Landroid/telecom/Log;->i(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V Landroid/telecom/Log;->w(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V Landroid/telephony/CarrierMessagingServiceManager;-><init>()V +Landroid/telephony/ims/compat/feature/MMTelFeature;-><init>()V +Landroid/telephony/ims/compat/ImsService;-><init>()V +Landroid/telephony/ims/compat/stub/ImsCallSessionImplBase;-><init>()V +Landroid/telephony/ims/compat/stub/ImsUtListenerImplBase;-><init>()V Landroid/telephony/JapanesePhoneNumberFormatter;->format(Landroid/text/Editable;)V +Landroid/telephony/mbms/IMbmsStreamingSessionCallback$Stub;-><init>()V +Landroid/telephony/mbms/IStreamingServiceCallback$Stub;-><init>()V +Landroid/telephony/mbms/vendor/IMbmsStreamingService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/telephony/mbms/vendor/IMbmsStreamingService; +Landroid/telephony/mbms/vendor/IMbmsStreamingService;->getPlaybackUri(ILjava/lang/String;)Landroid/net/Uri; +Landroid/telephony/mbms/vendor/IMbmsStreamingService;->initialize(Landroid/telephony/mbms/IMbmsStreamingSessionCallback;I)I +Landroid/telephony/mbms/vendor/IMbmsStreamingService;->requestUpdateStreamingServices(ILjava/util/List;)I +Landroid/telephony/mbms/vendor/IMbmsStreamingService;->startStreaming(ILjava/lang/String;Landroid/telephony/mbms/IStreamingServiceCallback;)I Landroid/telephony/SmsCbCmasInfo;->getCategory()I Landroid/telephony/SmsCbCmasInfo;->getCertainty()I Landroid/telephony/SmsCbCmasInfo;->getMessageClass()I @@ -1424,10 +1558,21 @@ Landroid/view/accessibility/IAccessibilityManager;->getEnabledAccessibilityServi Landroid/view/AccessibilityIterators$AbstractTextSegmentIterator;-><init>()V Landroid/view/autofill/IAutoFillManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/view/autofill/IAutoFillManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/autofill/IAutoFillManager; +Landroid/view/IAppTransitionAnimationSpecsFuture$Stub;-><init>()V Landroid/view/IDockedStackListener$Stub;-><init>()V Landroid/view/IGraphicsStats$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/view/IGraphicsStats$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/IGraphicsStats; +Landroid/view/IRecentsAnimationController;->finish(Z)V +Landroid/view/IRecentsAnimationController;->screenshotTask(I)Landroid/app/ActivityManager$TaskSnapshot; Landroid/view/IRecentsAnimationController;->setAnimationTargetsBehindSystemBars(Z)V +Landroid/view/IRecentsAnimationController;->setInputConsumerEnabled(Z)V +Landroid/view/IRecentsAnimationRunner$Stub;-><init>()V +Landroid/view/IRecentsAnimationRunner;->onAnimationCanceled()V +Landroid/view/IRecentsAnimationRunner;->onAnimationStart(Landroid/view/IRecentsAnimationController;[Landroid/view/RemoteAnimationTarget;Landroid/graphics/Rect;Landroid/graphics/Rect;)V +Landroid/view/IRemoteAnimationFinishedCallback;->onAnimationFinished()V +Landroid/view/IRemoteAnimationRunner$Stub;-><init>()V +Landroid/view/IRemoteAnimationRunner;->onAnimationCancelled()V +Landroid/view/IRemoteAnimationRunner;->onAnimationStart([Landroid/view/RemoteAnimationTarget;Landroid/view/IRemoteAnimationFinishedCallback;)V Landroid/view/IRotationWatcher$Stub;-><init>()V Landroid/view/IWindow$Stub;-><init>()V Landroid/view/IWindow$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/IWindow; @@ -1439,6 +1584,9 @@ Landroid/view/IWindowManager$Stub$Proxy;->hasNavigationBar(I)Z Landroid/view/IWindowManager$Stub$Proxy;->watchRotation(Landroid/view/IRotationWatcher;I)I Landroid/view/IWindowManager$Stub;-><init>()V Landroid/view/IWindowManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/IWindowManager; +Landroid/view/IWindowManager;->createInputConsumer(Landroid/os/IBinder;Ljava/lang/String;ILandroid/view/InputChannel;)V +Landroid/view/IWindowManager;->destroyInputConsumer(Ljava/lang/String;I)Z +Landroid/view/IWindowManager;->endProlongedAnimations()V Landroid/view/IWindowManager;->executeAppTransition()V Landroid/view/IWindowManager;->freezeRotation(I)V Landroid/view/IWindowManager;->getAnimationScale(I)F @@ -1447,16 +1595,20 @@ Landroid/view/IWindowManager;->getBaseDisplaySize(ILandroid/graphics/Point;)V Landroid/view/IWindowManager;->getDockedStackSide()I Landroid/view/IWindowManager;->getInitialDisplayDensity(I)I Landroid/view/IWindowManager;->getInitialDisplaySize(ILandroid/graphics/Point;)V +Landroid/view/IWindowManager;->getStableInsets(ILandroid/graphics/Rect;)V Landroid/view/IWindowManager;->hasNavigationBar(I)Z Landroid/view/IWindowManager;->isKeyguardLocked()Z Landroid/view/IWindowManager;->isKeyguardSecure()Z Landroid/view/IWindowManager;->isSafeModeEnabled()Z Landroid/view/IWindowManager;->lockNow(Landroid/os/Bundle;)V +Landroid/view/IWindowManager;->overridePendingAppTransitionMultiThumbFuture(Landroid/view/IAppTransitionAnimationSpecsFuture;Landroid/os/IRemoteCallback;ZI)V +Landroid/view/IWindowManager;->overridePendingAppTransitionRemote(Landroid/view/RemoteAnimationAdapter;I)V Landroid/view/IWindowManager;->registerDockedStackListener(Landroid/view/IDockedStackListener;)V Landroid/view/IWindowManager;->removeRotationWatcher(Landroid/view/IRotationWatcher;)V Landroid/view/IWindowManager;->setAnimationScale(IF)V Landroid/view/IWindowManager;->setAnimationScales([F)V Landroid/view/IWindowManager;->setInTouchMode(Z)V +Landroid/view/IWindowManager;->setNavBarVirtualKeyHapticFeedbackEnabled(Z)V Landroid/view/IWindowManager;->setShelfHeight(ZI)V Landroid/view/IWindowManager;->setStrictModeVisualIndicatorPreference(Ljava/lang/String;)V Landroid/view/IWindowManager;->showStrictModeViolation(Z)V @@ -1496,6 +1648,7 @@ Lcom/android/ims/ImsCall;->isMultiparty()Z Lcom/android/ims/ImsCall;->reject(I)V Lcom/android/ims/ImsCall;->terminate(I)V Lcom/android/ims/ImsConfigListener$Stub;-><init>()V +Lcom/android/ims/ImsConfigListener;->onSetFeatureResponse(IIII)V Lcom/android/ims/ImsEcbm;->exitEmergencyCallbackMode()V Lcom/android/ims/ImsManager;->getConfigInterface()Lcom/android/ims/ImsConfig; Lcom/android/ims/ImsManager;->getInstance(Landroid/content/Context;I)Lcom/android/ims/ImsManager; @@ -1505,12 +1658,48 @@ Lcom/android/ims/ImsManager;->isVolteEnabledByPlatform(Landroid/content/Context; Lcom/android/ims/ImsUtInterface;->queryCallForward(ILjava/lang/String;Landroid/os/Message;)V Lcom/android/ims/internal/IImsCallSession$Stub;-><init>()V Lcom/android/ims/internal/IImsCallSession$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/ims/internal/IImsCallSession; +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionConferenceStateUpdated(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsConferenceState;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHandover(Lcom/android/ims/internal/IImsCallSession;IILandroid/telephony/ims/ImsReasonInfo;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHandoverFailed(Lcom/android/ims/internal/IImsCallSession;IILandroid/telephony/ims/ImsReasonInfo;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHeld(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHoldFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHoldReceived(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionInviteParticipantsRequestDelivered(Lcom/android/ims/internal/IImsCallSession;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionInviteParticipantsRequestFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMergeComplete(Lcom/android/ims/internal/IImsCallSession;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMergeFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMergeStarted(Lcom/android/ims/internal/IImsCallSession;Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMultipartyStateChanged(Lcom/android/ims/internal/IImsCallSession;Z)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionProgressing(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsStreamMediaProfile;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionResumed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionResumeFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionResumeReceived(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionStarted(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionStartFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionSuppServiceReceived(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsSuppServiceNotification;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionTerminated(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionTtyModeReceived(Lcom/android/ims/internal/IImsCallSession;I)V +Lcom/android/ims/internal/IImsCallSessionListener;->callSessionUpdated(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V Lcom/android/ims/internal/IImsConfig$Stub;-><init>()V Lcom/android/ims/internal/IImsEcbm$Stub;-><init>()V +Lcom/android/ims/internal/IImsRegistrationListener;->registrationAssociatedUriChanged([Landroid/net/Uri;)V +Lcom/android/ims/internal/IImsRegistrationListener;->registrationChangeFailed(ILandroid/telephony/ims/ImsReasonInfo;)V Lcom/android/ims/internal/IImsRegistrationListener;->registrationConnected()V +Lcom/android/ims/internal/IImsRegistrationListener;->registrationConnectedWithRadioTech(I)V +Lcom/android/ims/internal/IImsRegistrationListener;->registrationDisconnected(Landroid/telephony/ims/ImsReasonInfo;)V +Lcom/android/ims/internal/IImsRegistrationListener;->registrationFeatureCapabilityChanged(I[I[I)V +Lcom/android/ims/internal/IImsRegistrationListener;->registrationProgressingWithRadioTech(I)V +Lcom/android/ims/internal/IImsRegistrationListener;->voiceMessageCountUpdate(I)V Lcom/android/ims/internal/IImsService$Stub;-><init>()V Lcom/android/ims/internal/IImsService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/ims/internal/IImsService; Lcom/android/ims/internal/IImsUt$Stub;-><init>()V +Lcom/android/ims/internal/IImsUtListener;->utConfigurationCallBarringQueried(Lcom/android/ims/internal/IImsUt;I[Landroid/telephony/ims/ImsSsInfo;)V +Lcom/android/ims/internal/IImsUtListener;->utConfigurationCallForwardQueried(Lcom/android/ims/internal/IImsUt;I[Landroid/telephony/ims/ImsCallForwardInfo;)V +Lcom/android/ims/internal/IImsUtListener;->utConfigurationCallWaitingQueried(Lcom/android/ims/internal/IImsUt;I[Landroid/telephony/ims/ImsSsInfo;)V +Lcom/android/ims/internal/IImsUtListener;->utConfigurationQueried(Lcom/android/ims/internal/IImsUt;ILandroid/os/Bundle;)V +Lcom/android/ims/internal/IImsUtListener;->utConfigurationQueryFailed(Lcom/android/ims/internal/IImsUt;ILandroid/telephony/ims/ImsReasonInfo;)V +Lcom/android/ims/internal/IImsUtListener;->utConfigurationUpdated(Lcom/android/ims/internal/IImsUt;I)V +Lcom/android/ims/internal/IImsUtListener;->utConfigurationUpdateFailed(Lcom/android/ims/internal/IImsUt;ILandroid/telephony/ims/ImsReasonInfo;)V Lcom/android/ims/internal/IImsVideoCallCallback;->changeCallDataUsage(J)V Lcom/android/ims/internal/IImsVideoCallCallback;->changeCameraCapabilities(Landroid/telecom/VideoProfile$CameraCapabilities;)V Lcom/android/ims/internal/IImsVideoCallCallback;->changePeerDimensions(II)V @@ -1521,7 +1710,52 @@ Lcom/android/ims/internal/IImsVideoCallCallback;->receiveSessionModifyResponse(I Lcom/android/ims/internal/IImsVideoCallProvider$Stub;-><init>()V Lcom/android/ims/internal/IImsVideoCallProvider;->setCallback(Lcom/android/ims/internal/IImsVideoCallCallback;)V Lcom/android/ims/internal/ImsVideoCallProviderWrapper;-><init>(Lcom/android/ims/internal/IImsVideoCallProvider;)V +Lcom/android/ims/internal/uce/options/IOptionsListener;->cmdStatus(Lcom/android/ims/internal/uce/options/OptionsCmdStatus;)V +Lcom/android/ims/internal/uce/options/IOptionsListener;->getVersionCb(Ljava/lang/String;)V +Lcom/android/ims/internal/uce/options/IOptionsListener;->incomingOptions(Ljava/lang/String;Lcom/android/ims/internal/uce/options/OptionsCapInfo;I)V +Lcom/android/ims/internal/uce/options/IOptionsListener;->serviceAvailable(Lcom/android/ims/internal/uce/common/StatusCode;)V +Lcom/android/ims/internal/uce/options/IOptionsListener;->serviceUnavailable(Lcom/android/ims/internal/uce/common/StatusCode;)V +Lcom/android/ims/internal/uce/options/IOptionsListener;->sipResponseReceived(Ljava/lang/String;Lcom/android/ims/internal/uce/options/OptionsSipResponse;Lcom/android/ims/internal/uce/options/OptionsCapInfo;)V +Lcom/android/ims/internal/uce/options/IOptionsService$Stub;-><init>()V +Lcom/android/ims/internal/uce/options/IOptionsService;->addListener(ILcom/android/ims/internal/uce/options/IOptionsListener;Lcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/options/IOptionsService;->getContactCap(ILjava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/options/IOptionsService;->getContactListCap(I[Ljava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/options/IOptionsService;->getMyInfo(II)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/options/IOptionsService;->getVersion(I)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/options/IOptionsService;->removeListener(ILcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/options/IOptionsService;->responseIncomingOptions(IIILjava/lang/String;Lcom/android/ims/internal/uce/options/OptionsCapInfo;Z)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/options/IOptionsService;->setMyInfo(ILcom/android/ims/internal/uce/common/CapInfo;I)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/presence/IPresenceListener;->capInfoReceived(Ljava/lang/String;[Lcom/android/ims/internal/uce/presence/PresTupleInfo;)V +Lcom/android/ims/internal/uce/presence/IPresenceListener;->cmdStatus(Lcom/android/ims/internal/uce/presence/PresCmdStatus;)V +Lcom/android/ims/internal/uce/presence/IPresenceListener;->getVersionCb(Ljava/lang/String;)V +Lcom/android/ims/internal/uce/presence/IPresenceListener;->listCapInfoReceived(Lcom/android/ims/internal/uce/presence/PresRlmiInfo;[Lcom/android/ims/internal/uce/presence/PresResInfo;)V +Lcom/android/ims/internal/uce/presence/IPresenceListener;->publishTriggering(Lcom/android/ims/internal/uce/presence/PresPublishTriggerType;)V +Lcom/android/ims/internal/uce/presence/IPresenceListener;->serviceAvailable(Lcom/android/ims/internal/uce/common/StatusCode;)V +Lcom/android/ims/internal/uce/presence/IPresenceListener;->serviceUnAvailable(Lcom/android/ims/internal/uce/common/StatusCode;)V +Lcom/android/ims/internal/uce/presence/IPresenceListener;->sipResponseReceived(Lcom/android/ims/internal/uce/presence/PresSipResponse;)V +Lcom/android/ims/internal/uce/presence/IPresenceListener;->unpublishMessageSent()V +Lcom/android/ims/internal/uce/presence/IPresenceService$Stub;-><init>()V +Lcom/android/ims/internal/uce/presence/IPresenceService;->addListener(ILcom/android/ims/internal/uce/presence/IPresenceListener;Lcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/presence/IPresenceService;->getContactCap(ILjava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/presence/IPresenceService;->getContactListCap(I[Ljava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/presence/IPresenceService;->getVersion(I)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/presence/IPresenceService;->publishMyCap(ILcom/android/ims/internal/uce/presence/PresCapInfo;I)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/presence/IPresenceService;->reenableService(II)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/presence/IPresenceService;->removeListener(ILcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode; +Lcom/android/ims/internal/uce/presence/IPresenceService;->setNewFeatureTag(ILjava/lang/String;Lcom/android/ims/internal/uce/presence/PresServiceInfo;I)Lcom/android/ims/internal/uce/common/StatusCode; Lcom/android/ims/internal/uce/uceservice/IUceListener$Stub;-><init>()V +Lcom/android/ims/internal/uce/uceservice/IUceListener;->setStatus(I)V +Lcom/android/ims/internal/uce/uceservice/IUceService$Stub;-><init>()V +Lcom/android/ims/internal/uce/uceservice/IUceService;->createOptionsService(Lcom/android/ims/internal/uce/options/IOptionsListener;Lcom/android/ims/internal/uce/common/UceLong;)I +Lcom/android/ims/internal/uce/uceservice/IUceService;->createPresenceService(Lcom/android/ims/internal/uce/presence/IPresenceListener;Lcom/android/ims/internal/uce/common/UceLong;)I +Lcom/android/ims/internal/uce/uceservice/IUceService;->destroyOptionsService(I)V +Lcom/android/ims/internal/uce/uceservice/IUceService;->destroyPresenceService(I)V +Lcom/android/ims/internal/uce/uceservice/IUceService;->getOptionsService()Lcom/android/ims/internal/uce/options/IOptionsService; +Lcom/android/ims/internal/uce/uceservice/IUceService;->getPresenceService()Lcom/android/ims/internal/uce/presence/IPresenceService; +Lcom/android/ims/internal/uce/uceservice/IUceService;->getServiceStatus()Z +Lcom/android/ims/internal/uce/uceservice/IUceService;->isServiceStarted()Z +Lcom/android/ims/internal/uce/uceservice/IUceService;->startService(Lcom/android/ims/internal/uce/uceservice/IUceListener;)Z +Lcom/android/ims/internal/uce/uceservice/IUceService;->stopService()Z Lcom/android/internal/app/AlertActivity;-><init>()V Lcom/android/internal/app/AlertActivity;->mAlert:Lcom/android/internal/app/AlertController; Lcom/android/internal/app/AlertActivity;->mAlertParams:Lcom/android/internal/app/AlertController$AlertParams; @@ -1552,6 +1786,7 @@ Lcom/android/internal/app/IAppOpsService$Stub;->TRANSACTION_setUserRestrictions: Lcom/android/internal/app/IAppOpsService$Stub;->TRANSACTION_startOperation:I Lcom/android/internal/app/IAppOpsService$Stub;->TRANSACTION_startWatchingMode:I Lcom/android/internal/app/IAppOpsService$Stub;->TRANSACTION_stopWatchingMode:I +Lcom/android/internal/app/IAppOpsService;->finishOperation(Landroid/os/IBinder;IILjava/lang/String;)V Lcom/android/internal/app/IAppOpsService;->getOpsForPackage(ILjava/lang/String;[I)Ljava/util/List; Lcom/android/internal/app/IAppOpsService;->getPackagesForOps([I)Ljava/util/List; Lcom/android/internal/app/IAppOpsService;->resetAllModes(ILjava/lang/String;)V @@ -1599,6 +1834,7 @@ Lcom/android/internal/appwidget/IAppWidgetService;->bindRemoteViewsService(Ljava Lcom/android/internal/appwidget/IAppWidgetService;->getAppWidgetIds(Landroid/content/ComponentName;)[I Lcom/android/internal/appwidget/IAppWidgetService;->getAppWidgetViews(Ljava/lang/String;I)Landroid/widget/RemoteViews; Lcom/android/internal/backup/IBackupTransport$Stub;-><init>()V +Lcom/android/internal/content/PackageMonitor;-><init>()V Lcom/android/internal/database/SortCursor;-><init>([Landroid/database/Cursor;Ljava/lang/String;)V Lcom/android/internal/database/SortCursor;->mCursor:Landroid/database/Cursor; Lcom/android/internal/database/SortCursor;->mCursors:[Landroid/database/Cursor; @@ -1612,6 +1848,14 @@ Lcom/android/internal/location/GpsNetInitiatedHandler;->decodeString(Ljava/lang/ Lcom/android/internal/location/GpsNetInitiatedHandler;->handleNiNotification(Lcom/android/internal/location/GpsNetInitiatedHandler$GpsNiNotification;)V Lcom/android/internal/location/GpsNetInitiatedHandler;->mIsHexInput:Z Lcom/android/internal/location/ILocationProvider$Stub;-><init>()V +Lcom/android/internal/location/ILocationProvider$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/location/ILocationProvider; +Lcom/android/internal/location/ILocationProvider;->disable()V +Lcom/android/internal/location/ILocationProvider;->enable()V +Lcom/android/internal/location/ILocationProvider;->getProperties()Lcom/android/internal/location/ProviderProperties; +Lcom/android/internal/location/ILocationProvider;->getStatus(Landroid/os/Bundle;)I +Lcom/android/internal/location/ILocationProvider;->getStatusUpdateTime()J +Lcom/android/internal/location/ILocationProvider;->sendExtraCommand(Ljava/lang/String;Landroid/os/Bundle;)Z +Lcom/android/internal/location/ILocationProvider;->setRequest(Lcom/android/internal/location/ProviderRequest;Landroid/os/WorkSource;)V Lcom/android/internal/logging/MetricsLogger;-><init>()V Lcom/android/internal/net/LegacyVpnInfo;-><init>()V Lcom/android/internal/net/VpnConfig;-><init>()V @@ -1981,6 +2225,7 @@ Lcom/android/internal/R$styleable;->MapView_apiKey:I Lcom/android/internal/R$styleable;->MenuGroup:[I Lcom/android/internal/R$styleable;->MenuItem:[I Lcom/android/internal/R$styleable;->MenuView:[I +Lcom/android/internal/R$styleable;->NumberPicker:[I Lcom/android/internal/R$styleable;->PopupWindow:[I Lcom/android/internal/R$styleable;->PopupWindow_popupAnimationStyle:I Lcom/android/internal/R$styleable;->PopupWindow_popupBackground:I @@ -2106,6 +2351,7 @@ Lcom/android/internal/R$styleable;->TextView_textStyle:I Lcom/android/internal/R$styleable;->TextView_typeface:I Lcom/android/internal/R$styleable;->TextView_width:I Lcom/android/internal/R$styleable;->Theme:[I +Lcom/android/internal/R$styleable;->TwoLineListItem:[I Lcom/android/internal/R$styleable;->View:[I Lcom/android/internal/R$styleable;->ViewAnimator:[I Lcom/android/internal/R$styleable;->ViewFlipper:[I @@ -3126,6 +3372,7 @@ Lcom/android/internal/telephony/ITelephony;->enableLocationUpdates()V Lcom/android/internal/telephony/ITelephony;->getActivePhoneType()I Lcom/android/internal/telephony/ITelephony;->getCallState()I Lcom/android/internal/telephony/ITelephony;->getDataActivity()I +Lcom/android/internal/telephony/ITelephony;->getDataEnabled(I)Z Lcom/android/internal/telephony/ITelephony;->getDataState()I Lcom/android/internal/telephony/ITelephony;->getNetworkType()I Lcom/android/internal/telephony/ITelephony;->handlePinMmi(Ljava/lang/String;)Z diff --git a/config/hiddenapi-vendor-list.txt b/config/hiddenapi-vendor-list.txt deleted file mode 100644 index a21fa3063f17..000000000000 --- a/config/hiddenapi-vendor-list.txt +++ /dev/null @@ -1,247 +0,0 @@ -Landroid/app/IActivityController$Stub;-><init>()V -Landroid/app/IActivityManager;->cancelRecentsAnimation(Z)V -Landroid/app/IActivityManager;->cancelTaskWindowTransition(I)V -Landroid/app/IActivityManager;->closeSystemDialogs(Ljava/lang/String;)V -Landroid/app/IActivityManager;->getCurrentUser()Landroid/content/pm/UserInfo; -Landroid/app/IActivityManager;->getFilteredTasks(III)Ljava/util/List; -Landroid/app/IActivityManager;->getLockTaskModeState()I -Landroid/app/IActivityManager;->getProcessMemoryInfo([I)[Landroid/os/Debug$MemoryInfo; -Landroid/app/IActivityManager;->getRecentTasks(III)Landroid/content/pm/ParceledListSlice; -Landroid/app/IActivityManager;->getRunningAppProcesses()Ljava/util/List; -Landroid/app/IActivityManager;->getTaskSnapshot(IZ)Landroid/app/ActivityManager$TaskSnapshot; -Landroid/app/IActivityManager;->registerTaskStackListener(Landroid/app/ITaskStackListener;)V -Landroid/app/IActivityManager;->removeTask(I)Z -Landroid/app/IActivityManager;->startActivity(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;)I -Landroid/app/IActivityManager;->startActivityAsUser(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;I)I -Landroid/app/IActivityManager;->startActivityFromRecents(ILandroid/os/Bundle;)I -Landroid/app/IActivityManager;->startRecentsActivity(Landroid/content/Intent;Landroid/app/IAssistDataReceiver;Landroid/view/IRecentsAnimationRunner;)V -Landroid/app/IAlarmManager;->setTime(J)Z -Landroid/app/IAssistDataReceiver$Stub;-><init>()V -Landroid/app/IAssistDataReceiver;->onHandleAssistData(Landroid/os/Bundle;)V -Landroid/app/IAssistDataReceiver;->onHandleAssistScreenshot(Landroid/graphics/Bitmap;)V -Landroid/bluetooth/IBluetooth;->sendConnectionStateChange(Landroid/bluetooth/BluetoothDevice;III)V -Landroid/companion/ICompanionDeviceDiscoveryService$Stub;-><init>()V -Landroid/companion/ICompanionDeviceDiscoveryServiceCallback;->onDeviceSelected(Ljava/lang/String;ILjava/lang/String;)V -Landroid/companion/ICompanionDeviceDiscoveryServiceCallback;->onDeviceSelectionCancel()V -Landroid/companion/IFindDeviceCallback;->onSuccess(Landroid/app/PendingIntent;)V -Landroid/content/pm/IPackageDataObserver$Stub;-><init>()V -Landroid/content/pm/IPackageDeleteObserver$Stub;-><init>()V -Landroid/content/pm/IPackageDeleteObserver;->packageDeleted(Ljava/lang/String;I)V -Landroid/content/pm/IPackageManager;->getActivityInfo(Landroid/content/ComponentName;II)Landroid/content/pm/ActivityInfo; -Landroid/content/pm/IPackageManager;->getApplicationInfo(Ljava/lang/String;II)Landroid/content/pm/ApplicationInfo; -Landroid/content/pm/IPackageManager;->getHomeActivities(Ljava/util/List;)Landroid/content/ComponentName; -Landroid/content/pm/IPackageManager;->getPackageInfo(Ljava/lang/String;II)Landroid/content/pm/PackageInfo; -Landroid/content/pm/IPackageStatsObserver;->onGetStatsCompleted(Landroid/content/pm/PackageStats;Z)V -Landroid/hardware/location/IActivityRecognitionHardwareClient;->onAvailabilityChanged(ZLandroid/hardware/location/IActivityRecognitionHardware;)V -Landroid/location/IGeocodeProvider;->getFromLocation(DDILandroid/location/GeocoderParams;Ljava/util/List;)Ljava/lang/String; -Landroid/location/IGeocodeProvider;->getFromLocationName(Ljava/lang/String;DDDDILandroid/location/GeocoderParams;Ljava/util/List;)Ljava/lang/String; -Landroid/location/IGeofenceProvider;->setGeofenceHardware(Landroid/hardware/location/IGeofenceHardware;)V -Landroid/location/ILocationManager;->getNetworkProviderPackage()Ljava/lang/String; -Landroid/location/ILocationManager;->reportLocation(Landroid/location/Location;Z)V -Landroid/location/INetInitiatedListener$Stub;-><init>()V -Landroid/location/INetInitiatedListener;->sendNiResponse(II)Z -Landroid/media/tv/ITvRemoteProvider$Stub;-><init>()V -Landroid/media/tv/ITvRemoteServiceInput;->clearInputBridge(Landroid/os/IBinder;)V -Landroid/media/tv/ITvRemoteServiceInput;->closeInputBridge(Landroid/os/IBinder;)V -Landroid/media/tv/ITvRemoteServiceInput;->openInputBridge(Landroid/os/IBinder;Ljava/lang/String;III)V -Landroid/media/tv/ITvRemoteServiceInput;->sendKeyDown(Landroid/os/IBinder;I)V -Landroid/media/tv/ITvRemoteServiceInput;->sendKeyUp(Landroid/os/IBinder;I)V -Landroid/media/tv/ITvRemoteServiceInput;->sendPointerDown(Landroid/os/IBinder;III)V -Landroid/media/tv/ITvRemoteServiceInput;->sendPointerSync(Landroid/os/IBinder;)V -Landroid/media/tv/ITvRemoteServiceInput;->sendPointerUp(Landroid/os/IBinder;I)V -Landroid/media/tv/ITvRemoteServiceInput;->sendTimestamp(Landroid/os/IBinder;J)V -Landroid/net/ConnectivityManager$PacketKeepaliveCallback;-><init>()V -Landroid/net/IConnectivityManager;->getAllNetworkState()[Landroid/net/NetworkState; -Landroid/net/INetd$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetd; -Landroid/net/INetd;->interfaceAddAddress(Ljava/lang/String;Ljava/lang/String;I)V -Landroid/net/INetworkPolicyManager;->getNetworkQuotaInfo(Landroid/net/NetworkState;)Landroid/net/NetworkQuotaInfo; -Landroid/net/INetworkStatsService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetworkStatsService; -Landroid/net/INetworkStatsSession;->getHistoryForNetwork(Landroid/net/NetworkTemplate;I)Landroid/net/NetworkStatsHistory; -Landroid/net/INetworkStatsSession;->getHistoryForUid(Landroid/net/NetworkTemplate;IIII)Landroid/net/NetworkStatsHistory; -Landroid/net/InterfaceConfiguration;-><init>()V -Landroid/net/LinkProperties$ProvisioningChange;->values()[Landroid/net/LinkProperties$ProvisioningChange; -Landroid/os/AsyncResult;-><init>(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Throwable;)V -Landroid/os/AsyncResult;->exception:Ljava/lang/Throwable; -Landroid/os/AsyncResult;->forMessage(Landroid/os/Message;Ljava/lang/Object;Ljava/lang/Throwable;)Landroid/os/AsyncResult; -Landroid/os/AsyncResult;->result:Ljava/lang/Object; -Landroid/os/AsyncResult;->userObj:Ljava/lang/Object; -Landroid/os/BatteryStats$HistoryItem;-><init>()V -Landroid/os/BatteryStats$HistoryItem;->batteryLevel:B -Landroid/os/BatteryStats$HistoryItem;->cmd:B -Landroid/os/BatteryStats$HistoryItem;->states:I -Landroid/os/BatteryStats$HistoryItem;->time:J -Landroid/os/BatteryStats$Timer;->getCountLocked(I)I -Landroid/os/BatteryStats$Uid$Wakelock;->getWakeTime(I)Landroid/os/BatteryStats$Timer; -Landroid/os/BatteryStats$Uid;-><init>()V -Landroid/os/BatteryStats$Uid;->getWifiRunningTime(JI)J -Landroid/os/BatteryStats;->getNextHistoryLocked(Landroid/os/BatteryStats$HistoryItem;)Z -Landroid/os/Broadcaster;-><init>()V -Landroid/os/Broadcaster;->broadcast(Landroid/os/Message;)V -Landroid/os/Broadcaster;->cancelRequest(ILandroid/os/Handler;I)V -Landroid/os/Broadcaster;->request(ILandroid/os/Handler;I)V -Landroid/os/Environment;->getLegacyExternalStorageDirectory()Ljava/io/File; -Landroid/os/Handler;-><init>(Landroid/os/Looper;Landroid/os/Handler$Callback;Z)V -Landroid/os/Handler;->getMain()Landroid/os/Handler; -Landroid/os/HwBinder;->reportSyspropChanged()V -Landroid/os/INetworkManagementService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/INetworkManagementService; -Landroid/os/INetworkManagementService;->clearInterfaceAddresses(Ljava/lang/String;)V -Landroid/os/INetworkManagementService;->disableIpv6(Ljava/lang/String;)V -Landroid/os/INetworkManagementService;->enableIpv6(Ljava/lang/String;)V -Landroid/os/INetworkManagementService;->isBandwidthControlEnabled()Z -Landroid/os/INetworkManagementService;->registerObserver(Landroid/net/INetworkManagementEventObserver;)V -Landroid/os/INetworkManagementService;->setInterfaceConfig(Ljava/lang/String;Landroid/net/InterfaceConfiguration;)V -Landroid/os/INetworkManagementService;->setInterfaceIpv6PrivacyExtensions(Ljava/lang/String;Z)V -Landroid/os/INetworkManagementService;->setIPv6AddrGenMode(Ljava/lang/String;I)V -Landroid/os/INetworkManagementService;->unregisterObserver(Landroid/net/INetworkManagementEventObserver;)V -Landroid/os/IPowerManager;->goToSleep(JII)V -Landroid/os/IPowerManager;->reboot(ZLjava/lang/String;Z)V -Landroid/os/IRemoteCallback$Stub;-><init>()V -Landroid/os/Message;->setCallback(Ljava/lang/Runnable;)Landroid/os/Message; -Landroid/os/Parcel;->readBlob()[B -Landroid/os/Parcel;->readStringArray()[Ljava/lang/String; -Landroid/os/Parcel;->writeBlob([B)V -Landroid/os/Registrant;-><init>(Landroid/os/Handler;ILjava/lang/Object;)V -Landroid/os/Registrant;->clear()V -Landroid/os/Registrant;->notifyRegistrant()V -Landroid/os/Registrant;->notifyRegistrant(Landroid/os/AsyncResult;)V -Landroid/os/RegistrantList;-><init>()V -Landroid/os/RegistrantList;->add(Landroid/os/Registrant;)V -Landroid/os/RegistrantList;->addUnique(Landroid/os/Handler;ILjava/lang/Object;)V -Landroid/os/RegistrantList;->notifyRegistrants()V -Landroid/os/RegistrantList;->notifyRegistrants(Landroid/os/AsyncResult;)V -Landroid/os/RegistrantList;->remove(Landroid/os/Handler;)V -Landroid/os/RegistrantList;->removeCleared()V -Landroid/os/RemoteException;->rethrowFromSystemServer()Ljava/lang/RuntimeException; -Landroid/os/ServiceSpecificException;->errorCode:I -Landroid/os/storage/StorageEventListener;-><init>()V -Landroid/os/SystemProperties;->reportSyspropChanged()V -Landroid/os/SystemService;->start(Ljava/lang/String;)V -Landroid/os/SystemService;->stop(Ljava/lang/String;)V -Landroid/os/SystemVibrator;-><init>()V -Landroid/os/UserHandle;->isSameApp(II)Z -Landroid/os/UserManager;->hasUserRestriction(Ljava/lang/String;Landroid/os/UserHandle;)Z -Landroid/R$styleable;->CheckBoxPreference:[I -Landroid/telephony/ims/compat/feature/MMTelFeature;-><init>()V -Landroid/telephony/ims/compat/ImsService;-><init>()V -Landroid/telephony/ims/compat/stub/ImsCallSessionImplBase;-><init>()V -Landroid/telephony/ims/compat/stub/ImsUtListenerImplBase;-><init>()V -Landroid/telephony/mbms/IMbmsStreamingSessionCallback$Stub;-><init>()V -Landroid/telephony/mbms/IStreamingServiceCallback$Stub;-><init>()V -Landroid/telephony/mbms/vendor/IMbmsStreamingService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/telephony/mbms/vendor/IMbmsStreamingService; -Landroid/telephony/mbms/vendor/IMbmsStreamingService;->getPlaybackUri(ILjava/lang/String;)Landroid/net/Uri; -Landroid/telephony/mbms/vendor/IMbmsStreamingService;->initialize(Landroid/telephony/mbms/IMbmsStreamingSessionCallback;I)I -Landroid/telephony/mbms/vendor/IMbmsStreamingService;->requestUpdateStreamingServices(ILjava/util/List;)I -Landroid/telephony/mbms/vendor/IMbmsStreamingService;->startStreaming(ILjava/lang/String;Landroid/telephony/mbms/IStreamingServiceCallback;)I -Landroid/view/IAppTransitionAnimationSpecsFuture$Stub;-><init>()V -Landroid/view/IRecentsAnimationController;->finish(Z)V -Landroid/view/IRecentsAnimationController;->screenshotTask(I)Landroid/app/ActivityManager$TaskSnapshot; -Landroid/view/IRecentsAnimationController;->setInputConsumerEnabled(Z)V -Landroid/view/IRecentsAnimationRunner$Stub;-><init>()V -Landroid/view/IRecentsAnimationRunner;->onAnimationCanceled()V -Landroid/view/IRecentsAnimationRunner;->onAnimationStart(Landroid/view/IRecentsAnimationController;[Landroid/view/RemoteAnimationTarget;Landroid/graphics/Rect;Landroid/graphics/Rect;)V -Landroid/view/IRemoteAnimationFinishedCallback;->onAnimationFinished()V -Landroid/view/IRemoteAnimationRunner$Stub;-><init>()V -Landroid/view/IRemoteAnimationRunner;->onAnimationCancelled()V -Landroid/view/IRemoteAnimationRunner;->onAnimationStart([Landroid/view/RemoteAnimationTarget;Landroid/view/IRemoteAnimationFinishedCallback;)V -Landroid/view/IWindowManager;->createInputConsumer(Landroid/os/IBinder;Ljava/lang/String;ILandroid/view/InputChannel;)V -Landroid/view/IWindowManager;->destroyInputConsumer(Ljava/lang/String;I)Z -Landroid/view/IWindowManager;->endProlongedAnimations()V -Landroid/view/IWindowManager;->getStableInsets(ILandroid/graphics/Rect;)V -Landroid/view/IWindowManager;->overridePendingAppTransitionMultiThumbFuture(Landroid/view/IAppTransitionAnimationSpecsFuture;Landroid/os/IRemoteCallback;ZI)V -Landroid/view/IWindowManager;->overridePendingAppTransitionRemote(Landroid/view/RemoteAnimationAdapter;I)V -Landroid/view/IWindowManager;->setNavBarVirtualKeyHapticFeedbackEnabled(Z)V -Lcom/android/ims/ImsConfigListener;->onSetFeatureResponse(IIII)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionConferenceStateUpdated(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsConferenceState;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHandover(Lcom/android/ims/internal/IImsCallSession;IILandroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHandoverFailed(Lcom/android/ims/internal/IImsCallSession;IILandroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHeld(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHoldFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHoldReceived(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionInviteParticipantsRequestDelivered(Lcom/android/ims/internal/IImsCallSession;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionInviteParticipantsRequestFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMergeComplete(Lcom/android/ims/internal/IImsCallSession;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMergeFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMergeStarted(Lcom/android/ims/internal/IImsCallSession;Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMultipartyStateChanged(Lcom/android/ims/internal/IImsCallSession;Z)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionProgressing(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsStreamMediaProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionResumed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionResumeFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionResumeReceived(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionStarted(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionStartFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionSuppServiceReceived(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsSuppServiceNotification;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionTerminated(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionTtyModeReceived(Lcom/android/ims/internal/IImsCallSession;I)V -Lcom/android/ims/internal/IImsCallSessionListener;->callSessionUpdated(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationAssociatedUriChanged([Landroid/net/Uri;)V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationChangeFailed(ILandroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationConnectedWithRadioTech(I)V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationDisconnected(Landroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationFeatureCapabilityChanged(I[I[I)V -Lcom/android/ims/internal/IImsRegistrationListener;->registrationProgressingWithRadioTech(I)V -Lcom/android/ims/internal/IImsRegistrationListener;->voiceMessageCountUpdate(I)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationCallBarringQueried(Lcom/android/ims/internal/IImsUt;I[Landroid/telephony/ims/ImsSsInfo;)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationCallForwardQueried(Lcom/android/ims/internal/IImsUt;I[Landroid/telephony/ims/ImsCallForwardInfo;)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationCallWaitingQueried(Lcom/android/ims/internal/IImsUt;I[Landroid/telephony/ims/ImsSsInfo;)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationQueried(Lcom/android/ims/internal/IImsUt;ILandroid/os/Bundle;)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationQueryFailed(Lcom/android/ims/internal/IImsUt;ILandroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationUpdated(Lcom/android/ims/internal/IImsUt;I)V -Lcom/android/ims/internal/IImsUtListener;->utConfigurationUpdateFailed(Lcom/android/ims/internal/IImsUt;ILandroid/telephony/ims/ImsReasonInfo;)V -Lcom/android/ims/internal/uce/options/IOptionsListener;->cmdStatus(Lcom/android/ims/internal/uce/options/OptionsCmdStatus;)V -Lcom/android/ims/internal/uce/options/IOptionsListener;->getVersionCb(Ljava/lang/String;)V -Lcom/android/ims/internal/uce/options/IOptionsListener;->incomingOptions(Ljava/lang/String;Lcom/android/ims/internal/uce/options/OptionsCapInfo;I)V -Lcom/android/ims/internal/uce/options/IOptionsListener;->serviceAvailable(Lcom/android/ims/internal/uce/common/StatusCode;)V -Lcom/android/ims/internal/uce/options/IOptionsListener;->serviceUnavailable(Lcom/android/ims/internal/uce/common/StatusCode;)V -Lcom/android/ims/internal/uce/options/IOptionsListener;->sipResponseReceived(Ljava/lang/String;Lcom/android/ims/internal/uce/options/OptionsSipResponse;Lcom/android/ims/internal/uce/options/OptionsCapInfo;)V -Lcom/android/ims/internal/uce/options/IOptionsService$Stub;-><init>()V -Lcom/android/ims/internal/uce/options/IOptionsService;->addListener(ILcom/android/ims/internal/uce/options/IOptionsListener;Lcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->getContactCap(ILjava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->getContactListCap(I[Ljava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->getMyInfo(II)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->getVersion(I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->removeListener(ILcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->responseIncomingOptions(IIILjava/lang/String;Lcom/android/ims/internal/uce/options/OptionsCapInfo;Z)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/options/IOptionsService;->setMyInfo(ILcom/android/ims/internal/uce/common/CapInfo;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceListener;->capInfoReceived(Ljava/lang/String;[Lcom/android/ims/internal/uce/presence/PresTupleInfo;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->cmdStatus(Lcom/android/ims/internal/uce/presence/PresCmdStatus;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->getVersionCb(Ljava/lang/String;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->listCapInfoReceived(Lcom/android/ims/internal/uce/presence/PresRlmiInfo;[Lcom/android/ims/internal/uce/presence/PresResInfo;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->publishTriggering(Lcom/android/ims/internal/uce/presence/PresPublishTriggerType;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->serviceAvailable(Lcom/android/ims/internal/uce/common/StatusCode;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->serviceUnAvailable(Lcom/android/ims/internal/uce/common/StatusCode;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->sipResponseReceived(Lcom/android/ims/internal/uce/presence/PresSipResponse;)V -Lcom/android/ims/internal/uce/presence/IPresenceListener;->unpublishMessageSent()V -Lcom/android/ims/internal/uce/presence/IPresenceService$Stub;-><init>()V -Lcom/android/ims/internal/uce/presence/IPresenceService;->addListener(ILcom/android/ims/internal/uce/presence/IPresenceListener;Lcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->getContactCap(ILjava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->getContactListCap(I[Ljava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->getVersion(I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->publishMyCap(ILcom/android/ims/internal/uce/presence/PresCapInfo;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->reenableService(II)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->removeListener(ILcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/presence/IPresenceService;->setNewFeatureTag(ILjava/lang/String;Lcom/android/ims/internal/uce/presence/PresServiceInfo;I)Lcom/android/ims/internal/uce/common/StatusCode; -Lcom/android/ims/internal/uce/uceservice/IUceListener;->setStatus(I)V -Lcom/android/ims/internal/uce/uceservice/IUceService$Stub;-><init>()V -Lcom/android/ims/internal/uce/uceservice/IUceService;->createOptionsService(Lcom/android/ims/internal/uce/options/IOptionsListener;Lcom/android/ims/internal/uce/common/UceLong;)I -Lcom/android/ims/internal/uce/uceservice/IUceService;->createPresenceService(Lcom/android/ims/internal/uce/presence/IPresenceListener;Lcom/android/ims/internal/uce/common/UceLong;)I -Lcom/android/ims/internal/uce/uceservice/IUceService;->destroyOptionsService(I)V -Lcom/android/ims/internal/uce/uceservice/IUceService;->destroyPresenceService(I)V -Lcom/android/ims/internal/uce/uceservice/IUceService;->getOptionsService()Lcom/android/ims/internal/uce/options/IOptionsService; -Lcom/android/ims/internal/uce/uceservice/IUceService;->getPresenceService()Lcom/android/ims/internal/uce/presence/IPresenceService; -Lcom/android/ims/internal/uce/uceservice/IUceService;->getServiceStatus()Z -Lcom/android/ims/internal/uce/uceservice/IUceService;->isServiceStarted()Z -Lcom/android/ims/internal/uce/uceservice/IUceService;->startService(Lcom/android/ims/internal/uce/uceservice/IUceListener;)Z -Lcom/android/ims/internal/uce/uceservice/IUceService;->stopService()Z -Lcom/android/internal/app/IAppOpsService;->finishOperation(Landroid/os/IBinder;IILjava/lang/String;)V -Lcom/android/internal/content/PackageMonitor;-><init>()V -Lcom/android/internal/location/ILocationProvider$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/location/ILocationProvider; -Lcom/android/internal/location/ILocationProvider;->disable()V -Lcom/android/internal/location/ILocationProvider;->enable()V -Lcom/android/internal/location/ILocationProvider;->getProperties()Lcom/android/internal/location/ProviderProperties; -Lcom/android/internal/location/ILocationProvider;->getStatus(Landroid/os/Bundle;)I -Lcom/android/internal/location/ILocationProvider;->getStatusUpdateTime()J -Lcom/android/internal/location/ILocationProvider;->sendExtraCommand(Ljava/lang/String;Landroid/os/Bundle;)Z -Lcom/android/internal/location/ILocationProvider;->setRequest(Lcom/android/internal/location/ProviderRequest;Landroid/os/WorkSource;)V -Lcom/android/internal/R$styleable;->NumberPicker:[I -Lcom/android/internal/R$styleable;->TwoLineListItem:[I -Lcom/android/internal/telephony/ITelephony;->getDataEnabled(I)Z diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java index 3f1075448c84..719bba0a35af 100644 --- a/core/java/android/app/LoadedApk.java +++ b/core/java/android/app/LoadedApk.java @@ -696,6 +696,23 @@ public final class LoadedApk { return loaders; } + private StrictMode.ThreadPolicy allowThreadDiskReads() { + if (mActivityThread == null) { + // When LoadedApk is used without an ActivityThread (usually in a + // zygote context), don't call into StrictMode, as it initializes + // the binder subsystem, which we don't want. + return null; + } + + return StrictMode.allowThreadDiskReads(); + } + + private void setThreadPolicy(StrictMode.ThreadPolicy policy) { + if (mActivityThread != null && policy != null) { + StrictMode.setThreadPolicy(policy); + } + } + private void createOrUpdateClassLoaderLocked(List<String> addedPaths) { if (mPackageName.equals("android")) { // Note: This branch is taken for system server and we don't need to setup @@ -718,8 +735,11 @@ public final class LoadedApk { // Avoid the binder call when the package is the current application package. // The activity manager will perform ensure that dexopt is performed before - // spinning up the process. - if (!Objects.equals(mPackageName, ActivityThread.currentPackageName()) && mIncludeCode) { + // spinning up the process. Similarly, don't call into binder when we don't + // have an ActivityThread object. + if (mActivityThread != null + && !Objects.equals(mPackageName, ActivityThread.currentPackageName()) + && mIncludeCode) { try { ActivityThread.getPackageManager().notifyPackageUse(mPackageName, PackageManager.NOTIFY_PACKAGE_USE_CROSS_PACKAGE); @@ -790,12 +810,12 @@ public final class LoadedApk { // mIncludeCode == false). if (!mIncludeCode) { if (mDefaultClassLoader == null) { - StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); + StrictMode.ThreadPolicy oldPolicy = allowThreadDiskReads(); mDefaultClassLoader = ApplicationLoaders.getDefault().getClassLoader( "" /* codePath */, mApplicationInfo.targetSdkVersion, isBundledApp, librarySearchPath, libraryPermittedPath, mBaseClassLoader, null /* classLoaderName */); - StrictMode.setThreadPolicy(oldPolicy); + setThreadPolicy(oldPolicy); mAppComponentFactory = AppComponentFactory.DEFAULT; } @@ -822,7 +842,7 @@ public final class LoadedApk { if (mDefaultClassLoader == null) { // Temporarily disable logging of disk reads on the Looper thread // as this is early and necessary. - StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); + StrictMode.ThreadPolicy oldPolicy = allowThreadDiskReads(); List<ClassLoader> sharedLibraries = createSharedLibrariesLoaders( mApplicationInfo.sharedLibraryInfos, isBundledApp, librarySearchPath, @@ -834,18 +854,18 @@ public final class LoadedApk { mApplicationInfo.classLoaderName, sharedLibraries); mAppComponentFactory = createAppFactory(mApplicationInfo, mDefaultClassLoader); - StrictMode.setThreadPolicy(oldPolicy); + setThreadPolicy(oldPolicy); // Setup the class loader paths for profiling. needToSetupJitProfiles = true; } if (!libPaths.isEmpty() && SystemProperties.getBoolean(PROPERTY_NAME_APPEND_NATIVE, true)) { // Temporarily disable logging of disk reads on the Looper thread as this is necessary - StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); + StrictMode.ThreadPolicy oldPolicy = allowThreadDiskReads(); try { ApplicationLoaders.getDefault().addNative(mDefaultClassLoader, libPaths); } finally { - StrictMode.setThreadPolicy(oldPolicy); + setThreadPolicy(oldPolicy); } } @@ -879,11 +899,11 @@ public final class LoadedApk { extraLibPaths.add("/product/lib" + abiSuffix); } if (!extraLibPaths.isEmpty()) { - StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); + StrictMode.ThreadPolicy oldPolicy = allowThreadDiskReads(); try { ApplicationLoaders.getDefault().addNative(mDefaultClassLoader, extraLibPaths); } finally { - StrictMode.setThreadPolicy(oldPolicy); + setThreadPolicy(oldPolicy); } } diff --git a/core/java/android/app/StatsManager.java b/core/java/android/app/StatsManager.java index 32fc0dcebbc8..9dcd1228522b 100644 --- a/core/java/android/app/StatsManager.java +++ b/core/java/android/app/StatsManager.java @@ -119,6 +119,7 @@ public final class StatsManager { /** * @deprecated Use {@link #addConfig(long, byte[])} */ + @Deprecated @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS }) public boolean addConfiguration(long configKey, byte[] config) { try { @@ -154,6 +155,7 @@ public final class StatsManager { /** * @deprecated Use {@link #removeConfig(long)} */ + @Deprecated @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS }) public boolean removeConfiguration(long configKey) { try { @@ -222,6 +224,7 @@ public final class StatsManager { /** * @deprecated Use {@link #setBroadcastSubscriber(PendingIntent, long, long)} */ + @Deprecated @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS }) public boolean setBroadcastSubscriber( long configKey, long subscriberId, PendingIntent pendingIntent) { @@ -275,6 +278,7 @@ public final class StatsManager { /** * @deprecated Use {@link #setFetchReportsOperation(PendingIntent, long)} */ + @Deprecated @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS }) public boolean setDataFetchOperation(long configKey, PendingIntent pendingIntent) { try { @@ -312,6 +316,7 @@ public final class StatsManager { /** * @deprecated Use {@link #getReports(long)} */ + @Deprecated @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS }) public @Nullable byte[] getData(long configKey) { try { @@ -348,6 +353,7 @@ public final class StatsManager { /** * @deprecated Use {@link #getStatsMetadata()} */ + @Deprecated @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS }) public @Nullable byte[] getMetadata() { try { diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index dfe371c3248e..0404e80df9e2 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -59,6 +59,7 @@ import android.hardware.SystemSensorManager; import android.hardware.biometrics.BiometricManager; import android.hardware.biometrics.IBiometricService; import android.hardware.camera2.CameraManager; +import android.hardware.display.ColorDisplayManager; import android.hardware.display.DisplayManager; import android.hardware.face.FaceManager; import android.hardware.face.IFaceService; @@ -386,6 +387,14 @@ final class SystemServiceRegistry { return new DisplayManager(ctx.getOuterContext()); }}); + registerService(Context.COLOR_DISPLAY_SERVICE, ColorDisplayManager.class, + new CachedServiceFetcher<ColorDisplayManager>() { + @Override + public ColorDisplayManager createService(ContextImpl ctx) { + return new ColorDisplayManager(); + } + }); + // InputMethodManager has its own cache strategy based on display id to support apps that // still assume InputMethodManager is a per-process singleton and it's safe to directly // access internal fields via reflection. Hence directly use ServiceFetcher instead of diff --git a/core/java/android/app/WindowConfiguration.java b/core/java/android/app/WindowConfiguration.java index 78b7d48165ec..257122d3abe0 100644 --- a/core/java/android/app/WindowConfiguration.java +++ b/core/java/android/app/WindowConfiguration.java @@ -75,6 +75,9 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu /** The current windowing mode of the configuration. */ private @WindowingMode int mWindowingMode; + /** The display windowing mode of the configuration */ + private @WindowingMode int mDisplayWindowingMode; + /** Windowing mode is currently not defined. */ public static final int WINDOWING_MODE_UNDEFINED = 0; /** Occupies the full area of the screen or the parent container. */ @@ -176,6 +179,10 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu /** Bit that indicates that the {@link #mRotation} changed. * @hide */ public static final int WINDOW_CONFIG_ROTATION = 1 << 5; + /** Bit that indicates that the {@link #mDisplayWindowingMode} changed. + * @hide */ + public static final int WINDOW_CONFIG_DISPLAY_WINDOWING_MODE = 1 << 6; + /** @hide */ @IntDef(flag = true, prefix = { "WINDOW_CONFIG_" }, value = { WINDOW_CONFIG_BOUNDS, @@ -184,6 +191,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu WINDOW_CONFIG_ACTIVITY_TYPE, WINDOW_CONFIG_ALWAYS_ON_TOP, WINDOW_CONFIG_ROTATION, + WINDOW_CONFIG_DISPLAY_WINDOWING_MODE, }) public @interface WindowConfig {} @@ -211,6 +219,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu dest.writeInt(mActivityType); dest.writeInt(mAlwaysOnTop); dest.writeInt(mRotation); + dest.writeInt(mDisplayWindowingMode); } private void readFromParcel(Parcel source) { @@ -220,6 +229,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu mActivityType = source.readInt(); mAlwaysOnTop = source.readInt(); mRotation = source.readInt(); + mDisplayWindowingMode = source.readInt(); } @Override @@ -322,6 +332,12 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu return mWindowingMode; } + /** @hide */ + public void setDisplayWindowingMode(@WindowingMode int windowingMode) { + mDisplayWindowingMode = windowingMode; + } + + public void setActivityType(@ActivityType int activityType) { if (mActivityType == activityType) { return; @@ -351,6 +367,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu setActivityType(other.mActivityType); setAlwaysOnTop(other.mAlwaysOnTop); setRotation(other.mRotation); + setDisplayWindowingMode(other.mDisplayWindowingMode); } /** Set this object to completely undefined. @@ -367,6 +384,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu setActivityType(ACTIVITY_TYPE_UNDEFINED); setAlwaysOnTop(ALWAYS_ON_TOP_UNDEFINED); setRotation(ROTATION_UNDEFINED); + setDisplayWindowingMode(WINDOWING_MODE_UNDEFINED); } /** @@ -407,6 +425,11 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu changed |= WINDOW_CONFIG_ROTATION; setRotation(delta.mRotation); } + if (delta.mDisplayWindowingMode != WINDOWING_MODE_UNDEFINED + && mDisplayWindowingMode != delta.mDisplayWindowingMode) { + changed |= WINDOW_CONFIG_DISPLAY_WINDOWING_MODE; + setDisplayWindowingMode(delta.mDisplayWindowingMode); + } return changed; } @@ -455,6 +478,11 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu changes |= WINDOW_CONFIG_ROTATION; } + if ((compareUndefined || other.mDisplayWindowingMode != WINDOWING_MODE_UNDEFINED) + && mDisplayWindowingMode != other.mDisplayWindowingMode) { + changes |= WINDOW_CONFIG_DISPLAY_WINDOWING_MODE; + } + return changes; } @@ -493,6 +521,8 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu if (n != 0) return n; n = mRotation - that.mRotation; if (n != 0) return n; + n = mDisplayWindowingMode - that.mDisplayWindowingMode; + if (n != 0) return n; // if (n != 0) return n; return n; @@ -522,6 +552,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu result = 31 * result + mActivityType; result = 31 * result + mAlwaysOnTop; result = 31 * result + mRotation; + result = 31 * result + mDisplayWindowingMode; return result; } @@ -531,6 +562,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu return "{ mBounds=" + mBounds + " mAppBounds=" + mAppBounds + " mWindowingMode=" + windowingModeToString(mWindowingMode) + + " mDisplayWindowingMode=" + windowingModeToString(mDisplayWindowingMode) + " mActivityType=" + activityTypeToString(mActivityType) + " mAlwaysOnTop=" + alwaysOnTopToString(mAlwaysOnTop) + " mRotation=" + (mRotation == ROTATION_UNDEFINED @@ -603,7 +635,8 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu * @hide */ public boolean hasWindowDecorCaption() { - return mWindowingMode == WINDOWING_MODE_FREEFORM; + return mActivityType == ACTIVITY_TYPE_STANDARD && (mWindowingMode == WINDOWING_MODE_FREEFORM + || mDisplayWindowingMode == WINDOWING_MODE_FREEFORM); } /** diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 98d2a406fc0c..3a9728413151 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -10092,11 +10092,40 @@ public class DevicePolicyManager { if (mService != null) { try { return mService.isPackageAllowedToAccessCalendarForUser(packageName, - mContext.getUserId()); + myUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } return false; } + + /** + * Gets a set of package names that are whitelisted to access cross profile calendar APIs. + * + * <p>To query for a specific user, use + * {@link Context#createPackageContextAsUser(String, int, UserHandle)} to create a context for + * that user, and get a {@link DevicePolicyManager} from this context. + * + * @return the set of names of packages that were previously whitelisted via + * {@link #addCrossProfileCalendarPackage(ComponentName, String)}, or an + * empty set if none have been whitelisted. + * + * @see #addCrossProfileCalendarPackage(ComponentName, String) + * @see #removeCrossProfileCalendarPackage(ComponentName, String) + * @see #getCrossProfileCalendarPackages(ComponentName) + * @hide + */ + public @NonNull Set<String> getCrossProfileCalendarPackages() { + throwIfParentInstance("getCrossProfileCalendarPackages"); + if (mService != null) { + try { + return new ArraySet<>(mService.getCrossProfileCalendarPackagesForUser( + myUserId())); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + return Collections.emptySet(); + } } diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index 297676d397bf..fcf74ee301d8 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -427,4 +427,5 @@ interface IDevicePolicyManager { boolean removeCrossProfileCalendarPackage(in ComponentName admin, String packageName); List<String> getCrossProfileCalendarPackages(in ComponentName admin); boolean isPackageAllowedToAccessCalendarForUser(String packageName, int userHandle); + List<String> getCrossProfileCalendarPackagesForUser(int userHandle); } diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 68aac642ecb0..fe11acbde0bc 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -3126,6 +3126,7 @@ public abstract class Context { //@hide: HDMI_CONTROL_SERVICE, INPUT_SERVICE, DISPLAY_SERVICE, + //@hide COLOR_DISPLAY_SERVICE, USER_SERVICE, RESTRICTIONS_SERVICE, APP_OPS_SERVICE, @@ -4108,6 +4109,16 @@ public abstract class Context { /** * Use with {@link #getSystemService(String)} to retrieve a + * {@link android.hardware.display.ColorDisplayManager} for controlling color transforms. + * + * @see #getSystemService(String) + * @see android.hardware.display.ColorDisplayManager + * @hide + */ + public static final String COLOR_DISPLAY_SERVICE = "color_display"; + + /** + * Use with {@link #getSystemService(String)} to retrieve a * {@link android.os.UserManager} for managing users on devices that support multiple users. * * @see #getSystemService(String) diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index 7148b124253e..5e402c7edc40 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -393,7 +393,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri * doesn't have any recommendation for this use case or the recommended configurations * are invalid. */ - public RecommendedStreamConfigurationMap getRecommendedStreamConfigurationMap( + public @Nullable RecommendedStreamConfigurationMap getRecommendedStreamConfigurationMap( @RecommendedStreamConfigurationMap.RecommendedUsecase int usecase) { if (((usecase >= RecommendedStreamConfigurationMap.USECASE_PREVIEW) && (usecase <= RecommendedStreamConfigurationMap.USECASE_RAW)) || diff --git a/core/java/android/hardware/camera2/params/RecommendedStreamConfigurationMap.java b/core/java/android/hardware/camera2/params/RecommendedStreamConfigurationMap.java index 59e4a3366995..068c0ce8d052 100644 --- a/core/java/android/hardware/camera2/params/RecommendedStreamConfigurationMap.java +++ b/core/java/android/hardware/camera2/params/RecommendedStreamConfigurationMap.java @@ -17,6 +17,7 @@ package android.hardware.camera2.params; import android.annotation.IntDef; +import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.ImageFormat; @@ -173,7 +174,7 @@ public final class RecommendedStreamConfigurationMap { * * @return Use case id. */ - public int getRecommendedUseCase() { + public @RecommendedUsecase int getRecommendedUseCase() { return mUsecase; } @@ -326,7 +327,7 @@ public final class RecommendedStreamConfigurationMap { * @throws IllegalArgumentException if input size does not exist in the return value of * getHighSpeedVideoSizes */ - public @Nullable Set<Range<Integer>> getHighSpeedVideoFpsRangesFor(Size size) { + public @Nullable Set<Range<Integer>> getHighSpeedVideoFpsRangesFor(@NonNull Size size) { return getUnmodifiableRangeSet(mRecommendedMap.getHighSpeedVideoFpsRangesFor(size)); } @@ -349,14 +350,14 @@ public final class RecommendedStreamConfigurationMap { * For further information refer to {@link StreamConfigurationMap#getHighSpeedVideoSizesFor}. * </p> * - * @param fpsRange one of the FPS range returned by {@link #getHighSpeedVideoFpsRanges()} + * @param fpsRange one of the FPS ranges returned by {@link #getHighSpeedVideoFpsRanges()} * @return A non-modifiable set of video sizes to create high speed capture sessions for high * speed streaming use cases. * * @throws IllegalArgumentException if input FPS range does not exist in the return value of * getHighSpeedVideoFpsRanges */ - public @Nullable Set<Size> getHighSpeedVideoSizesFor(Range<Integer> fpsRange) { + public @Nullable Set<Size> getHighSpeedVideoSizesFor(@NonNull Range<Integer> fpsRange) { return getUnmodifiableSizeSet(mRecommendedMap.getHighSpeedVideoSizesFor(fpsRange)); } @@ -390,10 +391,8 @@ public final class RecommendedStreamConfigurationMap { * 0 if the minimum frame duration is not available. * * @throws IllegalArgumentException if {@code format} or {@code size} was not supported - * @throws NullPointerException if {@code size} was {@code null} - * */ - public long getOutputMinFrameDuration(int format, Size size) { + public @IntRange(from = 0) long getOutputMinFrameDuration(int format, @NonNull Size size) { return mRecommendedMap.getOutputMinFrameDuration(format, size); } @@ -409,9 +408,8 @@ public final class RecommendedStreamConfigurationMap { * @return a stall duration {@code >=} 0 in nanoseconds * * @throws IllegalArgumentException if {@code format} or {@code size} was not supported - * @throws NullPointerException if {@code size} was {@code null} */ - public long getOutputStallDuration(int format, Size size) { + public @IntRange(from = 0) long getOutputStallDuration(int format, @NonNull Size size) { return mRecommendedMap.getOutputStallDuration(format, size); } @@ -422,16 +420,12 @@ public final class RecommendedStreamConfigurationMap { * </p> * * @param klass - * a non-{@code null} {@link Class} object reference + * a {@link Class} object reference * @return * a non-modifiable set of supported sizes for {@link ImageFormat#PRIVATE} format, * or {@code null} if the {@code klass} is not a supported output. - * - * - * @throws NullPointerException if {@code klass} was {@code null} - * */ - public <T> @Nullable Set<Size> getOutputSizes(Class<T> klass) { + public <T> @Nullable Set<Size> getOutputSizes(@NonNull Class<T> klass) { if (mSupportsPrivate) { return getUnmodifiableSizeSet(mRecommendedMap.getOutputSizes(klass)); } @@ -447,16 +441,15 @@ public final class RecommendedStreamConfigurationMap { * {@link StreamConfigurationMap#getOutputMinFrameDuration(Class, Size)}.</p> * * @param klass - * a class which has a non-empty array returned by {@link #getOutputSizes(Class)} + * a class which has a non-empty array returned by {@link #getOutputSizes(Class)} * @param size an output-compatible size * @return a minimum frame duration {@code >} 0 in nanoseconds, or * 0 if the minimum frame duration is not available. * * @throws IllegalArgumentException if {@code klass} or {@code size} was not supported - * @throws NullPointerException if {@code size} or {@code klass} was {@code null} - * */ - public <T> long getOutputMinFrameDuration(final Class<T> klass, final Size size) { + public <T> @IntRange(from = 0) long getOutputMinFrameDuration(@NonNull final Class<T> klass, + @NonNull final Size size) { if (mSupportsPrivate) { return mRecommendedMap.getOutputMinFrameDuration(klass, size); } @@ -473,14 +466,13 @@ public final class RecommendedStreamConfigurationMap { * @param klass * a class which has a non-empty array returned by {@link #getOutputSizes(Class)}. * @param size an output-compatible size - * @return a minimum frame duration {@code >=} 0 in nanoseconds, or 0 if the stall duration is + * @return a minimum frame duration {@code >} 0 in nanoseconds, or 0 if the stall duration is * not available. * * @throws IllegalArgumentException if {@code klass} or {@code size} was not supported - * @throws NullPointerException if {@code size} or {@code klass} was {@code null} - * */ - public <T> long getOutputStallDuration(final Class<T> klass, final Size size) { + public <T> @IntRange(from = 0) long getOutputStallDuration(@NonNull final Class<T> klass, + @NonNull final Size size) { if (mSupportsPrivate) { return mRecommendedMap.getOutputStallDuration(klass, size); } @@ -495,14 +487,13 @@ public final class RecommendedStreamConfigurationMap { * <p>For more information refer to {@link StreamConfigurationMap#isOutputSupportedFor}. * </p> * - * @param surface a non-{@code null} {@link Surface} object reference + * @param surface a {@link Surface} object reference * @return {@code true} if this is supported, {@code false} otherwise * - * @throws NullPointerException if {@code surface} was {@code null} * @throws IllegalArgumentException if the Surface endpoint is no longer valid * */ - public boolean isOutputSupportedFor(Surface surface) { + public boolean isOutputSupportedFor(@NonNull Surface surface) { return mRecommendedMap.isOutputSupportedFor(surface); } diff --git a/core/java/android/hardware/display/ColorDisplayManager.java b/core/java/android/hardware/display/ColorDisplayManager.java index 0a76c2bc724e..a4c1332b45d1 100644 --- a/core/java/android/hardware/display/ColorDisplayManager.java +++ b/core/java/android/hardware/display/ColorDisplayManager.java @@ -16,20 +16,81 @@ package android.hardware.display; +import android.annotation.RequiresPermission; +import android.annotation.SystemService; import android.content.Context; +import android.os.IBinder; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.os.ServiceManager.ServiceNotFoundException; import com.android.internal.R; /** * Manages the display's color transforms and modes. + * * @hide */ +@SystemService(Context.COLOR_DISPLAY_SERVICE) public final class ColorDisplayManager { + private final ColorDisplayManagerInternal mManager; + + /** + * @hide + */ + public ColorDisplayManager() { + mManager = ColorDisplayManagerInternal.getInstance(); + } + + /** + * Returns whether the device has a wide color gamut display. + * + * @hide + */ + @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) + public boolean isDeviceColorManaged() { + return mManager.isDeviceColorManaged(); + } + /** * Returns {@code true} if Night Display is supported by the device. */ public static boolean isNightDisplayAvailable(Context context) { return context.getResources().getBoolean(R.bool.config_nightDisplayAvailable); } + + private static class ColorDisplayManagerInternal { + + private static ColorDisplayManagerInternal sInstance; + + private final IColorDisplayManager mCdm; + + private ColorDisplayManagerInternal(IColorDisplayManager colorDisplayManager) { + mCdm = colorDisplayManager; + } + + public static ColorDisplayManagerInternal getInstance() { + synchronized (ColorDisplayManagerInternal.class) { + if (sInstance == null) { + try { + IBinder b = ServiceManager.getServiceOrThrow(Context.COLOR_DISPLAY_SERVICE); + sInstance = new ColorDisplayManagerInternal( + IColorDisplayManager.Stub.asInterface(b)); + } catch (ServiceNotFoundException e) { + throw new IllegalStateException(e); + } + } + return sInstance; + } + } + + boolean isDeviceColorManaged() { + try { + return mCdm.isDeviceColorManaged(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + } } diff --git a/core/java/android/hardware/display/IColorDisplayManager.aidl b/core/java/android/hardware/display/IColorDisplayManager.aidl new file mode 100644 index 000000000000..f7865899812a --- /dev/null +++ b/core/java/android/hardware/display/IColorDisplayManager.aidl @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.display; + +/** @hide */ +interface IColorDisplayManager { + boolean isDeviceColorManaged(); +}
\ No newline at end of file diff --git a/core/java/android/os/Temperature.java b/core/java/android/os/Temperature.java index 21aba595bd5e..5499181c3cdb 100644 --- a/core/java/android/os/Temperature.java +++ b/core/java/android/os/Temperature.java @@ -44,7 +44,7 @@ public final class Temperature implements Parcelable { THROTTLING_MODERATE, THROTTLING_SEVERE, THROTTLING_CRITICAL, - THROTTLING_WARNING, + THROTTLING_EMERGENCY, THROTTLING_SHUTDOWN, }) @Retention(RetentionPolicy.SOURCE) @@ -56,7 +56,7 @@ public final class Temperature implements Parcelable { public static final int THROTTLING_MODERATE = ThrottlingSeverity.MODERATE; public static final int THROTTLING_SEVERE = ThrottlingSeverity.SEVERE; public static final int THROTTLING_CRITICAL = ThrottlingSeverity.CRITICAL; - public static final int THROTTLING_WARNING = ThrottlingSeverity.WARNING; + public static final int THROTTLING_EMERGENCY = ThrottlingSeverity.EMERGENCY; public static final int THROTTLING_SHUTDOWN = ThrottlingSeverity.SHUTDOWN; @IntDef(prefix = { "TYPE_" }, value = { diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java index 9e26a368ad80..0299e416707a 100644 --- a/core/java/android/provider/MediaStore.java +++ b/core/java/android/provider/MediaStore.java @@ -37,6 +37,7 @@ import android.database.DatabaseUtils; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Point; +import android.media.ExifInterface; import android.net.Uri; import android.os.Bundle; import android.os.CancellationSignal; @@ -1166,13 +1167,25 @@ public final class MediaStore { /** * The latitude where the image was captured. * <P>Type: DOUBLE</P> + * + * @deprecated location details are no longer indexed for privacy + * reasons, and this value is now always {@code null}. + * You can still manually obtain location metadata using + * {@link ExifInterface#getLatLong(float[])}. */ + @Deprecated public static final String LATITUDE = "latitude"; /** * The longitude where the image was captured. * <P>Type: DOUBLE</P> + * + * @deprecated location details are no longer indexed for privacy + * reasons, and this value is now always {@code null}. + * You can still manually obtain location metadata using + * {@link ExifInterface#getLatLong(float[])}. */ + @Deprecated public static final String LONGITUDE = "longitude"; /** @@ -2410,13 +2423,25 @@ public final class MediaStore { /** * The latitude where the video was captured. * <P>Type: DOUBLE</P> + * + * @deprecated location details are no longer indexed for privacy + * reasons, and this value is now always {@code null}. + * You can still manually obtain location metadata using + * {@link ExifInterface#getLatLong(float[])}. */ + @Deprecated public static final String LATITUDE = "latitude"; /** * The longitude where the video was captured. * <P>Type: DOUBLE</P> + * + * @deprecated location details are no longer indexed for privacy + * reasons, and this value is now always {@code null}. + * You can still manually obtain location metadata using + * {@link ExifInterface#getLatLong(float[])}. */ + @Deprecated public static final String LONGITUDE = "longitude"; /** diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index b53d9af5d4e4..74ec0b9c8085 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -12838,6 +12838,23 @@ public final class Settings { "max_sound_trigger_detection_service_ops_per_day"; /** + * Property used by {@code com.android.server.SystemServer} on start to decide whether + * the Smart Suggestions service should be created or not + * + * <p>By default it should *NOT* be set (in which case the decision is based on whether + * the OEM provides an implementation for the service), but it can be overridden to: + * + * <ul> + * <li>Provide a "kill switch" so OEMs can disable it remotely in case of emergency. + * <li>Enable the CTS tests to be run on AOSP builds + * </ul> + * + * @hide + */ + public static final String SMART_SUGGESTIONS_SERVICE_EXPLICITLY_ENABLED = + "smart_suggestions_service_explicitly_enabled"; + + /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. * @@ -13510,6 +13527,13 @@ public final class Settings { */ public static final String WARNING_TEMPERATURE = "warning_temperature"; + + /** + * USB Temperature at which the high temperature alarm notification should be shown. + * @hide + */ + public static final String USB_ALARM_TEMPERATURE = "usb_alarm_temperature"; + /** * Whether the diskstats logging task is enabled/disabled. * @hide diff --git a/core/java/android/view/GestureDetector.java b/core/java/android/view/GestureDetector.java index 3ee5f1fcc883..33b3ff4fef59 100644 --- a/core/java/android/view/GestureDetector.java +++ b/core/java/android/view/GestureDetector.java @@ -18,6 +18,7 @@ package android.view; import android.annotation.UnsupportedAppUsage; import android.content.Context; +import android.os.Build; import android.os.Handler; import android.os.Message; @@ -225,7 +226,7 @@ public class GestureDetector { private int mMinimumFlingVelocity; private int mMaximumFlingVelocity; - @UnsupportedAppUsage + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) private static final int LONGPRESS_TIMEOUT = ViewConfiguration.getLongPressTimeout(); private static final int TAP_TIMEOUT = ViewConfiguration.getTapTimeout(); private static final int DOUBLE_TAP_TIMEOUT = ViewConfiguration.getDoubleTapTimeout(); @@ -592,8 +593,8 @@ public class GestureDetector { if (mIsLongpressEnabled) { mHandler.removeMessages(LONG_PRESS); - mHandler.sendEmptyMessageAtTime(LONG_PRESS, - mCurrentDownEvent.getDownTime() + LONGPRESS_TIMEOUT); + mHandler.sendEmptyMessageAtTime(LONG_PRESS, mCurrentDownEvent.getDownTime() + + ViewConfiguration.getLongPressTimeout()); } mHandler.sendEmptyMessageAtTime(SHOW_PRESS, mCurrentDownEvent.getDownTime() + TAP_TIMEOUT); diff --git a/core/java/com/android/internal/os/BinderCallsStats.java b/core/java/com/android/internal/os/BinderCallsStats.java index 875d7c9ee7a6..a87bbf33ca9e 100644 --- a/core/java/com/android/internal/os/BinderCallsStats.java +++ b/core/java/com/android/internal/os/BinderCallsStats.java @@ -19,6 +19,7 @@ package com.android.internal.os; import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Binder; +import android.os.Process; import android.os.SystemClock; import android.os.UserHandle; import android.text.format.DateFormat; @@ -78,8 +79,10 @@ public class BinderCallsStats implements BinderInternal.Observer { private final Random mRandom; private long mStartTime = System.currentTimeMillis(); private long mCallStatsCount = 0; + private boolean mAddDebugEntries = false; private CachedDeviceState.Readonly mDeviceState; + private CachedDeviceState.TimeInStateStopwatch mBatteryStopwatch; /** Injector for {@link BinderCallsStats}. */ public static class Injector { @@ -93,7 +96,11 @@ public class BinderCallsStats implements BinderInternal.Observer { } public void setDeviceState(@NonNull CachedDeviceState.Readonly deviceState) { + if (mBatteryStopwatch != null) { + mBatteryStopwatch.close(); + } mDeviceState = deviceState; + mBatteryStopwatch = deviceState.createTimeOnBatteryStopwatch(); } @Override @@ -317,9 +324,30 @@ public class BinderCallsStats implements BinderInternal.Observer { exported.methodName = methodName; } + // Debug entries added to help validate the data. + if (mAddDebugEntries && mBatteryStopwatch != null) { + resultCallStats.add(createDebugEntry("start_time_millis", mStartTime)); + resultCallStats.add(createDebugEntry("end_time_millis", System.currentTimeMillis())); + resultCallStats.add( + createDebugEntry("battery_time_millis", mBatteryStopwatch.getMillis())); + } + return resultCallStats; } + private ExportedCallStat createDebugEntry(String variableName, long value) { + final int uid = Process.myUid(); + final ExportedCallStat callStat = new ExportedCallStat(); + callStat.className = ""; + callStat.workSourceUid = uid; + callStat.callingUid = uid; + callStat.recordedCallCount = 1; + callStat.callCount = 1; + callStat.methodName = "__DEBUG_" + variableName; + callStat.maxReplySizeBytes = value; + return callStat; + } + /** @hide */ public ArrayMap<String, Integer> getExportedExceptionStats() { synchronized (mLock) { @@ -341,6 +369,8 @@ public class BinderCallsStats implements BinderInternal.Observer { long totalCpuTime = 0; pw.print("Start time: "); pw.println(DateFormat.format("yyyy-MM-dd HH:mm:ss", mStartTime)); + pw.print("On battery time (ms): "); + pw.println(mBatteryStopwatch != null ? mBatteryStopwatch.getMillis() : 0); pw.println("Sampling interval period: " + mPeriodicSamplingInterval); final List<UidEntry> entries = new ArrayList<>(); @@ -457,6 +487,10 @@ public class BinderCallsStats implements BinderInternal.Observer { } } + public void setAddDebugEntries(boolean addDebugEntries) { + mAddDebugEntries = addDebugEntries; + } + /** * Sets the maximum number of items to track. */ @@ -496,6 +530,9 @@ public class BinderCallsStats implements BinderInternal.Observer { mUidEntries.clear(); mExceptionCounts.clear(); mStartTime = System.currentTimeMillis(); + if (mBatteryStopwatch != null) { + mBatteryStopwatch.reset(); + } } } diff --git a/core/java/com/android/internal/os/CachedDeviceState.java b/core/java/com/android/internal/os/CachedDeviceState.java index 8c90682ec281..334cca317c30 100644 --- a/core/java/com/android/internal/os/CachedDeviceState.java +++ b/core/java/com/android/internal/os/CachedDeviceState.java @@ -16,8 +16,14 @@ package com.android.internal.os; + +import android.os.SystemClock; + +import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; +import java.util.ArrayList; + /** * Stores the device state (e.g. charging/on battery, screen on/off) to be shared with * the System Server telemetry services. @@ -27,6 +33,9 @@ import com.android.internal.annotations.VisibleForTesting; public class CachedDeviceState { private volatile boolean mScreenInteractive; private volatile boolean mCharging; + private final Object mStopwatchesLock = new Object(); + @GuardedBy("mStopwatchLock") + private final ArrayList<TimeInStateStopwatch> mOnBatteryStopwatches = new ArrayList<>(); public CachedDeviceState() { mCharging = true; @@ -44,7 +53,23 @@ public class CachedDeviceState { } public void setCharging(boolean charging) { - mCharging = charging; + if (mCharging != charging) { + mCharging = charging; + updateStopwatches(/* shouldStart= */ !charging); + } + } + + private void updateStopwatches(boolean shouldStart) { + synchronized (mStopwatchesLock) { + final int size = mOnBatteryStopwatches.size(); + for (int i = 0; i < size; i++) { + if (shouldStart) { + mOnBatteryStopwatches.get(i).start(); + } else { + mOnBatteryStopwatches.get(i).stop(); + } + } + } } public Readonly getReadonlyClient() { @@ -62,5 +87,74 @@ public class CachedDeviceState { public boolean isScreenInteractive() { return mScreenInteractive; } + + /** Creates a {@link TimeInStateStopwatch stopwatch} that tracks the time on battery. */ + public TimeInStateStopwatch createTimeOnBatteryStopwatch() { + synchronized (mStopwatchesLock) { + final TimeInStateStopwatch stopwatch = new TimeInStateStopwatch(); + mOnBatteryStopwatches.add(stopwatch); + if (!mCharging) { + stopwatch.start(); + } + return stopwatch; + } + } + } + + /** Tracks the time the device spent in a given state. */ + public class TimeInStateStopwatch implements AutoCloseable { + private final Object mLock = new Object(); + @GuardedBy("mLock") + private long mStartTimeMillis; + @GuardedBy("mLock") + private long mTotalTimeMillis; + + /** Returns the time in state since the last call to {@link TimeInStateStopwatch#reset}. */ + public long getMillis() { + synchronized (mLock) { + return mTotalTimeMillis + elapsedTime(); + } + } + + /** Resets the time in state to 0 without stopping the timer if it's started. */ + public void reset() { + synchronized (mLock) { + mTotalTimeMillis = 0; + mStartTimeMillis = isRunning() ? SystemClock.elapsedRealtime() : 0; + } + } + + private void start() { + synchronized (mLock) { + if (!isRunning()) { + mStartTimeMillis = SystemClock.elapsedRealtime(); + } + } + } + + private void stop() { + synchronized (mLock) { + if (isRunning()) { + mTotalTimeMillis += elapsedTime(); + mStartTimeMillis = 0; + } + } + } + + private long elapsedTime() { + return isRunning() ? SystemClock.elapsedRealtime() - mStartTimeMillis : 0; + } + + @VisibleForTesting + public boolean isRunning() { + return mStartTimeMillis > 0; + } + + @Override + public void close() { + synchronized (mStopwatchesLock) { + mOnBatteryStopwatches.remove(this); + } + } } } diff --git a/core/java/com/android/internal/os/LooperStats.java b/core/java/com/android/internal/os/LooperStats.java index cf2a297bb6a5..de85c1f35a58 100644 --- a/core/java/com/android/internal/os/LooperStats.java +++ b/core/java/com/android/internal/os/LooperStats.java @@ -49,6 +49,7 @@ public class LooperStats implements Looper.Observer { private final int mEntriesSizeCap; private int mSamplingInterval; private CachedDeviceState.Readonly mDeviceState; + private CachedDeviceState.TimeInStateStopwatch mBatteryStopwatch; private long mStartTime = System.currentTimeMillis(); private boolean mAddDebugEntries = false; @@ -58,7 +59,12 @@ public class LooperStats implements Looper.Observer { } public void setDeviceState(@NonNull CachedDeviceState.Readonly deviceState) { + if (mBatteryStopwatch != null) { + mBatteryStopwatch.close(); + } + mDeviceState = deviceState; + mBatteryStopwatch = deviceState.createTimeOnBatteryStopwatch(); } public void setAddDebugEntries(boolean addDebugEntries) { @@ -148,9 +154,11 @@ public class LooperStats implements Looper.Observer { maybeAddSpecialEntry(exportedEntries, mOverflowEntry); maybeAddSpecialEntry(exportedEntries, mHashCollisionEntry); // Debug entries added to help validate the data. - if (mAddDebugEntries) { + if (mAddDebugEntries && mBatteryStopwatch != null) { exportedEntries.add(createDebugEntry("start_time_millis", mStartTime)); exportedEntries.add(createDebugEntry("end_time_millis", System.currentTimeMillis())); + exportedEntries.add( + createDebugEntry("battery_time_millis", mBatteryStopwatch.getMillis())); } return exportedEntries; } @@ -168,6 +176,10 @@ public class LooperStats implements Looper.Observer { return mStartTime; } + public long getBatteryTimeMillis() { + return mBatteryStopwatch != null ? mBatteryStopwatch.getMillis() : 0; + } + private void maybeAddSpecialEntry(List<ExportedEntry> exportedEntries, Entry specialEntry) { synchronized (specialEntry) { if (specialEntry.messageCount > 0 || specialEntry.exceptionCount > 0) { @@ -188,6 +200,9 @@ public class LooperStats implements Looper.Observer { mOverflowEntry.reset(); } mStartTime = System.currentTimeMillis(); + if (mBatteryStopwatch != null) { + mBatteryStopwatch.reset(); + } } public void setSamplingInterval(int samplingInterval) { diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index 600b1b324257..53b56f2e937a 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -29,7 +29,7 @@ oneway interface IStatusBar { void setIcon(String slot, in StatusBarIcon icon); void removeIcon(String slot); - void disable(int state1, int state2); + void disable(int displayId, int state1, int state2); void animateExpandNotificationsPanel(); void animateExpandSettingsPanel(String subPanel); void animateCollapsePanels(); @@ -38,8 +38,9 @@ oneway interface IStatusBar void showWirelessChargingAnimation(int batteryLevel); /** - * Notifies the status bar of a System UI visibility flag change. + * Notifies System UI side of a visibility flag change on the specified display. * + * @param displayId the id of the display to notify * @param vis the visibility flags except SYSTEM_UI_FLAG_LIGHT_STATUS_BAR which will be reported * separately in fullscreenStackVis and dockedStackVis * @param fullscreenStackVis the flags which only apply in the region of the fullscreen stack, @@ -50,13 +51,13 @@ oneway interface IStatusBar * @param fullscreenBounds the current bounds of the fullscreen stack, in screen coordinates * @param dockedBounds the current bounds of the docked stack, in screen coordinates */ - void setSystemUiVisibility(int vis, int fullscreenStackVis, int dockedStackVis, int mask, - in Rect fullscreenBounds, in Rect dockedBounds); + void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis, int dockedStackVis, + int mask, in Rect fullscreenBounds, in Rect dockedBounds); - void topAppWindowChanged(boolean menuVisible); - void setImeWindowStatus(in IBinder token, int vis, int backDisposition, + void topAppWindowChanged(int displayId, boolean menuVisible); + void setImeWindowStatus(int displayId, in IBinder token, int vis, int backDisposition, boolean showImeSwitcher); - void setWindowState(int window, int state); + void setWindowState(int display, int window, int state); void showRecentApps(boolean triggeredFromAltTab); void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey); @@ -70,30 +71,38 @@ oneway interface IStatusBar void toggleKeyboardShortcutsMenu(int deviceId); /** - * Notifies the status bar that an app transition is pending to delay applying some flags with - * visual impact until {@link #appTransitionReady} is called. + * Notifies System UI on the specified display that an app transition is pending to delay + * applying some flags with visual impact until {@link #appTransitionReady} is called. + * + * @param displayId the id of the display to notify */ - void appTransitionPending(); + void appTransitionPending(int displayId); /** - * Notifies the status bar that a pending app transition has been cancelled. + * Notifies System UI on the specified display that a pending app transition has been cancelled. + * + * @param displayId the id of the display to notify */ - void appTransitionCancelled(); + void appTransitionCancelled(int displayId); /** - * Notifies the status bar that an app transition is now being executed. + * Notifies System UI on the specified display that an app transition is now being executed. * + * @param displayId the id of the display to notify * @param statusBarAnimationsStartTime the desired start time for all visual animations in the * status bar caused by this app transition in uptime millis * @param statusBarAnimationsDuration the duration for all visual animations in the status * bar caused by this app transition in millis */ - void appTransitionStarting(long statusBarAnimationsStartTime, long statusBarAnimationsDuration); + void appTransitionStarting(int displayId, long statusBarAnimationsStartTime, + long statusBarAnimationsDuration); /** - * Notifies the status bar that an app transition is done. + * Notifies System UI on the specified display that an app transition is done. + * + * @param displayId the id of the display to notify */ - void appTransitionFinished(); + void appTransitionFinished(int displayId); void showAssistDisclosure(); void startAssist(in Bundle args); diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index bf82dc610ad4..5118e5f0473e 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -41,6 +41,7 @@ interface IStatusBarService void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription); void setIconVisibility(String slot, boolean visible); void removeIcon(String slot); + // TODO(b/117478341): support back button change when IME is showing on a external display. void setImeWindowStatus(in IBinder token, int vis, int backDisposition, boolean showImeSwitcher); void expandSettingsPanel(String subPanel); @@ -69,7 +70,7 @@ interface IStatusBarService void onNotificationSmartRepliesAdded(in String key, in int replyCount); void onNotificationSmartReplySent(in String key, in int replyIndex, in CharSequence reply, boolean generatedByAssistant); void onNotificationSettingsViewed(String key); - void setSystemUiVisibility(int vis, int mask, String cause); + void setSystemUiVisibility(int displayId, int vis, int mask, String cause); void onGlobalActionsShown(); void onGlobalActionsHidden(); diff --git a/core/jni/android/graphics/HarfBuzzNGFaceSkia.cpp b/core/jni/android/graphics/HarfBuzzNGFaceSkia.cpp index dcb787462a13..cfe742d0134d 100644 --- a/core/jni/android/graphics/HarfBuzzNGFaceSkia.cpp +++ b/core/jni/android/graphics/HarfBuzzNGFaceSkia.cpp @@ -59,7 +59,7 @@ struct HarfBuzzFontData { static void SkiaGetGlyphWidthAndExtents(SkPaint* paint, hb_codepoint_t codepoint, hb_position_t* width, hb_glyph_extents_t* extents) { ALOG_ASSERT(codepoint <= 0xFFFF); - paint->setTextEncoding(SkPaint::kGlyphID_TextEncoding); + paint->setTextEncoding(kGlyphID_SkTextEncoding); SkScalar skWidth; SkRect skBounds; @@ -84,7 +84,7 @@ static hb_bool_t harfbuzzGetGlyph(hb_font_t* hbFont, void* fontData, hb_codepoin { HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData); SkPaint* paint = hbFontData->m_paint; - paint->setTextEncoding(SkPaint::kUTF32_TextEncoding); + paint->setTextEncoding(kUTF32_SkTextEncoding); if (unicode > 0x10ffff) { unicode = 0xfffd; diff --git a/core/jni/android/graphics/Paint.cpp b/core/jni/android/graphics/Paint.cpp index a8b0640c3a73..c249e209b29f 100644 --- a/core/jni/android/graphics/Paint.cpp +++ b/core/jni/android/graphics/Paint.cpp @@ -71,7 +71,7 @@ static JMetricsID gFontMetricsInt_fieldID; static void defaultSettingsForAndroid(Paint* paint) { // GlyphID encoding is required because we are using Harfbuzz shaping - paint->setTextEncoding(Paint::kGlyphID_TextEncoding); + paint->setTextEncoding(kGlyphID_SkTextEncoding); } namespace PaintGlue { @@ -321,7 +321,7 @@ namespace PaintGlue { x += MinikinUtils::xOffsetForTextAlign(paint, layout); Paint::Align align = paint->getTextAlign(); paint->setTextAlign(Paint::kLeft_Align); - paint->setTextEncoding(Paint::kGlyphID_TextEncoding); + paint->setTextEncoding(kGlyphID_SkTextEncoding); GetTextFunctor f(layout, path, x, y, paint, glyphs, pos); MinikinUtils::forFontRun(layout, paint, f); paint->setTextAlign(align); diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto index d917536b1715..4c1fc5c89b0d 100644 --- a/core/proto/android/providers/settings/global.proto +++ b/core/proto/android/providers/settings/global.proto @@ -761,6 +761,13 @@ message GlobalSettingsProto { } optional SmartSelection smart_selection = 108; + message SmartSuggestions { + option (android.msg_privacy).dest = DEST_EXPLICIT; + + optional SettingProto service_explicitly_enabled = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; + } + optional SmartSuggestions smart_suggestions = 145; + message Sms { option (android.msg_privacy).dest = DEST_EXPLICIT; @@ -869,6 +876,8 @@ message GlobalSettingsProto { // Temperature at which the high temperature warning notification should // be shown. optional SettingProto warning_temperature_level = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; + // USB temperature at which the high temperature alarm notification should be shown. + optional SettingProto usb_alarm_temperature_level = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; } optional TemperatureWarning temperature_warning = 119; @@ -991,5 +1000,5 @@ message GlobalSettingsProto { // Please insert fields in alphabetical order and group them into messages // if possible (to avoid reaching the method limit). - // Next tag = 145; + // Next tag = 146; } diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index df17b4c453d9..3018614fee61 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -3387,6 +3387,13 @@ <permission android:name="android.permission.CONTROL_DISPLAY_SATURATION" android:protectionLevel="signature|privileged" /> + <!-- Allows an application to control display color transformations. + <p>Not for use by third-party applications.</p> + @hide + @SystemApi --> + <permission android:name="android.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS" + android:protectionLevel="signature|privileged" /> + <!-- Allows an application to collect usage infomation about brightness slider changes. <p>Not for use by third-party applications.</p> @hide diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 0cd6bc5cd700..c62071bdf552 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3350,6 +3350,14 @@ --> <string name="config_defaultTextClassifierPackage" translatable="false"></string> + <!-- The package name for the system's smart suggestion service. + This service must be trusted, as it can be activated without explicit consent of the user. + If no service with the specified name exists on the device, content capture and + smart suggestions will be disabled. + Example: "com.android.intelligence/.SmartSuggestionsService" + --> + <string name="config_defaultSmartSuggestionsService" translatable="false"></string> + <!-- Whether the device uses the default focus highlight when focus state isn't specified. --> <bool name="config_useDefaultFocusHighlight">true</bool> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 01422c8ffd97..6854a84e950a 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3265,6 +3265,7 @@ <java-symbol type="string" name="notification_channel_do_not_disturb" /> <java-symbol type="string" name="config_defaultAutofillService" /> <java-symbol type="string" name="config_defaultTextClassifierPackage" /> + <java-symbol type="string" name="config_defaultSmartSuggestionsService" /> <java-symbol type="string" name="notification_channel_foreground_service" /> <java-symbol type="string" name="foreground_service_app_in_background" /> diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java index a8f9e8a5891b..ed9c3d5b2b70 100644 --- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java +++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java @@ -415,6 +415,7 @@ public class SettingsBackupTest { Settings.Global.SHOW_TEMPERATURE_WARNING, Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL, Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL, + Settings.Global.SMART_SUGGESTIONS_SERVICE_EXPLICITLY_ENABLED, Settings.Global.SMS_ACCESS_RESTRICTION_ENABLED, Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS, Settings.Global.SMS_OUTGOING_CHECK_MAX_COUNT, @@ -477,6 +478,7 @@ public class SettingsBackupTest { Settings.Global.USER_SWITCHER_ENABLED, Settings.Global.NETWORK_ACCESS_TIMEOUT_MS, Settings.Global.WARNING_TEMPERATURE, + Settings.Global.USB_ALARM_TEMPERATURE, Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY, Settings.Global.WEBVIEW_FALLBACK_LOGIC_ENABLED, Settings.Global.WEBVIEW_MULTIPROCESS, diff --git a/core/tests/coretests/src/com/android/internal/os/BinderCallsStatsTest.java b/core/tests/coretests/src/com/android/internal/os/BinderCallsStatsTest.java index 8691e73f82fb..02a76f8f78af 100644 --- a/core/tests/coretests/src/com/android/internal/os/BinderCallsStatsTest.java +++ b/core/tests/coretests/src/com/android/internal/os/BinderCallsStatsTest.java @@ -17,6 +17,7 @@ package com.android.internal.os; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import android.os.Binder; import android.platform.test.annotations.Presubmit; @@ -387,8 +388,7 @@ public class BinderCallsStatsTest { @Test public void testNoDataCollectedBeforeInitialDeviceStateSet() { - TestBinderCallsStats bcs = new TestBinderCallsStats(); - bcs.setDeviceState(null); + TestBinderCallsStats bcs = new TestBinderCallsStats(null); bcs.setDetailedTracking(true); Binder binder = new Binder(); CallSession callSession = bcs.callStarted(binder, 1); @@ -613,6 +613,27 @@ public class BinderCallsStatsTest { assertEquals(CALLING_UID, callStats.callingUid); } + @Test + public void testAddsDebugEntries() { + long startTime = System.currentTimeMillis(); + TestBinderCallsStats bcs = new TestBinderCallsStats(); + bcs.setAddDebugEntries(true); + ArrayList<BinderCallsStats.ExportedCallStat> callStats = bcs.getExportedCallStats(); + assertEquals(3, callStats.size()); + BinderCallsStats.ExportedCallStat debugEntry1 = callStats.get(0); + assertEquals("", debugEntry1.className); + assertEquals("__DEBUG_start_time_millis", debugEntry1.methodName); + assertTrue(startTime <= debugEntry1.maxReplySizeBytes); + BinderCallsStats.ExportedCallStat debugEntry2 = callStats.get(1); + assertEquals("", debugEntry2.className); + assertEquals("__DEBUG_end_time_millis", debugEntry2.methodName); + assertTrue(debugEntry1.maxReplySizeBytes <= debugEntry2.maxReplySizeBytes); + BinderCallsStats.ExportedCallStat debugEntry3 = callStats.get(2); + assertEquals("", debugEntry3.className); + assertEquals("__DEBUG_battery_time_millis", debugEntry3.methodName); + assertTrue(debugEntry3.maxReplySizeBytes >= 0); + } + class TestBinderCallsStats extends BinderCallsStats { public int callingUid = CALLING_UID; public int workSourceUid = WORKSOURCE_UID; @@ -620,6 +641,10 @@ public class BinderCallsStatsTest { public long elapsedTime = 0; TestBinderCallsStats() { + this(mDeviceState); + } + + TestBinderCallsStats(CachedDeviceState deviceState) { // Make random generator not random. super(new Injector() { public Random getRandomGenerator() { @@ -633,7 +658,10 @@ public class BinderCallsStatsTest { } }); setSamplingInterval(1); - setDeviceState(mDeviceState.getReadonlyClient()); + setAddDebugEntries(false); + if (deviceState != null) { + setDeviceState(deviceState.getReadonlyClient()); + } } @Override diff --git a/core/tests/coretests/src/com/android/internal/os/LooperStatsTest.java b/core/tests/coretests/src/com/android/internal/os/LooperStatsTest.java index 31dde5c79f27..3d7801cbb531 100644 --- a/core/tests/coretests/src/com/android/internal/os/LooperStatsTest.java +++ b/core/tests/coretests/src/com/android/internal/os/LooperStatsTest.java @@ -273,8 +273,7 @@ public final class LooperStatsTest { @Test public void testDataNotCollectedBeforeDeviceStateSet() { - TestableLooperStats looperStats = new TestableLooperStats(1, 100); - looperStats.setDeviceState(null); + TestableLooperStats looperStats = new TestableLooperStats(1, 100, null); Object token1 = looperStats.messageDispatchStarting(); looperStats.messageDispatched(token1, mHandlerFirst.obtainMessage(1000)); @@ -439,7 +438,7 @@ public final class LooperStatsTest { looperStats.messageDispatched(token, message); List<LooperStats.ExportedEntry> entries = looperStats.getEntries(); - assertThat(entries).hasSize(3); + assertThat(entries).hasSize(4); LooperStats.ExportedEntry debugEntry1 = entries.get(1); assertThat(debugEntry1.handlerClassName).isEqualTo(""); assertThat(debugEntry1.messageName).isEqualTo("__DEBUG_start_time_millis"); @@ -448,6 +447,10 @@ public final class LooperStatsTest { assertThat(debugEntry2.handlerClassName).isEqualTo(""); assertThat(debugEntry2.messageName).isEqualTo("__DEBUG_end_time_millis"); assertThat(debugEntry2.maxDelayMillis).isAtLeast(looperStats.getStartTimeMillis()); + LooperStats.ExportedEntry debugEntry3 = entries.get(3); + assertThat(debugEntry3.handlerClassName).isEqualTo(""); + assertThat(debugEntry3.messageName).isEqualTo("__DEBUG_battery_time_millis"); + assertThat(debugEntry3.maxDelayMillis).isAtLeast(0L); } private static void assertThrows(Class<? extends Exception> exceptionClass, Runnable r) { @@ -468,10 +471,16 @@ public final class LooperStatsTest { private int mSamplingInterval; TestableLooperStats(int samplingInterval, int sizeCap) { + this(samplingInterval, sizeCap, mDeviceState); + } + + TestableLooperStats(int samplingInterval, int sizeCap, CachedDeviceState deviceState) { super(samplingInterval, sizeCap); - this.mSamplingInterval = samplingInterval; - this.setDeviceState(mDeviceState.getReadonlyClient()); - this.setAddDebugEntries(false); + mSamplingInterval = samplingInterval; + setAddDebugEntries(false); + if (deviceState != null) { + setDeviceState(deviceState.getReadonlyClient()); + } } void tickRealtime(long micros) { diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml index 9e4ea32ed605..f2373446924a 100644 --- a/data/etc/privapp-permissions-platform.xml +++ b/data/etc/privapp-permissions-platform.xml @@ -281,6 +281,7 @@ applications that come with the platform <permission name="android.permission.WRITE_APN_SETTINGS"/> <permission name="android.permission.WRITE_MEDIA_STORAGE"/> <permission name="android.permission.WRITE_SECURE_SETTINGS"/> + <permission name="android.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS" /> </privapp-permissions> <privapp-permissions package="com.android.settings.intelligence"> @@ -408,6 +409,7 @@ applications that come with the platform <permission name="android.permission.WRITE_MEDIA_STORAGE"/> <permission name="android.permission.WRITE_SECURE_SETTINGS"/> <permission name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"/> + <permission name="android.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS" /> </privapp-permissions> <privapp-permissions package="com.android.tv"> diff --git a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java index dea2f45e9d33..cb12a7c6ba6b 100644 --- a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java +++ b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java @@ -19,6 +19,7 @@ package android.graphics.drawable; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.TestApi; +import android.app.ActivityThread; import android.content.pm.ActivityInfo.Config; import android.content.res.ColorStateList; import android.content.res.Resources; @@ -150,11 +151,14 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback */ AdaptiveIconDrawable(@Nullable LayerState state, @Nullable Resources res) { mLayerState = createConstantState(state, res); - - if (sMask == null) { - sMask = PathParser.createPathFromPathData( - Resources.getSystem().getString(R.string.config_icon_mask)); - } + // config_icon_mask from context bound resource may have been chaged using + // OverlayManager. Read that one first. + Resources r = ActivityThread.currentActivityThread() == null + ? Resources.getSystem() + : ActivityThread.currentActivityThread().getApplication().getResources(); + // TODO: either make sMask update only when config_icon_mask changes OR + // get rid of it all-together in layoutlib + sMask = PathParser.createPathFromPathData(r.getString(R.string.config_icon_mask)); mMask = new Path(sMask); mMaskScaleOnly = new Path(mMask); mMaskMatrix = new Matrix(); diff --git a/libs/androidfw/LoadedArsc.cpp b/libs/androidfw/LoadedArsc.cpp index 68d216d286cf..c20c720eadbb 100644 --- a/libs/androidfw/LoadedArsc.cpp +++ b/libs/androidfw/LoadedArsc.cpp @@ -583,7 +583,65 @@ std::unique_ptr<const LoadedPackage> LoadedPackage::Load(const Chunk& chunk, loaded_package->dynamic_package_map_.emplace_back(std::move(package_name), dtohl(entry_iter->packageId)); } + } break; + + case RES_TABLE_OVERLAYABLE_TYPE: { + const ResTable_overlayable_header* header = + child_chunk.header<ResTable_overlayable_header>(); + if (header == nullptr) { + LOG(ERROR) << "RES_TABLE_OVERLAYABLE_TYPE too small."; + return {}; + } + + // Iterate over the overlayable policy chunks + ChunkIterator overlayable_iter(child_chunk.data_ptr(), child_chunk.data_size()); + while (overlayable_iter.HasNext()) { + const Chunk overlayable_child_chunk = overlayable_iter.Next(); + + switch (overlayable_child_chunk.type()) { + case RES_TABLE_OVERLAYABLE_POLICY_TYPE: { + const ResTable_overlayable_policy_header* policy_header = + overlayable_child_chunk.header<ResTable_overlayable_policy_header>(); + if (policy_header == nullptr) { + LOG(ERROR) << "RES_TABLE_OVERLAYABLE_POLICY_TYPE too small."; + return {}; + } + + if ((overlayable_child_chunk.data_size() / sizeof(ResTable_ref)) + < dtohl(policy_header->entry_count)) { + LOG(ERROR) << "RES_TABLE_OVERLAYABLE_POLICY_TYPE too small to hold entries."; + return {}; + } + + // Retrieve all the ids belonging to this policy + std::unordered_set<uint32_t> ids; + const auto ids_begin = + reinterpret_cast<const ResTable_ref*>(overlayable_child_chunk.data_ptr()); + const auto ids_end = ids_begin + dtohl(policy_header->entry_count); + for (auto id_iter = ids_begin; id_iter != ids_end; ++id_iter) { + ids.insert(dtohl(id_iter->ident)); + } + + // Add the pairing of overlayable properties to resource ids to the package + OverlayableInfo overlayable_info; + overlayable_info.policy_flags = policy_header->policy_flags; + loaded_package->overlayable_infos_.push_back(std::make_pair(overlayable_info, ids)); + break; + } + + default: + LOG(WARNING) << StringPrintf("Unknown chunk type '%02x'.", chunk.type()); + break; + } + } + if (overlayable_iter.HadError()) { + LOG(ERROR) << StringPrintf("Error parsing RES_TABLE_OVERLAYABLE_POLICY_TYPE: %s", + overlayable_iter.GetLastError().c_str()); + if (overlayable_iter.HadFatalError()) { + return {}; + } + } } break; default: diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index 2fe98b00f3a2..63b25270f116 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -7076,7 +7076,7 @@ public: } } - const auto& getTypeMapping() const { + const std::map<uint8_t, std::set<std::pair<uint32_t, uint32_t>>>& getTypeMapping() const { return mTypeMapping->mData; } @@ -7137,9 +7137,6 @@ status_t ResTable::createIdmap(const ResTable& targetResTable, const PackageGroup* packageGroup = mPackageGroups[0]; - // the number of resources overlaid that were not explicitly marked overlayable - size_t forcedOverlayCount = 0u; - // find the resources that exist in both packages auto typeMapping = std::make_unique<IdmapTypeMapping>(); for (size_t typeIndex = 0; typeIndex < packageGroup->types.size(); ++typeIndex) { @@ -7170,11 +7167,6 @@ status_t ResTable::createIdmap(const ResTable& targetResTable, continue; } - if ((dtohl(typeConfigs->typeSpecFlags[entryIndex]) & - ResTable_typeSpec::SPEC_OVERLAYABLE) == 0) { - ++forcedOverlayCount; - } - typeMapping->add(target_resid, overlay_resid); } } @@ -7243,10 +7235,6 @@ status_t ResTable::createIdmap(const ResTable& targetResTable, typeData += entryCount * 2; } - if (forcedOverlayCount > 0) { - ALOGW("idmap: overlaid %zu resources not marked overlayable", forcedOverlayCount); - } - return NO_ERROR; } diff --git a/libs/androidfw/include/androidfw/Chunk.h b/libs/androidfw/include/androidfw/Chunk.h index 99a52dc9244e..a0f23433c676 100644 --- a/libs/androidfw/include/androidfw/Chunk.h +++ b/libs/androidfw/include/androidfw/Chunk.h @@ -89,7 +89,9 @@ class ChunkIterator { len_(len), last_error_(nullptr) { CHECK(next_chunk_ != nullptr) << "data can't be nullptr"; - VerifyNextChunk(); + if (len_ != 0) { + VerifyNextChunk(); + } } Chunk Next(); diff --git a/libs/androidfw/include/androidfw/LoadedArsc.h b/libs/androidfw/include/androidfw/LoadedArsc.h index 349b379778a6..8c5c3b7d3858 100644 --- a/libs/androidfw/include/androidfw/LoadedArsc.h +++ b/libs/androidfw/include/androidfw/LoadedArsc.h @@ -20,6 +20,7 @@ #include <memory> #include <set> #include <vector> +#include <unordered_set> #include "android-base/macros.h" @@ -76,6 +77,10 @@ struct TypeSpec { // TypeSpecPtr is a managed pointer that knows how to delete itself. using TypeSpecPtr = util::unique_cptr<TypeSpec>; +struct OverlayableInfo { + uint32_t policy_flags; +}; + class LoadedPackage { public: class iterator { @@ -216,6 +221,18 @@ class LoadedPackage { } } + // Retrieve the overlayable properties of the specified resource. If the resource is not + // overlayable, this will return a null pointer. + const OverlayableInfo* GetOverlayableInfo(uint32_t resid) const { + for (const std::pair<OverlayableInfo, std::unordered_set<uint32_t>>& overlayable_info_ids + : overlayable_infos_) { + if (overlayable_info_ids.second.find(resid) != overlayable_info_ids.second.end()) { + return &overlayable_info_ids.first; + } + } + return nullptr; + } + private: DISALLOW_COPY_AND_ASSIGN(LoadedPackage); @@ -233,6 +250,7 @@ class LoadedPackage { ByteBucketArray<TypeSpecPtr> type_specs_; ByteBucketArray<uint32_t> resource_ids_; std::vector<DynamicPackageEntry> dynamic_package_map_; + std::vector<const std::pair<OverlayableInfo, std::unordered_set<uint32_t>>> overlayable_infos_; }; // Read-only view into a resource table. This class validates all data diff --git a/libs/androidfw/include/androidfw/ResourceTypes.h b/libs/androidfw/include/androidfw/ResourceTypes.h index ad33fcfa2429..91261aa3e4f9 100644 --- a/libs/androidfw/include/androidfw/ResourceTypes.h +++ b/libs/androidfw/include/androidfw/ResourceTypes.h @@ -234,7 +234,9 @@ enum { RES_TABLE_PACKAGE_TYPE = 0x0200, RES_TABLE_TYPE_TYPE = 0x0201, RES_TABLE_TYPE_SPEC_TYPE = 0x0202, - RES_TABLE_LIBRARY_TYPE = 0x0203 + RES_TABLE_LIBRARY_TYPE = 0x0203, + RES_TABLE_OVERLAYABLE_TYPE = 0x0204, + RES_TABLE_OVERLAYABLE_POLICY_TYPE = 0x0205, }; /** @@ -1354,10 +1356,6 @@ struct ResTable_typeSpec enum : uint32_t { // Additional flag indicating an entry is public. SPEC_PUBLIC = 0x40000000u, - - // Additional flag indicating an entry is overlayable at runtime. - // Added in Android-P. - SPEC_OVERLAYABLE = 0x80000000u, }; }; @@ -1607,6 +1605,49 @@ struct ResTable_lib_entry uint16_t packageName[128]; }; +/** + * Specifies the set of resources that are explicitly allowed to be overlaid by RROs. + */ +struct ResTable_overlayable_header +{ + struct ResChunk_header header; +}; + +/** + * Holds a list of resource ids that are protected from being overlaid by a set of policies. If + * the overlay fulfils at least one of the policies, then the overlay can overlay the list of + * resources. + */ +struct ResTable_overlayable_policy_header +{ + struct ResChunk_header header; + + enum PolicyFlags { + // Any overlay can overlay these resources. + POLICY_PUBLIC = 0x00000001, + + // The overlay must reside of the system partition or must have existed on the system partition + // before an upgrade to overlay these resources. + POLICY_SYSTEM_PARTITION = 0x00000002, + + // The overlay must reside of the vendor partition or must have existed on the vendor partition + // before an upgrade to overlay these resources. + POLICY_VENDOR_PARTITION = 0x00000004, + + // The overlay must reside of the product partition or must have existed on the product + // partition before an upgrade to overlay these resources. + POLICY_PRODUCT_PARTITION = 0x00000008, + + // The overlay must reside of the product services partition or must have existed on the product + // services partition before an upgrade to overlay these resources. + POLICY_PRODUCT_SERVICES_PARTITION = 0x00000010, + }; + uint32_t policy_flags; + + // The number of ResTable_ref that follow this header. + uint32_t entry_count; +}; + struct alignas(uint32_t) Idmap_header { // Always 0x504D4449 ('IDMP') uint32_t magic; diff --git a/libs/androidfw/tests/LoadedArsc_test.cpp b/libs/androidfw/tests/LoadedArsc_test.cpp index ffa48367c252..441356b95d36 100644 --- a/libs/androidfw/tests/LoadedArsc_test.cpp +++ b/libs/androidfw/tests/LoadedArsc_test.cpp @@ -22,12 +22,14 @@ #include "TestHelpers.h" #include "data/basic/R.h" #include "data/libclient/R.h" +#include "data/overlayable/R.h" #include "data/sparse/R.h" #include "data/styles/R.h" namespace app = com::android::app; namespace basic = com::android::basic; namespace libclient = com::android::libclient; +namespace overlayable = com::android::overlayable; namespace sparse = com::android::sparse; using ::android::base::ReadFileToString; @@ -273,10 +275,44 @@ TEST(LoadedArscTest, LoadOverlay) { ASSERT_THAT(LoadedPackage::GetEntry(type_spec->types[0], 0x0000), NotNull()); } -// structs with size fields (like Res_value, ResTable_entry) should be -// backwards and forwards compatible (aka checking the size field against -// sizeof(Res_value) might not be backwards compatible. -TEST(LoadedArscTest, LoadingShouldBeForwardsAndBackwardsCompatible) { ASSERT_TRUE(false); } +TEST(LoadedArscTest, LoadOverlayable) { + std::string contents; + ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/overlayable/overlayable.apk", + "resources.arsc", &contents)); + + std::unique_ptr<const LoadedArsc> loaded_arsc = + LoadedArsc::Load(StringPiece(contents), nullptr /*loaded_idmap*/, false /*system*/, + false /*load_as_shared_library*/); + + ASSERT_THAT(loaded_arsc, NotNull()); + const LoadedPackage* package = loaded_arsc->GetPackageById( + get_package_id(overlayable::R::string::not_overlayable)); + + const OverlayableInfo* info = package->GetOverlayableInfo( + overlayable::R::string::not_overlayable); + ASSERT_THAT(info, IsNull()); + + info = package->GetOverlayableInfo(overlayable::R::string::overlayable1); + ASSERT_THAT(info, NotNull()); + EXPECT_THAT(info->policy_flags, Eq(ResTable_overlayable_policy_header::POLICY_PUBLIC)); + + info = package->GetOverlayableInfo(overlayable::R::string::overlayable2); + ASSERT_THAT(info, NotNull()); + EXPECT_THAT(info->policy_flags, + Eq(ResTable_overlayable_policy_header::POLICY_SYSTEM_PARTITION + | ResTable_overlayable_policy_header::POLICY_PRODUCT_PARTITION)); + + info = package->GetOverlayableInfo(overlayable::R::string::overlayable3); + ASSERT_THAT(info, NotNull()); + EXPECT_THAT(info->policy_flags, + Eq(ResTable_overlayable_policy_header::POLICY_VENDOR_PARTITION + | ResTable_overlayable_policy_header::POLICY_PRODUCT_SERVICES_PARTITION + | ResTable_overlayable_policy_header::POLICY_PRODUCT_PARTITION)); + + info = package->GetOverlayableInfo(overlayable::R::string::overlayable4); + ASSERT_THAT(info, NotNull()); + EXPECT_THAT(info->policy_flags, Eq(ResTable_overlayable_policy_header::POLICY_PUBLIC)); +} TEST(LoadedArscTest, ResourceIdentifierIterator) { std::string contents; @@ -326,4 +362,9 @@ TEST(LoadedArscTest, ResourceIdentifierIterator) { ASSERT_EQ(end, iter); } +// structs with size fields (like Res_value, ResTable_entry) should be +// backwards and forwards compatible (aka checking the size field against +// sizeof(Res_value) might not be backwards compatible. +TEST(LoadedArscTest, LoadingShouldBeForwardsAndBackwardsCompatible) { ASSERT_TRUE(false); } + } // namespace android diff --git a/libs/androidfw/tests/data/overlay/overlay.apk b/libs/androidfw/tests/data/overlay/overlay.apk Binary files differindex 33f961117c44..d37874dcbb40 100644 --- a/libs/androidfw/tests/data/overlay/overlay.apk +++ b/libs/androidfw/tests/data/overlay/overlay.apk diff --git a/libs/androidfw/tests/data/overlayable/AndroidManifest.xml b/libs/androidfw/tests/data/overlayable/AndroidManifest.xml new file mode 100644 index 000000000000..abc2a454e845 --- /dev/null +++ b/libs/androidfw/tests/data/overlayable/AndroidManifest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.overlayable"> + <application> + </application> +</manifest> diff --git a/libs/androidfw/tests/data/overlayable/R.h b/libs/androidfw/tests/data/overlayable/R.h new file mode 100644 index 000000000000..e46e264da318 --- /dev/null +++ b/libs/androidfw/tests/data/overlayable/R.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TESTS_DATA_OVERLAYABLE_R_H_ +#define TESTS_DATA_OVERLAYABLE_R_H_ + +#include <cstdint> + +namespace com { +namespace android { +namespace overlayable { + +struct R { + struct string { + enum : uint32_t { + not_overlayable = 0x7f010000, + overlayable1 = 0x7f010001, + overlayable2 = 0x7f010002, + overlayable3 = 0x7f010003, + overlayable4 = 0x7f010004, + }; + }; +}; + +} // namespace overlayable +} // namespace android +} // namespace com + +#endif /* TESTS_DATA_OVERLAYABLE_R_H_ */ diff --git a/libs/androidfw/tests/data/overlayable/build b/libs/androidfw/tests/data/overlayable/build new file mode 100755 index 000000000000..98fdc5101160 --- /dev/null +++ b/libs/androidfw/tests/data/overlayable/build @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +aapt2 compile --dir res -o compiled.flata +aapt2 link --manifest AndroidManifest.xml -o overlayable.apk compiled.flata +rm compiled.flata diff --git a/libs/androidfw/tests/data/overlayable/overlayable.apk b/libs/androidfw/tests/data/overlayable/overlayable.apk Binary files differnew file mode 100644 index 000000000000..85ab4be7a2e5 --- /dev/null +++ b/libs/androidfw/tests/data/overlayable/overlayable.apk diff --git a/libs/androidfw/tests/data/overlayable/res/values/overlayable.xml b/libs/androidfw/tests/data/overlayable/res/values/overlayable.xml new file mode 100644 index 000000000000..11aa7354901d --- /dev/null +++ b/libs/androidfw/tests/data/overlayable/res/values/overlayable.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> +<overlayable> + <!-- Any overlay can overlay the value of @string/overlayable1 --> + <item type="string" name="overlayable1" /> + + <!-- Any overlay on the product or system partition can overlay the value of + @string/overlayable2 --> + <policy type="product|system"> + <item type="string" name="overlayable2" /> + </policy> + + <!-- Any overlay can overlay the value of @string/overlayable4 --> + <policy type="public"> + <item type="string" name="overlayable4" /> + </policy> +</overlayable> + +<overlayable> + <!-- Any overlay on the product_services, vendor, or product partition can overlay the value of + @string/overlayable3 --> + <policy type="product_services|vendor|product"> + <item type="string" name="overlayable3" /> + </policy> +</overlayable> +</resources>
\ No newline at end of file diff --git a/libs/androidfw/tests/data/overlayable/res/values/public.xml b/libs/androidfw/tests/data/overlayable/res/values/public.xml new file mode 100644 index 000000000000..5676d7cc64c9 --- /dev/null +++ b/libs/androidfw/tests/data/overlayable/res/values/public.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <public type="string" name="not_overlayable" id="0x7f010000" /> + <public type="string" name="overlayable1" id="0x7f010001" /> + <public type="string" name="overlayable2" id="0x7f010002" /> + <public type="string" name="overlayable3" id="0x7f010003" /> + <public type="string" name="overlayable4" id="0x7f010004" /> +</resources>
\ No newline at end of file diff --git a/libs/androidfw/tests/data/overlayable/res/values/values.xml b/libs/androidfw/tests/data/overlayable/res/values/values.xml new file mode 100644 index 000000000000..a86b31282bc9 --- /dev/null +++ b/libs/androidfw/tests/data/overlayable/res/values/values.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <string name="not_overlayable">Not overlayable</string> + <string name="overlayable1">Overlayable One</string> + <string name="overlayable2">Overlayable Two</string> + <string name="overlayable3">Overlayable Three</string> + <string name="overlayable4">Overlayable Four</string> +</resources> diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp index 4a3e10c54cef..8067313b2cb2 100644 --- a/libs/hwui/Properties.cpp +++ b/libs/hwui/Properties.cpp @@ -29,8 +29,6 @@ namespace android { namespace uirenderer { -bool Properties::drawDeferDisabled = false; -bool Properties::drawReorderDisabled = false; bool Properties::debugLayersUpdates = false; bool Properties::debugOverdraw = false; bool Properties::showDirtyRegions = false; @@ -40,7 +38,6 @@ bool Properties::enablePartialUpdates = true; DebugLevel Properties::debugLevel = kDebugDisabled; OverdrawColorSet Properties::overdrawColorSet = OverdrawColorSet::Default; -StencilClipDebug Properties::debugStencilClip = StencilClipDebug::Hide; float Properties::overrideLightRadius = -1.0f; float Properties::overrideLightPosY = -1.0f; @@ -85,7 +82,6 @@ bool Properties::load() { char property[PROPERTY_VALUE_MAX]; bool prevDebugLayersUpdates = debugLayersUpdates; bool prevDebugOverdraw = debugOverdraw; - StencilClipDebug prevDebugStencilClip = debugStencilClip; debugOverdraw = false; if (property_get(PROPERTY_DEBUG_OVERDRAW, property, nullptr) > 0) { @@ -99,20 +95,6 @@ bool Properties::load() { } } - // See Properties.h for valid values - if (property_get(PROPERTY_DEBUG_STENCIL_CLIP, property, nullptr) > 0) { - INIT_LOGD(" Stencil clip debug enabled: %s", property); - if (!strcmp(property, "hide")) { - debugStencilClip = StencilClipDebug::Hide; - } else if (!strcmp(property, "highlight")) { - debugStencilClip = StencilClipDebug::ShowHighlight; - } else if (!strcmp(property, "region")) { - debugStencilClip = StencilClipDebug::ShowRegion; - } - } else { - debugStencilClip = StencilClipDebug::Hide; - } - sProfileType = ProfileType::None; if (property_get(PROPERTY_PROFILE, property, "") > 0) { if (!strcmp(property, PROPERTY_PROFILE_VISUALIZE_BARS)) { @@ -125,12 +107,6 @@ bool Properties::load() { debugLayersUpdates = property_get_bool(PROPERTY_DEBUG_LAYERS_UPDATES, false); INIT_LOGD(" Layers updates debug enabled: %d", debugLayersUpdates); - drawDeferDisabled = property_get_bool(PROPERTY_DISABLE_DRAW_DEFER, false); - INIT_LOGD(" Draw defer %s", drawDeferDisabled ? "disabled" : "enabled"); - - drawReorderDisabled = property_get_bool(PROPERTY_DISABLE_DRAW_REORDER, false); - INIT_LOGD(" Draw reorder %s", drawReorderDisabled ? "disabled" : "enabled"); - showDirtyRegions = property_get_bool(PROPERTY_DEBUG_SHOW_DIRTY_REGIONS, false); debugLevel = (DebugLevel)property_get_int(PROPERTY_DEBUG, kDebugDisabled); @@ -152,8 +128,7 @@ bool Properties::load() { enableForceDarkSupport = property_get_bool(PROPERTY_ENABLE_FORCE_DARK, true); - return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw) || - (prevDebugStencilClip != debugStencilClip); + return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw); } void Properties::overrideProperty(const char* name, const char* value) { diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h index da53f6657ff7..0a7f4e7eb41c 100644 --- a/libs/hwui/Properties.h +++ b/libs/hwui/Properties.h @@ -95,20 +95,6 @@ enum DebugLevel { #define PROPERTY_PROFILE_VISUALIZE_BARS "visual_bars" /** - * Used to enable/disable non-rectangular clipping debugging. - * - * The accepted values are: - * "highlight", drawing commands clipped by the stencil will - * be colored differently - * "region", renders the clipping region on screen whenever - * the stencil is set - * "hide", don't show the clip - * - * The default value is "hide". - */ -#define PROPERTY_DEBUG_STENCIL_CLIP "debug.hwui.show_non_rect_clip" - -/** * Turn on to draw dirty regions every other frame. * * Possible values: @@ -118,19 +104,6 @@ enum DebugLevel { #define PROPERTY_DEBUG_SHOW_DIRTY_REGIONS "debug.hwui.show_dirty_regions" /** - * Disables draw operation deferral if set to "true", forcing draw - * commands to be issued to OpenGL in order, and processed in sequence - * with state-manipulation canvas commands. - */ -#define PROPERTY_DISABLE_DRAW_DEFER "debug.hwui.disable_draw_defer" - -/** - * Used to disable draw operation reordering when deferring draw operations - * Has no effect if PROPERTY_DISABLE_DRAW_DEFER is set to "true" - */ -#define PROPERTY_DISABLE_DRAW_REORDER "debug.hwui.disable_draw_reorder" - -/** * Setting this property will enable or disable the dropping of frames with * empty damage. Default is "true". */ @@ -207,8 +180,6 @@ enum class ProfileType { None, Console, Bars }; enum class OverdrawColorSet { Default = 0, Deuteranomaly }; -enum class StencilClipDebug { Hide, ShowHighlight, ShowRegion }; - enum class RenderPipelineType { SkiaGL, SkiaVulkan, NotInitialized = 128 }; /** @@ -220,8 +191,6 @@ class Properties { public: static bool load(); - static bool drawDeferDisabled; - static bool drawReorderDisabled; static bool debugLayersUpdates; static bool debugOverdraw; static bool showDirtyRegions; @@ -235,7 +204,6 @@ public: static DebugLevel debugLevel; static OverdrawColorSet overdrawColorSet; - static StencilClipDebug debugStencilClip; // Override the value for a subset of properties in this class static void overrideProperty(const char* name, const char* value); diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp index ba343841d760..6be7ef72cf5d 100644 --- a/libs/hwui/SkiaCanvas.cpp +++ b/libs/hwui/SkiaCanvas.cpp @@ -681,7 +681,7 @@ void SkiaCanvas::drawGlyphs(ReadGlyphFunc glyphFunc, int count, const SkPaint& p if (mPaintFilter) { mPaintFilter->filter(&paintCopy); } - SkASSERT(paintCopy.getTextEncoding() == SkPaint::kGlyphID_TextEncoding); + SkASSERT(paintCopy.getTextEncoding() == kGlyphID_SkTextEncoding); // Stroke with a hairline is drawn on HW with a fill style for compatibility with Android O and // older. if (!mCanvasOwned && sApiLevel <= 27 && paintCopy.getStrokeWidth() <= 0 && @@ -708,7 +708,7 @@ void SkiaCanvas::drawLayoutOnPath(const minikin::Layout& layout, float hOffset, if (mPaintFilter) { mPaintFilter->filter(&paintCopy); } - SkASSERT(paintCopy.getTextEncoding() == SkPaint::kGlyphID_TextEncoding); + SkASSERT(paintCopy.getTextEncoding() == kGlyphID_SkTextEncoding); const int N = end - start; SkAutoSTMalloc<1024, uint8_t> storage(N * (sizeof(uint16_t) + sizeof(SkRSXform))); diff --git a/libs/hwui/hwui/MinikinSkia.cpp b/libs/hwui/hwui/MinikinSkia.cpp index 769fce498a70..84292c8768c1 100644 --- a/libs/hwui/hwui/MinikinSkia.cpp +++ b/libs/hwui/hwui/MinikinSkia.cpp @@ -43,7 +43,7 @@ MinikinFontSkia::MinikinFontSkia(sk_sp<SkTypeface> typeface, const void* fontDat static void MinikinFontSkia_SetSkiaPaint(const minikin::MinikinFont* font, SkPaint* skPaint, const minikin::MinikinPaint& paint, const minikin::FontFakery& fakery) { - skPaint->setTextEncoding(SkPaint::kGlyphID_TextEncoding); + skPaint->setTextEncoding(kGlyphID_SkTextEncoding); skPaint->setTextSize(paint.size); skPaint->setTextScaleX(paint.scaleX); skPaint->setTextSkewX(paint.skewX); diff --git a/libs/hwui/tests/common/TestUtils.cpp b/libs/hwui/tests/common/TestUtils.cpp index 8a1bc4d2f7f2..f81202292a49 100644 --- a/libs/hwui/tests/common/TestUtils.cpp +++ b/libs/hwui/tests/common/TestUtils.cpp @@ -81,7 +81,7 @@ void TestUtils::drawUtf8ToCanvas(Canvas* canvas, const char* text, const SkPaint auto utf16 = asciiToUtf16(text); uint32_t length = strlen(text); SkPaint glyphPaint(paint); - glyphPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); + glyphPaint.setTextEncoding(kGlyphID_SkTextEncoding); canvas->drawText( utf16.get(), length, // text buffer 0, length, // draw range @@ -94,7 +94,7 @@ void TestUtils::drawUtf8ToCanvas(Canvas* canvas, const char* text, const SkPaint const SkPath& path) { auto utf16 = asciiToUtf16(text); SkPaint glyphPaint(paint); - glyphPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); + glyphPaint.setTextEncoding(kGlyphID_SkTextEncoding); canvas->drawTextOnPath(utf16.get(), strlen(text), minikin::Bidi::LTR, path, 0, 0, glyphPaint, nullptr); } diff --git a/media/OWNERS b/media/OWNERS index 0abf9aeb6101..03b751c07c6c 100644 --- a/media/OWNERS +++ b/media/OWNERS @@ -1,12 +1,13 @@ +chz@google.com +dwkang@google.com elaurent@google.com etalvala@google.com gkasten@google.com hunga@google.com +jaewan@google.com jmtrivi@google.com +jsharkey@android.com lajos@google.com marcone@google.com sungsoo@google.com wjia@google.com -jaewan@google.com -chz@google.com -dwkang@google.com diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java index 3d13c5f72f55..b7743c9db4c0 100644 --- a/media/java/android/media/MediaFormat.java +++ b/media/java/android/media/MediaFormat.java @@ -1045,11 +1045,11 @@ public final class MediaFormat { /** * Returns the value of a numeric key. This is provided as a convenience method for keys - * that may take multiple numeric types, such as {@link KEY_FRAME_RATE}, or {@link - * KEY_I_FRAME_INTERVAL}. + * that may take multiple numeric types, such as {@link #KEY_FRAME_RATE}, or {@link + * #KEY_I_FRAME_INTERVAL}. * * @return null if the key does not exist or the stored value for the key is null - * @throw ClassCastException if the stored value for the key is ByteBuffer or String + * @throws ClassCastException if the stored value for the key is ByteBuffer or String */ public final @Nullable Number getNumber(@NonNull String name) { return ((Number)mMap.get(name)); @@ -1059,7 +1059,7 @@ public final class MediaFormat { * Returns the value of a numeric key, or the default value if the key is missing. * * @return defaultValue if the key does not exist or the stored value for the key is null - * @throw ClassCastException if the stored value for the key is ByteBuffer or String + * @throws ClassCastException if the stored value for the key is ByteBuffer or String */ public final @NonNull Number getNumber(@NonNull String name, @NonNull Number defaultValue) { Number ret = getNumber(name); @@ -1069,9 +1069,10 @@ public final class MediaFormat { /** * Returns the value of an integer key. * - * @throw NullPointerException if the key does not exist or the stored value for the key is null - * @throw ClassCastException if the stored value for the key is long, float, ByteBuffer or - * String + * @throws NullPointerException if the key does not exist or the stored value for the key is + * null + * @throws ClassCastException if the stored value for the key is long, float, ByteBuffer or + * String */ public final int getInteger(@NonNull String name) { return ((Integer)mMap.get(name)).intValue(); @@ -1081,8 +1082,8 @@ public final class MediaFormat { * Returns the value of an integer key, or the default value if the key is missing. * * @return defaultValue if the key does not exist or the stored value for the key is null - * @throw ClassCastException if the stored value for the key is long, float, ByteBuffer or - * String + * @throws ClassCastException if the stored value for the key is long, float, ByteBuffer or + * String */ public final int getInteger(@NonNull String name, int defaultValue) { try { @@ -1096,9 +1097,10 @@ public final class MediaFormat { /** * Returns the value of a long key. * - * @throw NullPointerException if the key does not exist or the stored value for the key is null - * @throw ClassCastException if the stored value for the key is int, float, ByteBuffer or - * String + * @throws NullPointerException if the key does not exist or the stored value for the key is + * null + * @throws ClassCastException if the stored value for the key is int, float, ByteBuffer or + * String */ public final long getLong(@NonNull String name) { return ((Long)mMap.get(name)).longValue(); @@ -1108,8 +1110,8 @@ public final class MediaFormat { * Returns the value of an long key, or the default value if the key is missing. * * @return defaultValue if the key does not exist or the stored value for the key is null - * @throw ClassCastException if the stored value for the key is int, float, ByteBuffer or - * String + * @throws ClassCastException if the stored value for the key is int, float, ByteBuffer or + * String */ public final long getLong(@NonNull String name, long defaultValue) { try { @@ -1123,9 +1125,10 @@ public final class MediaFormat { /** * Returns the value of a float key. * - * @throw NullPointerException if the key does not exist or the stored value for the key is null - * @throw ClassCastException if the stored value for the key is int, long, ByteBuffer or - * String + * @throws NullPointerException if the key does not exist or the stored value for the key is + * null + * @throws ClassCastException if the stored value for the key is int, long, ByteBuffer or + * String */ public final float getFloat(@NonNull String name) { return ((Float)mMap.get(name)).floatValue(); @@ -1135,8 +1138,8 @@ public final class MediaFormat { * Returns the value of an float key, or the default value if the key is missing. * * @return defaultValue if the key does not exist or the stored value for the key is null - * @throw ClassCastException if the stored value for the key is int, long, ByteBuffer or - * String + * @throws ClassCastException if the stored value for the key is int, long, ByteBuffer or + * String */ public final float getFloat(@NonNull String name, float defaultValue) { try { @@ -1151,7 +1154,7 @@ public final class MediaFormat { * Returns the value of a string key. * * @return null if the key does not exist or the stored value for the key is null - * @throw ClassCastException if the stored value for the key is int, long, float or ByteBuffer + * @throws ClassCastException if the stored value for the key is int, long, float or ByteBuffer */ public final @Nullable String getString(@NonNull String name) { return (String)mMap.get(name); @@ -1161,7 +1164,7 @@ public final class MediaFormat { * Returns the value of an string key, or the default value if the key is missing. * * @return defaultValue if the key does not exist or the stored value for the key is null - * @throw ClassCastException if the stored value for the key is int, long, float or ByteBuffer + * @throws ClassCastException if the stored value for the key is int, long, float or ByteBuffer */ public final @NonNull String getString(@NonNull String name, @NonNull String defaultValue) { String ret = getString(name); @@ -1172,7 +1175,7 @@ public final class MediaFormat { * Returns the value of a ByteBuffer key. * * @return null if the key does not exist or the stored value for the key is null - * @throw ClassCastException if the stored value for the key is int, long, float or String + * @throws ClassCastException if the stored value for the key is int, long, float or String */ public final @Nullable ByteBuffer getByteBuffer(@NonNull String name) { return (ByteBuffer)mMap.get(name); @@ -1182,7 +1185,7 @@ public final class MediaFormat { * Returns the value of a ByteBuffer key, or the default value if the key is missing. * * @return defaultValue if the key does not exist or the stored value for the key is null - * @throw ClassCastException if the stored value for the key is int, long, float or String + * @throws ClassCastException if the stored value for the key is int, long, float or String */ public final @NonNull ByteBuffer getByteBuffer( @NonNull String name, @NonNull ByteBuffer defaultValue) { @@ -1197,7 +1200,7 @@ public final class MediaFormat { * @param feature the name of a {@link MediaCodecInfo.CodecCapabilities} feature. * * @throws IllegalArgumentException if the feature was neither set to be enabled - * nor to be disabled. + * nor to be disabled. */ public boolean getFeatureEnabled(@NonNull String feature) { Integer enabled = (Integer)mMap.get(KEY_FEATURE_ + feature); diff --git a/media/java/android/media/MediaPlayer2.java b/media/java/android/media/MediaPlayer2.java index a10b2123a70c..4b99a130d7fa 100644 --- a/media/java/android/media/MediaPlayer2.java +++ b/media/java/android/media/MediaPlayer2.java @@ -3501,7 +3501,7 @@ public class MediaPlayer2 implements AutoCloseable } } - private native void native_releaseDrm(); + private native void native_releaseDrm(long mSrcId); /** * A key request/response exchange occurs between the app and a license server @@ -3821,7 +3821,8 @@ public class MediaPlayer2 implements AutoCloseable } } - private native void native_prepareDrm(@NonNull byte[] uuid, @NonNull byte[] drmSessionId); + private native void native_prepareDrm( + long srcId, @NonNull byte[] uuid, @NonNull byte[] drmSessionId); // Instantiated from the native side @SuppressWarnings("unused") @@ -4064,6 +4065,7 @@ public class MediaPlayer2 implements AutoCloseable static final int PROVISION_TIMEOUT_MS = 60000; final DataSourceDesc mDSD; + final long mSrcId; //--- guarded by |this| start MediaDrm mDrmObj; @@ -4075,8 +4077,9 @@ public class MediaPlayer2 implements AutoCloseable Future<?> mProvisionResult; //--- guarded by |this| end - DrmHandle(DataSourceDesc dsd) { + DrmHandle(DataSourceDesc dsd, long srcId) { mDSD = dsd; + mSrcId = srcId; } void prepare(UUID uuid) throws UnsupportedSchemeException, @@ -4186,7 +4189,8 @@ public class MediaPlayer2 implements AutoCloseable // Sending it down to native/mediaserver to create the crypto object // This call could simply fail due to bad player state, e.g., after play(). - MediaPlayer2.this.native_prepareDrm(getByteArrayFromUUID(uuid), mDrmSessionId); + final MediaPlayer2 mp2 = MediaPlayer2.this; + mp2.native_prepareDrm(mSrcId, getByteArrayFromUUID(uuid), mDrmSessionId); Log.v(TAG, "prepareDrm_openSessionStep: native_prepareDrm/Crypto succeeded"); } catch (Exception e) { //ResourceBusyException, NotProvisionedException @@ -4367,7 +4371,7 @@ public class MediaPlayer2 implements AutoCloseable // exception if we're in a non-stopped/prepared state. // for cleaning native/mediaserver crypto object - native_releaseDrm(); + native_releaseDrm(mSrcId); // for cleaning client-side MediaDrm object; only called if above has succeeded cleanDrmObj(); @@ -4573,7 +4577,7 @@ public class MediaPlayer2 implements AutoCloseable SourceInfo(DataSourceDesc dsd) { this.mDSD = dsd; - mDrmHandle = new DrmHandle(dsd); + mDrmHandle = new DrmHandle(dsd, mId); } void close() { diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java index 0950a2497866..90cfc534877e 100644 --- a/media/java/android/media/MediaScanner.java +++ b/media/java/android/media/MediaScanner.java @@ -1015,12 +1015,6 @@ public class MediaScanner implements AutoCloseable { // exif is null } if (exif != null) { - float[] latlng = new float[2]; - if (exif.getLatLong(latlng)) { - values.put(Images.Media.LATITUDE, latlng[0]); - values.put(Images.Media.LONGITUDE, latlng[1]); - } - long time = exif.getGpsDateTime(); if (time != -1) { values.put(Images.Media.DATE_TAKEN, time); diff --git a/media/java/android/media/session/MediaSessionManager.java b/media/java/android/media/session/MediaSessionManager.java index 8215779d2b13..d91cf8732674 100644 --- a/media/java/android/media/session/MediaSessionManager.java +++ b/media/java/android/media/session/MediaSessionManager.java @@ -96,9 +96,15 @@ public final class MediaSessionManager { * @return The binder object from the system * @hide */ + @SystemApi public @NonNull ISession createSession(@NonNull MediaSession.CallbackStub cbStub, - @NonNull String tag, int userId) throws RemoteException { - return mService.createSession(mContext.getPackageName(), cbStub, tag, userId); + @NonNull String tag, int userId) { + try { + return mService.createSession(mContext.getPackageName(), cbStub, tag, userId); + } catch (RemoteException e) { + e.rethrowFromSystemServer(); + } + return null; } /** diff --git a/media/jni/android_media_MediaPlayer2.cpp b/media/jni/android_media_MediaPlayer2.cpp index 456749279696..8b6009e749ce 100644 --- a/media/jni/android_media_MediaPlayer2.cpp +++ b/media/jni/android_media_MediaPlayer2.cpp @@ -1192,7 +1192,7 @@ static Vector<uint8_t> JByteArrayToVector(JNIEnv *env, jbyteArray const &byteArr } static void android_media_MediaPlayer2_prepareDrm(JNIEnv *env, jobject thiz, - jbyteArray uuidObj, jbyteArray drmSessionIdObj) + jlong srcId, jbyteArray uuidObj, jbyteArray drmSessionIdObj) { sp<MediaPlayer2> mp = getMediaPlayer(env, thiz); if (mp == NULL) { @@ -1225,7 +1225,7 @@ static void android_media_MediaPlayer2_prepareDrm(JNIEnv *env, jobject thiz, return; } - status_t err = mp->prepareDrm(uuid.array(), drmSessionId); + status_t err = mp->prepareDrm(srcId, uuid.array(), drmSessionId); if (err != OK) { if (err == INVALID_OPERATION) { jniThrowException( @@ -1243,7 +1243,7 @@ static void android_media_MediaPlayer2_prepareDrm(JNIEnv *env, jobject thiz, } } -static void android_media_MediaPlayer2_releaseDrm(JNIEnv *env, jobject thiz) +static void android_media_MediaPlayer2_releaseDrm(JNIEnv *env, jobject thiz, jlong srcId) { sp<MediaPlayer2> mp = getMediaPlayer(env, thiz); if (mp == NULL ) { @@ -1251,7 +1251,7 @@ static void android_media_MediaPlayer2_releaseDrm(JNIEnv *env, jobject thiz) return; } - status_t err = mp->releaseDrm(); + status_t err = mp->releaseDrm(srcId); if (err != OK) { if (err == INVALID_OPERATION) { jniThrowException( @@ -1425,8 +1425,8 @@ static const JNINativeMethod gMethods[] = { {"native_setAuxEffectSendLevel", "(F)V", (void *)android_media_MediaPlayer2_setAuxEffectSendLevel}, {"native_attachAuxEffect", "(I)V", (void *)android_media_MediaPlayer2_attachAuxEffect}, // Modular DRM - { "native_prepareDrm", "([B[B)V", (void *)android_media_MediaPlayer2_prepareDrm }, - { "native_releaseDrm", "()V", (void *)android_media_MediaPlayer2_releaseDrm }, + { "native_prepareDrm", "(J[B[B)V", (void *)android_media_MediaPlayer2_prepareDrm }, + { "native_releaseDrm", "(J)V", (void *)android_media_MediaPlayer2_releaseDrm }, // AudioRouting {"native_setPreferredDevice", "(Landroid/media/AudioDeviceInfo;)Z", (void *)android_media_MediaPlayer2_setPreferredDevice}, diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java index c9ee5c87de0f..1eb4b7494085 100644 --- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java +++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java @@ -224,7 +224,7 @@ public class ExternalStorageProvider extends FileSystemProvider { root.flags |= Root.FLAG_REMOVABLE_USB; } - if (!VolumeInfo.ID_EMULATED_INTERNAL.equals(volume.getId())) { + if (volume.getType() != VolumeInfo.TYPE_EMULATED) { root.flags |= Root.FLAG_SUPPORTS_EJECT; } diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index 56b768feee23..df5b1467f9d9 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -1165,6 +1165,12 @@ class SettingsProtoDumpUtil { GlobalSettingsProto.SmartSelection.UPDATE_METADATA_URL); p.end(smartSelectToken); + final long smartSuggestionsToken = p.start(GlobalSettingsProto.SMART_SUGGESTIONS); + dumpSetting(s, p, + Settings.Global.SMART_SUGGESTIONS_SERVICE_EXPLICITLY_ENABLED, + GlobalSettingsProto.SmartSuggestions.SERVICE_EXPLICITLY_ENABLED); + p.end(smartSuggestionsToken); + final long smsToken = p.start(GlobalSettingsProto.SMS); dumpSetting(s, p, Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS, @@ -1306,6 +1312,9 @@ class SettingsProtoDumpUtil { dumpSetting(s, p, Settings.Global.WARNING_TEMPERATURE, GlobalSettingsProto.TemperatureWarning.WARNING_TEMPERATURE_LEVEL); + dumpSetting(s, p, + Settings.Global.USB_ALARM_TEMPERATURE, + GlobalSettingsProto.TemperatureWarning.USB_ALARM_TEMPERATURE_LEVEL); p.end(tempWarningToken); final long tetherToken = p.start(GlobalSettingsProto.TETHER); diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index 0b9b27f238d7..7d53c2f78151 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -223,6 +223,9 @@ <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" /> + <!-- Permission to change the display color --> + <uses-permission android:name="android.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS" /> + <protected-broadcast android:name="com.android.settingslib.action.REGISTER_SLICE_RECEIVER" /> <protected-broadcast android:name="com.android.settingslib.action.UNREGISTER_SLICE_RECEIVER" /> <protected-broadcast android:name="com.android.settings.flashlight.action.FLASHLIGHT_CHANGED" /> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index b0a519c00943..8e0bfb65428e 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -881,6 +881,7 @@ <dimen name="smart_reply_button_stroke_width">1dp</dimen> <dimen name="smart_reply_button_font_size">14sp</dimen> <dimen name="smart_reply_button_line_spacing_extra">6sp</dimen> <!-- Total line height 20sp. --> + <dimen name="smart_action_button_icon_size">24dp</dimen> <dimen name="smart_action_button_icon_padding">10dp</dimen> <!-- A reasonable upper bound for the height of the smart reply button. The measuring code diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityCompat.java index 12699d52772a..18dc185c6fbe 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityCompat.java @@ -58,4 +58,8 @@ public class ActivityCompat { encoder.endStream(); return true; } + + public int getDisplayId() { + return mWrapped.getDisplayId(); + } } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java index a90a7d231dc1..ba89fe662a65 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java @@ -140,7 +140,7 @@ public class BiometricDialogImpl extends SystemUI implements CommandQueue.Callba createDialogs(); if (!mDialogs.isEmpty()) { - getComponent(CommandQueue.class).addCallbacks(this); + getComponent(CommandQueue.class).addCallback(this); mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); } } diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java index 2c61da343763..1718cff4e62b 100644 --- a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java +++ b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java @@ -108,7 +108,7 @@ public class FalsingManager implements SensorEventListener { UserHandle.USER_ALL); updateConfiguration(); - Dependency.get(StatusBarStateController.class).addListener(mStateListener); + Dependency.get(StatusBarStateController.class).addCallback(mStateListener); } public static FalsingManager getInstance(Context context) { diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java index aa085626b6c2..e8ef454bd466 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java @@ -45,7 +45,7 @@ public class GlobalActionsComponent extends SystemUI implements Callbacks, Globa .withCallback(this::onExtensionCallback) .build(); mPlugin = mExtension.get(); - SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallbacks(this); + SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallback(this); } private void onExtensionCallback(GlobalActions newPlugin) { diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java index 039499858603..dc11b4c63d83 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java @@ -55,12 +55,12 @@ public class GlobalActionsImpl implements GlobalActions, CommandQueue.Callbacks mContext = context; mKeyguardMonitor = Dependency.get(KeyguardMonitor.class); mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class); - SysUiServiceProvider.getComponent(context, CommandQueue.class).addCallbacks(this); + SysUiServiceProvider.getComponent(context, CommandQueue.class).addCallback(this); } @Override public void destroy() { - SysUiServiceProvider.getComponent(mContext, CommandQueue.class).removeCallbacks(this); + SysUiServiceProvider.getComponent(mContext, CommandQueue.class).removeCallback(this); if (mGlobalActions != null) { mGlobalActions.destroy(); mGlobalActions = null; diff --git a/packages/SystemUI/src/com/android/systemui/pip/PipUI.java b/packages/SystemUI/src/com/android/systemui/pip/PipUI.java index 7792e177b601..37c8163702cf 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/PipUI.java +++ b/packages/SystemUI/src/com/android/systemui/pip/PipUI.java @@ -58,7 +58,7 @@ public class PipUI extends SystemUI implements CommandQueue.Callbacks { : com.android.systemui.pip.phone.PipManager.getInstance(); mPipManager.initialize(mContext); - getComponent(CommandQueue.class).addCallbacks(this); + getComponent(CommandQueue.class).addCallback(this); putComponent(PipUI.class, this); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java index 953eb70cac5d..2acbea45a235 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java @@ -108,12 +108,12 @@ public class QSFragment extends Fragment implements QS, CommandQueue.Callbacks { mQSPanel.getTileLayout().restoreInstanceState(savedInstanceState); } } - SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallbacks(this); + SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallback(this); } @Override public void onDestroyView() { - SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).removeCallbacks(this); + SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).removeCallback(this); super.onDestroyView(); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java index d1c2df53b5a5..ca8e824a223f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java @@ -308,7 +308,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory> { protected static List<String> loadTileSpecs(Context context, String tileList) { final Resources res = context.getResources(); final String defaultTileList = res.getString(R.string.quick_settings_tiles_default); - if (tileList == null) { + if (TextUtils.isEmpty(tileList)) { tileList = res.getString(R.string.quick_settings_tiles); if (DEBUG) Log.d(TAG, "Loaded tile specs from config: " + tileList); } else { diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java index 0702d74506fd..f13b565bd532 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java @@ -37,7 +37,7 @@ public class Recents extends SystemUI implements CommandQueue.Callbacks { @Override public void start() { - getComponent(CommandQueue.class).addCallbacks(this); + getComponent(CommandQueue.class).addCallback(this); putComponent(Recents.class, this); mImpl = createRecentsImplementationFromConfig(); mImpl.onStart(mContext, this); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index 8b9399536969..95019ee2aeea 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -35,6 +35,8 @@ import com.android.internal.os.SomeArgs; import com.android.internal.statusbar.IStatusBar; import com.android.internal.statusbar.StatusBarIcon; import com.android.systemui.SystemUI; +import com.android.systemui.statusbar.CommandQueue.Callbacks; +import com.android.systemui.statusbar.policy.CallbackController; import java.util.ArrayList; @@ -45,7 +47,7 @@ import java.util.ArrayList; * coalescing these calls so they don't stack up. For the calls * are coalesced, note that they are all idempotent. */ -public class CommandQueue extends IStatusBar.Stub { +public class CommandQueue extends IStatusBar.Stub implements CallbackController<Callbacks> { private static final int INDEX_MASK = 0xffff; private static final int MSG_SHIFT = 16; private static final int MSG_MASK = 0xffff << MSG_SHIFT; @@ -183,12 +185,12 @@ public class CommandQueue extends IStatusBar.Stub { && !ONLY_CORE_APPS; } - public void addCallbacks(Callbacks callbacks) { + public void addCallback(Callbacks callbacks) { mCallbacks.add(callbacks); callbacks.disable(mDisable1, mDisable2, false /* animate */); } - public void removeCallbacks(Callbacks callbacks) { + public void removeCallback(Callbacks callbacks) { mCallbacks.remove(callbacks); } @@ -223,7 +225,9 @@ public class CommandQueue extends IStatusBar.Stub { } } - public void disable(int state1, int state2) { + // TODO(b/117478341): Add multi-display support. + @Override + public void disable(int displayId, int state1, int state2) { disable(state1, state2, true); } @@ -266,8 +270,10 @@ public class CommandQueue extends IStatusBar.Stub { } } - public void setSystemUiVisibility(int vis, int fullscreenStackVis, int dockedStackVis, - int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) { + // TODO(b/117478341): Add multi-display support. + @Override + public void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis, + int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) { synchronized (mLock) { // Don't coalesce these, since it might have one time flags set such as // STATUS_BAR_UNHIDE which might get lost. @@ -282,7 +288,9 @@ public class CommandQueue extends IStatusBar.Stub { } } - public void topAppWindowChanged(boolean menuVisible) { + // TODO(b/117478341): Add multi-display support. + @Override + public void topAppWindowChanged(int displayId, boolean menuVisible) { synchronized (mLock) { mHandler.removeMessages(MSG_TOP_APP_WINDOW_CHANGED); mHandler.obtainMessage(MSG_TOP_APP_WINDOW_CHANGED, menuVisible ? 1 : 0, 0, @@ -290,7 +298,9 @@ public class CommandQueue extends IStatusBar.Stub { } } - public void setImeWindowStatus(IBinder token, int vis, int backDisposition, + // TODO(b/117478341): Add multi-display support. + @Override + public void setImeWindowStatus(int displayId, IBinder token, int vis, int backDisposition, boolean showImeSwitcher) { synchronized (mLock) { mHandler.removeMessages(MSG_SHOW_IME_BUTTON); @@ -371,7 +381,9 @@ public class CommandQueue extends IStatusBar.Stub { } } - public void setWindowState(int window, int state) { + // TODO(b/117478341): Add multi-display support. + @Override + public void setWindowState(int displayId, int window, int state) { synchronized (mLock) { // don't coalesce these mHandler.obtainMessage(MSG_SET_WINDOW_STATE, window, state, null).sendToTarget(); @@ -385,7 +397,9 @@ public class CommandQueue extends IStatusBar.Stub { } } - public void appTransitionPending() { + // TODO(b/117478341): Add multi-display support. + @Override + public void appTransitionPending(int displayId) { appTransitionPending(false /* forced */); } @@ -395,13 +409,17 @@ public class CommandQueue extends IStatusBar.Stub { } } - public void appTransitionCancelled() { + // TODO(b/117478341): Add multi-display support. + @Override + public void appTransitionCancelled(int displayId) { synchronized (mLock) { mHandler.sendEmptyMessage(MSG_APP_TRANSITION_CANCELLED); } } - public void appTransitionStarting(long startTime, long duration) { + // TODO(b/117478341): Add multi-display support. + @Override + public void appTransitionStarting(int displayId, long startTime, long duration) { appTransitionStarting(startTime, duration, false /* forced */); } @@ -412,8 +430,9 @@ public class CommandQueue extends IStatusBar.Stub { } } + // TODO(b/117478341): Add multi-display support. @Override - public void appTransitionFinished() { + public void appTransitionFinished(int displayId) { synchronized (mLock) { mHandler.sendEmptyMessage(MSG_APP_TRANSITION_FINISHED); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index 960d22185652..7d1b640f7e40 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -156,7 +156,7 @@ public class KeyguardIndicationController implements StateListener { new IntentFilter(Intent.ACTION_TIME_TICK), null, Dependency.get(Dependency.TIME_TICK_HANDLER)); - Dependency.get(StatusBarStateController.class).addListener(this); + Dependency.get(StatusBarStateController.class).addCallback(this); } /** @@ -167,7 +167,7 @@ public class KeyguardIndicationController implements StateListener { */ public void destroy() { mContext.unregisterReceiver(mTickReceiver); - Dependency.get(StatusBarStateController.class).removeListener(this); + Dependency.get(StatusBarStateController.class).removeCallback(this); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java index b0724b1e014b..bba4369b5e01 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java @@ -165,7 +165,7 @@ public class NotificationLockscreenUserManagerImpl implements mCurrentUserId = ActivityManager.getCurrentUser(); mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); - Dependency.get(StatusBarStateController.class).addListener(this); + Dependency.get(StatusBarStateController.class).addCallback(this); mLockPatternUtils = new LockPatternUtils(context); mKeyguardManager = context.getSystemService(KeyguardManager.class); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java index 7be5461f0afa..ecadf96dfbfc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java @@ -141,7 +141,7 @@ public class NotificationRemoteInputManager implements Dumpable { ActivityManager.getService().resumeAppSwitches(); } catch (RemoteException e) { } - return mCallback.handleRemoteViewClick(pendingIntent, () -> { + return mCallback.handleRemoteViewClick(view, pendingIntent, () -> { Pair<Intent, ActivityOptions> options = response.getLaunchOptions(view); options.second.setLaunchWindowingMode( WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY); @@ -666,11 +666,13 @@ public class NotificationRemoteInputManager implements Dumpable { * Performs any special handling for a remote view click. The default behaviour can be * called through the defaultHandler parameter. * + * @param view * @param pendingIntent * @param defaultHandler * @return true iff the click was handled */ - boolean handleRemoteViewClick(PendingIntent pendingIntent, ClickHandler defaultHandler); + boolean handleRemoteViewClick(View view, PendingIntent pendingIntent, + ClickHandler defaultHandler); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index ac4abfc7fba5..6cec36a81e5a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -121,13 +121,13 @@ public class NotificationShelf extends ActivatableNotificationView implements protected void onAttachedToWindow() { super.onAttachedToWindow(); Dependency.get(StatusBarStateController.class) - .addListener(mStateListener, StatusBarStateController.RANK_SHELF); + .addCallback(mStateListener, StatusBarStateController.RANK_SHELF); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - Dependency.get(StatusBarStateController.class).removeListener(mStateListener); + Dependency.get(StatusBarStateController.class).removeCallback(mStateListener); } public void bind(AmbientState ambientState, NotificationStackScrollLayout hostLayout) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java index daa2fd45b142..dc3a60786ce2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java @@ -129,7 +129,7 @@ public class NotificationViewHierarchyManager { res.getBoolean(R.bool.config_alwaysExpandNonGroupedNotifications); mStatusBarStateListener = new StatusBarStateListener(mBubbleController); mEntryManager.setStatusBarStateListener(mStatusBarStateListener); - Dependency.get(StatusBarStateController.class).addListener(mStatusBarStateListener); + Dependency.get(StatusBarStateController.class).addCallback(mStatusBarStateListener); } public void setUpWithPresenter(NotificationPresenter presenter, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateController.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateController.java index eaf52cb357fe..3f84416ad575 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateController.java @@ -26,8 +26,10 @@ import android.view.animation.Interpolator; import com.android.internal.annotations.GuardedBy; import com.android.systemui.Interpolators; +import com.android.systemui.statusbar.StatusBarStateController.StateListener; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import com.android.systemui.statusbar.phone.StatusBar; +import com.android.systemui.statusbar.policy.CallbackController; import java.lang.annotation.Retention; import java.util.ArrayList; @@ -36,7 +38,7 @@ import java.util.Comparator; /** * Tracks and reports on {@link StatusBarState}. */ -public class StatusBarStateController { +public class StatusBarStateController implements CallbackController<StateListener> { private static final String TAG = "SbStateController"; private static final int MAX_STATE = StatusBarState.FULLSCREEN_USER_SWITCHER; @@ -228,7 +230,7 @@ public class StatusBarStateController { return mLastState == StatusBarState.SHADE_LOCKED; } - public void addListener(StateListener listener) { + public void addCallback(StateListener listener) { synchronized (mListeners) { addListenerInternalLocked(listener, Integer.MAX_VALUE); } @@ -244,7 +246,7 @@ public class StatusBarStateController { * StatusBarState out of StatusBar.java. Any new listeners should be built not to need ranking * (i.e., they are non-dependent on the order of operations of StatusBarState listeners). */ - public void addListener(StateListener listener, @SbStateListenerRank int rank) { + public void addCallback(StateListener listener, @SbStateListenerRank int rank) { synchronized (mListeners) { addListenerInternalLocked(listener, rank); } @@ -264,7 +266,7 @@ public class StatusBarStateController { mListeners.sort(mComparator); } - public void removeListener(StateListener listener) { + public void removeCallback(StateListener listener) { synchronized (mListeners) { mListeners.removeIf((it) -> it.listener.equals(listener)); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java index 87313b8a0393..9f02e543b6e3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java @@ -149,7 +149,7 @@ public class NotificationLogger implements StateListener { mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); // Not expected to be destroyed, don't need to unsubscribe - Dependency.get(StatusBarStateController.class).addListener(this); + Dependency.get(StatusBarStateController.class).addCallback(this); } public void setUpWithContainer(NotificationListContainer listContainer) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 5d640e0216e0..eca1a1411212 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -618,7 +618,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd protected void onAttachedToWindow() { super.onAttachedToWindow(); Dependency.get(StatusBarStateController.class) - .addListener(mStateListener, StatusBarStateController.RANK_STACK_SCROLLER); + .addCallback(mStateListener, StatusBarStateController.RANK_STACK_SCROLLER); Dependency.get(ConfigurationController.class).addCallback(this); } @@ -626,7 +626,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - Dependency.get(StatusBarStateController.class).removeListener(mStateListener); + Dependency.get(StatusBarStateController.class).removeCallback(mStateListener); Dependency.get(ConfigurationController.class).removeCallback(this); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java index 3b13fe96fe42..24570aec9db4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java @@ -120,15 +120,15 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue @Override public void onResume() { super.onResume(); - mCommandQueue.addCallbacks(this); - mStatusBarStateController.addListener(this); + mCommandQueue.addCallback(this); + mStatusBarStateController.addCallback(this); } @Override public void onPause() { super.onPause(); - mCommandQueue.removeCallbacks(this); - mStatusBarStateController.removeListener(this); + mCommandQueue.removeCallback(this); + mStatusBarStateController.removeCallback(this); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java index 94b2cdeea898..cfa751cec613 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java @@ -88,7 +88,7 @@ public class DozeScrimController implements StateListener { public DozeScrimController(DozeParameters dozeParameters) { mDozeParameters = dozeParameters; //Never expected to be destroyed - Dependency.get(StatusBarStateController.class).addListener(this); + Dependency.get(StatusBarStateController.class).addCallback(this); } @VisibleForTesting diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java index 9faada05294b..aa0b7b656e1c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java @@ -129,7 +129,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable, updateTouchableRegionListener(); } }); - Dependency.get(StatusBarStateController.class).addListener(mStateListener); + Dependency.get(StatusBarStateController.class).addCallback(mStateListener); mBubbleController.setBubbleStateChangeListener((hasBubbles) -> { if (!hasBubbles) { mBubbleGoingAway = true; @@ -143,7 +143,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable, } public void destroy() { - Dependency.get(StatusBarStateController.class).removeListener(mStateListener); + Dependency.get(StatusBarStateController.class).removeCallback(mStateListener); } private void initResources() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java index b29889dac6f8..57cc7d6c1ecb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java @@ -73,15 +73,15 @@ public class LightBarTransitionsController implements Dumpable, Callbacks, mKeyguardMonitor = Dependency.get(KeyguardMonitor.class); mStatusBarStateController = Dependency.get(StatusBarStateController.class); SysUiServiceProvider.getComponent(context, CommandQueue.class) - .addCallbacks(this); - mStatusBarStateController.addListener(this); + .addCallback(this); + mStatusBarStateController.addCallback(this); mDozeAmount = mStatusBarStateController.getDozeAmount(); } public void destroy(Context context) { SysUiServiceProvider.getComponent(context, CommandQueue.class) - .removeCallbacks(this); - mStatusBarStateController.removeListener(this); + .removeCallback(this); + mStatusBarStateController.removeCallback(this); } public void saveState(Bundle outState) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java index 8657003891be..d2bfd123f113 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java @@ -199,7 +199,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks { public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mCommandQueue = SysUiServiceProvider.getComponent(getContext(), CommandQueue.class); - mCommandQueue.addCallbacks(this); + mCommandQueue.addCallback(this); mStatusBar = SysUiServiceProvider.getComponent(getContext(), StatusBar.class); mRecents = SysUiServiceProvider.getComponent(getContext(), Recents.class); mDivider = SysUiServiceProvider.getComponent(getContext(), Divider.class); @@ -225,7 +225,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks { @Override public void onDestroy() { super.onDestroy(); - mCommandQueue.removeCallbacks(this); + mCommandQueue.removeCallback(this); Dependency.get(AccessibilityManagerWrapper.class).removeCallback( mAccessibilityListener); mContentResolver.unregisterContentObserver(mMagnificationObserver); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java index 12a0cc882a81..3984405f8e09 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java @@ -24,7 +24,6 @@ import android.util.SparseArray; import android.view.Display; import android.view.IWallpaperVisibilityListener; import android.view.IWindowManager; -import android.view.MotionEvent; import android.view.View; import com.android.internal.statusbar.IStatusBarService; @@ -165,23 +164,4 @@ public final class NavigationBarTransitions extends BarTransitions { } mView.onDarkIntensityChange(darkIntensity); } - - private final View.OnTouchListener mLightsOutListener = new View.OnTouchListener() { - @Override - public boolean onTouch(View v, MotionEvent ev) { - if (ev.getAction() == MotionEvent.ACTION_DOWN) { - // even though setting the systemUI visibility below will turn these views - // on, we need them to come up faster so that they can catch this motion - // event - applyLightsOut(false, false, false); - - try { - mBarService.setSystemUiVisibility(0, View.SYSTEM_UI_FLAG_LOW_PROFILE, - "LightsOutListener"); - } catch (android.os.RemoteException ex) { - } - } - return false; - } - }; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelper.java index 3e31fa06ef27..2a68fa598603 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelper.java @@ -82,7 +82,7 @@ public class NotificationGroupAlertTransferHelper implements OnGroupChangeListen private boolean mIsDozing; public NotificationGroupAlertTransferHelper() { - Dependency.get(StatusBarStateController.class).addListener(this); + Dependency.get(StatusBarStateController.class).addCallback(this); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java index 448b5c38da51..8f4369a98b17 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java @@ -55,7 +55,7 @@ public class NotificationGroupManager implements OnHeadsUpChangedListener, private boolean mIsUpdatingUnchangedGroup; public NotificationGroupManager() { - Dependency.get(StatusBarStateController.class).addListener(this); + Dependency.get(StatusBarStateController.class).addCallback(this); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 33d176a580da..a2a11bbfd650 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -366,7 +366,7 @@ public class NotificationPanelView extends PanelView implements protected void onAttachedToWindow() { super.onAttachedToWindow(); FragmentHostManager.get(this).addTagListener(QS.TAG, mFragmentListener); - Dependency.get(StatusBarStateController.class).addListener(this); + Dependency.get(StatusBarStateController.class).addCallback(this); Dependency.get(ZenModeController.class).addCallback(this); Dependency.get(ConfigurationController.class).addCallback(this); } @@ -375,7 +375,7 @@ public class NotificationPanelView extends PanelView implements protected void onDetachedFromWindow() { super.onDetachedFromWindow(); FragmentHostManager.get(this).removeTagListener(QS.TAG, mFragmentListener); - Dependency.get(StatusBarStateController.class).removeListener(this); + Dependency.get(StatusBarStateController.class).removeCallback(this); Dependency.get(ZenModeController.class).removeCallback(this); Dependency.get(ConfigurationController.class).removeCallback(this); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java index c84f3db8acb0..ee1eb42a07f0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -268,7 +268,7 @@ public class PhoneStatusBarPolicy implements Callback, Callbacks, mLocationController.addCallback(this); mPrivacyItemController.setListening(true); - SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallbacks(this); + SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallback(this); ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskListener); // Clear out all old notifications on startup (only present in the case where sysui dies) @@ -296,7 +296,7 @@ public class PhoneStatusBarPolicy implements Callback, Callbacks, mKeyguardMonitor.removeCallback(this); mLocationController.removeCallback(this); mPrivacyItemController.setListening(false); - SysUiServiceProvider.getComponent(mContext, CommandQueue.class).removeCallbacks(this); + SysUiServiceProvider.getComponent(mContext, CommandQueue.class).removeCallback(this); mContext.unregisterReceiver(mIntentReceiver); NotificationManager noMan = mContext.getSystemService(NotificationManager.class); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 3ca077c13fd7..962e214d8c21 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -579,6 +579,7 @@ public class StatusBar extends SystemUI implements DemoMode, private boolean mVibrateOnOpening; private VibratorHelper mVibratorHelper; protected NotificationPresenter mPresenter; + private boolean mPulsing; @Override public void onActiveStateChanged(int code, int uid, String packageName, boolean active) { @@ -627,7 +628,7 @@ public class StatusBar extends SystemUI implements DemoMode, mBubbleController.setExpandListener(mBubbleExpandListener); mColorExtractor.addOnColorsChangedListener(this); - mStatusBarStateController.addListener(this, StatusBarStateController.RANK_STATUS_BAR); + mStatusBarStateController.addCallback(this, StatusBarStateController.RANK_STATUS_BAR); mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); mDreamManager = IDreamManager.Stub.asInterface( @@ -663,7 +664,7 @@ public class StatusBar extends SystemUI implements DemoMode, // Connect in to the status bar manager service mCommandQueue = getComponent(CommandQueue.class); - mCommandQueue.addCallbacks(this); + mCommandQueue.addCallback(this); int[] switches = new int[9]; ArrayList<IBinder> binders = new ArrayList<>(); @@ -1544,7 +1545,7 @@ public class StatusBar extends SystemUI implements DemoMode, } public boolean isPulsing() { - return mAmbientPulseManager.hasNotifications(); + return mPulsing; } public boolean isLaunchTransitionFadingAway() { @@ -2889,7 +2890,7 @@ public class StatusBar extends SystemUI implements DemoMode, mContext.unregisterReceiver(mDemoReceiver); mAssistManager.destroy(); mHeadsUpManager.destroy(); - mStatusBarStateController.removeListener(this); + mStatusBarStateController.removeCallback(this); if (mQSPanel != null && mQSPanel.getHost() != null) { mQSPanel.getHost().destroy(); @@ -3935,6 +3936,10 @@ public class StatusBar extends SystemUI implements DemoMode, return; } + // Set the state to pulsing, so ScrimController will know what to do once we ask it to + // execute the transition. The pulse callback will then be invoked when the scrims + // are black, indicating that StatusBar is ready to present the rest of the UI. + mPulsing = true; mDozeScrimController.pulse(new PulseCallback() { @Override public void onPulseStarted() { @@ -3948,6 +3953,7 @@ public class StatusBar extends SystemUI implements DemoMode, @Override public void onPulseFinished() { + mPulsing = false; callback.onPulseFinished(); setPulsing(false); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java index 7c17c018443e..4f25349ef7d2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java @@ -76,7 +76,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu loadDimens(); SysUiServiceProvider.getComponent(context, CommandQueue.class) - .addCallbacks(this); + .addCallback(this); Dependency.get(TunerService.class).addTunable(this, ICON_BLACKLIST); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 484fe110b28a..0f8970f1069f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -151,7 +151,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mLockPatternUtils = lockPatternUtils; mStatusBarWindowController = Dependency.get(StatusBarWindowController.class); KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateMonitorCallback); - Dependency.get(StatusBarStateController.class).addListener(this); + Dependency.get(StatusBarStateController.class).addCallback(this); } public void registerStatusBar(StatusBar statusBar, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java index a743d41e8d3a..e3f6bd8f21f1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java @@ -70,10 +70,10 @@ public class StatusBarRemoteInputCallback implements Callback, Callbacks { mContext = context; mContext.registerReceiverAsUser(mChallengeReceiver, UserHandle.ALL, new IntentFilter(ACTION_DEVICE_LOCKED_CHANGED), null, null); - mStatusBarStateController.addListener(mStateListener); + mStatusBarStateController.addCallback(mStateListener); mKeyguardManager = context.getSystemService(KeyguardManager.class); mCommandQueue = getComponent(context, CommandQueue.class); - mCommandQueue.addCallbacks(this); + mCommandQueue.addCallback(this); } private void setStatusBarState(int state) { @@ -206,7 +206,7 @@ public class StatusBarRemoteInputCallback implements Callback, Callbacks { } @Override - public boolean handleRemoteViewClick(PendingIntent pendingIntent, + public boolean handleRemoteViewClick(View view, PendingIntent pendingIntent, NotificationRemoteInputManager.ClickHandler defaultHandler) { final boolean isActivity = pendingIntent.isActivity(); if (isActivity) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java index 158ee8ae8fbd..986a86d13958 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java @@ -92,7 +92,7 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat mKeyguardScreenRotation = shouldEnableKeyguardScreenRotation(); mDozeParameters = dozeParameters; mScreenBrightnessDoze = mDozeParameters.getScreenBrightnessDoze(); - Dependency.get(StatusBarStateController.class).addListener( + Dependency.get(StatusBarStateController.class).addCallback( mStateListener, StatusBarStateController.RANK_STATUS_BAR_WINDOW_CONTROLLER); Dependency.get(ConfigurationController.class).addCallback(this); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java index c2af95e66fe9..aafdcd50b8e8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java @@ -187,7 +187,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C null, Dependency.get(Dependency.TIME_TICK_HANDLER)); Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS, StatusBarIconController.ICON_BLACKLIST); - SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallbacks(this); + SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallback(this); if (mShowDark) { Dependency.get(DarkIconDispatcher.class).addDarkReceiver(this); } @@ -215,7 +215,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C mAttached = false; Dependency.get(TunerService.class).removeTunable(this); SysUiServiceProvider.getComponent(getContext(), CommandQueue.class) - .removeCallbacks(this); + .removeCallback(this); if (mShowDark) { Dependency.get(DarkIconDispatcher.class).removeDarkReceiver(this); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java index f36066ce3794..2a4336e809a0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java @@ -21,7 +21,6 @@ import android.text.TextPaint; import android.text.method.TransformationMethod; import android.util.AttributeSet; import android.util.Log; -import android.util.Size; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -41,6 +40,7 @@ import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.phone.KeyguardDismissUtil; import java.text.BreakIterator; +import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.PriorityQueue; @@ -282,9 +282,9 @@ public class SmartReplyView extends ViewGroup { Drawable iconDrawable = action.getIcon().loadDrawable(context); // Add the action icon to the Smart Action button. - Size newIconSize = calculateIconSizeFromSingleLineButton(context, root, - new Size(iconDrawable.getIntrinsicWidth(), iconDrawable.getIntrinsicHeight())); - iconDrawable.setBounds(0, 0, newIconSize.getWidth(), newIconSize.getHeight()); + int newIconSize = context.getResources().getDimensionPixelSize( + R.dimen.smart_action_button_icon_size); + iconDrawable.setBounds(0, 0, newIconSize, newIconSize); button.setCompoundDrawables(iconDrawable, null, null, null); button.setOnClickListener(view -> @@ -295,30 +295,12 @@ public class SmartReplyView extends ViewGroup { // TODO(b/119010281): handle accessibility + // Mark this as an Action button + final LayoutParams lp = (LayoutParams) button.getLayoutParams(); + lp.buttonType = SmartButtonType.ACTION; return button; } - private static Size calculateIconSizeFromSingleLineButton(Context context, ViewGroup root, - Size originalIconSize) { - Button button = (Button) LayoutInflater.from(context).inflate( - R.layout.smart_action_button, root, false); - // Add simple text here to ensure the button displays one line of text. - button.setText("a"); - return calculateIconSizeFromButtonHeight(button, originalIconSize); - } - - // Given a button with text on a single line - we want to add an icon to that button. This - // method calculates the icon height to use to avoid making the button grow in height. - private static Size calculateIconSizeFromButtonHeight(Button button, Size originalIconSize) { - // A completely permissive measure spec should make the button text single-line. - button.measure(MEASURE_SPEC_ANY_LENGTH, MEASURE_SPEC_ANY_LENGTH); - int buttonHeight = button.getMeasuredHeight(); - int newIconHeight = buttonHeight / 2; - int newIconWidth = (int) (originalIconSize.getWidth() - * ((double) newIconHeight) / originalIconSize.getHeight()); - return new Size(newIconWidth, newIconHeight); - } - @Override public LayoutParams generateLayoutParams(AttributeSet attrs) { return new LayoutParams(mContext, attrs); @@ -352,18 +334,26 @@ public class SmartReplyView extends ViewGroup { int displayedChildCount = 0; int buttonPaddingHorizontal = mSingleLineButtonPaddingHorizontal; - final int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - final View child = getChildAt(i); + // Set up a list of suggestions where actions come before replies. Note that the Buttons + // themselves have already been added to the view hierarchy in an order such that Smart + // Replies are shown before Smart Actions. The order of the list below determines which + // suggestions will be shown at all - only the first X elements are shown (where X depends + // on how much space each suggestion button needs). + List<View> smartActions = filterActionsOrReplies(SmartButtonType.ACTION); + List<View> smartReplies = filterActionsOrReplies(SmartButtonType.REPLY); + List<View> smartSuggestions = new ArrayList<>(smartActions); + smartSuggestions.addAll(smartReplies); + List<View> coveredSuggestions = new ArrayList<>(); + + for (View child : smartSuggestions) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); - if (child.getVisibility() != View.VISIBLE || !(child instanceof Button)) { - continue; - } child.setPadding(buttonPaddingHorizontal, child.getPaddingTop(), buttonPaddingHorizontal, child.getPaddingBottom()); child.measure(MEASURE_SPEC_ANY_LENGTH, heightMeasureSpec); + coveredSuggestions.add(child); + final int lineCount = ((Button) child).getLineCount(); if (lineCount < 1 || lineCount > 2) { // If smart reply has no text, or more than two lines, then don't show it. @@ -417,7 +407,8 @@ public class SmartReplyView extends ViewGroup { // Mark all buttons from the last squeezing round as "failed to squeeze", so // that they're re-measured without squeezing later. - markButtonsWithPendingSqueezeStatusAs(LayoutParams.SQUEEZE_STATUS_FAILED, i); + markButtonsWithPendingSqueezeStatusAs( + LayoutParams.SQUEEZE_STATUS_FAILED, coveredSuggestions); // The current button doesn't fit, so there's no point in measuring further // buttons. @@ -426,7 +417,8 @@ public class SmartReplyView extends ViewGroup { // The current button fits, so mark all squeezed buttons as "successfully squeezed" // to prevent them from being un-squeezed in a subsequent squeezing round. - markButtonsWithPendingSqueezeStatusAs(LayoutParams.SQUEEZE_STATUS_SUCCESSFUL, i); + markButtonsWithPendingSqueezeStatusAs( + LayoutParams.SQUEEZE_STATUS_SUCCESSFUL, coveredSuggestions); } lp.show = true; @@ -445,6 +437,22 @@ public class SmartReplyView extends ViewGroup { mPaddingTop + maxChildHeight + mPaddingBottom), heightMeasureSpec)); } + private List<View> filterActionsOrReplies(SmartButtonType buttonType) { + List<View> actions = new ArrayList<>(); + final int childCount = getChildCount(); + for (int i = 0; i < childCount; i++) { + final View child = getChildAt(i); + final LayoutParams lp = (LayoutParams) child.getLayoutParams(); + if (child.getVisibility() != View.VISIBLE || !(child instanceof Button)) { + continue; + } + if (lp.buttonType == buttonType) { + actions.add(child); + } + } + return actions; + } + private void resetButtonsLayoutParams() { final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { @@ -615,9 +623,9 @@ public class SmartReplyView extends ViewGroup { } } - private void markButtonsWithPendingSqueezeStatusAs(int squeezeStatus, int maxChildIndex) { - for (int i = 0; i <= maxChildIndex; i++) { - final View child = getChildAt(i); + private void markButtonsWithPendingSqueezeStatusAs( + int squeezeStatus, List<View> coveredChildren) { + for (View child : coveredChildren) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (lp.squeezeStatus == LayoutParams.SQUEEZE_STATUS_PENDING) { lp.squeezeStatus = squeezeStatus; @@ -712,6 +720,11 @@ public class SmartReplyView extends ViewGroup { return mActivityStarter; } + private enum SmartButtonType { + REPLY, + ACTION + } + @VisibleForTesting static class LayoutParams extends ViewGroup.LayoutParams { @@ -737,6 +750,7 @@ public class SmartReplyView extends ViewGroup { private boolean show = false; private int squeezeStatus = SQUEEZE_STATUS_NONE; + private SmartButtonType buttonType = SmartButtonType.REPLY; private LayoutParams(Context c, AttributeSet attrs) { super(c, attrs); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java index cd379c5f551f..4a69cd783a6c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java @@ -42,7 +42,7 @@ public class TvStatusBar extends SystemUI implements Callbacks { public void start() { putComponent(TvStatusBar.class, this); CommandQueue commandQueue = getComponent(CommandQueue.class); - commandQueue.addCallbacks(this); + commandQueue.addCallback(this); int[] switches = new int[9]; ArrayList<IBinder> binders = new ArrayList<>(); ArrayList<String> iconSlots = new ArrayList<>(); diff --git a/packages/SystemUI/src/com/android/systemui/util/Utils.java b/packages/SystemUI/src/com/android/systemui/util/Utils.java index 6812410c851c..490cdd5ce9bd 100644 --- a/packages/SystemUI/src/com/android/systemui/util/Utils.java +++ b/packages/SystemUI/src/com/android/systemui/util/Utils.java @@ -57,13 +57,13 @@ public class Utils { public void onViewAttachedToWindow(View v) { mView = v; SysUiServiceProvider.getComponent(v.getContext(), CommandQueue.class) - .addCallbacks(this); + .addCallback(this); } @Override public void onViewDetachedFromWindow(View v) { SysUiServiceProvider.getComponent(mView.getContext(), CommandQueue.class) - .removeCallbacks(this); + .removeCallback(this); mView = null; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java new file mode 100644 index 000000000000..78700b88d4bc --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.qs; + + +import static junit.framework.TestCase.assertFalse; + +import android.support.test.filters.SmallTest; +import android.testing.AndroidTestingRunner; + +import com.android.systemui.SysuiTestCase; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.List; + +@RunWith(AndroidTestingRunner.class) +@SmallTest +public class QSTileHostTest extends SysuiTestCase { + + @Test + public void testLoadTileSpecs_emptySetting() { + List<String> tiles = QSTileHost.loadTileSpecs(mContext, ""); + assertFalse(tiles.isEmpty()); + } + + @Test + public void testLoadTileSpecs_nullSetting() { + List<String> tiles = QSTileHost.loadTileSpecs(mContext, null); + assertFalse(tiles.isEmpty()); + } +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java index 8ae3cd8d6acd..a04e57bb4990 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java @@ -14,6 +14,8 @@ package com.android.systemui.statusbar; +import static android.view.Display.DEFAULT_DISPLAY; + import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -42,7 +44,7 @@ public class CommandQueueTest extends SysuiTestCase { public void setup() { mCommandQueue = new CommandQueue(); mCallbacks = mock(Callbacks.class); - mCommandQueue.addCallbacks(mCallbacks); + mCommandQueue.addCallback(mCallbacks); verify(mCallbacks).disable(eq(0), eq(0), eq(false)); } @@ -64,11 +66,12 @@ public class CommandQueueTest extends SysuiTestCase { verify(mCallbacks).removeIcon(eq(slot)); } + // TODO(b/117478341): add test case for multi-display @Test public void testDisable() { int state1 = 14; int state2 = 42; - mCommandQueue.disable(state1, state2); + mCommandQueue.disable(DEFAULT_DISPLAY, state1, state2); waitForIdleSync(); verify(mCallbacks).disable(eq(state1), eq(state2), eq(true)); } @@ -95,24 +98,27 @@ public class CommandQueueTest extends SysuiTestCase { verify(mCallbacks).animateExpandSettingsPanel(eq(panel)); } + // TODO(b/117478341): add test case for multi-display @Test public void testSetSystemUiVisibility() { Rect r = new Rect(); - mCommandQueue.setSystemUiVisibility(1, 2, 3, 4, null, r); + mCommandQueue.setSystemUiVisibility(DEFAULT_DISPLAY, 1, 2, 3, 4, null, r); waitForIdleSync(); verify(mCallbacks).setSystemUiVisibility(eq(1), eq(2), eq(3), eq(4), eq(null), eq(r)); } + // TODO(b/117478341): add test case for multi-display @Test public void testTopAppWindowChanged() { - mCommandQueue.topAppWindowChanged(true); + mCommandQueue.topAppWindowChanged(DEFAULT_DISPLAY, true); waitForIdleSync(); verify(mCallbacks).topAppWindowChanged(eq(true)); } + // TODO(b/117478341): add test case for multi-display @Test public void testShowImeButton() { - mCommandQueue.setImeWindowStatus(null, 1, 2, true); + mCommandQueue.setImeWindowStatus(DEFAULT_DISPLAY, null, 1, 2, true); waitForIdleSync(); verify(mCallbacks).setImeWindowStatus(eq(null), eq(1), eq(2), eq(true)); } @@ -166,9 +172,10 @@ public class CommandQueueTest extends SysuiTestCase { verify(mCallbacks).toggleKeyboardShortcutsMenu(eq(1)); } + // TODO(b/117478341): add test case for multi-display @Test public void testSetWindowState() { - mCommandQueue.setWindowState(1, 2); + mCommandQueue.setWindowState(DEFAULT_DISPLAY, 1, 2); waitForIdleSync(); verify(mCallbacks).setWindowState(eq(1), eq(2)); } @@ -180,30 +187,34 @@ public class CommandQueueTest extends SysuiTestCase { verify(mCallbacks).showScreenPinningRequest(eq(1)); } + // TODO(b/117478341): add test case for multi-display @Test public void testAppTransitionPending() { - mCommandQueue.appTransitionPending(); + mCommandQueue.appTransitionPending(DEFAULT_DISPLAY); waitForIdleSync(); verify(mCallbacks).appTransitionPending(eq(false)); } + // TODO(b/117478341): add test case for multi-display @Test public void testAppTransitionCancelled() { - mCommandQueue.appTransitionCancelled(); + mCommandQueue.appTransitionCancelled(DEFAULT_DISPLAY); waitForIdleSync(); verify(mCallbacks).appTransitionCancelled(); } + // TODO(b/117478341): add test case for multi-display @Test public void testAppTransitionStarting() { - mCommandQueue.appTransitionStarting(1, 2); + mCommandQueue.appTransitionStarting(DEFAULT_DISPLAY, 1, 2); waitForIdleSync(); verify(mCallbacks).appTransitionStarting(eq(1L), eq(2L), eq(false)); } + // TODO(b/117478341): add test case for multi-display @Test public void testAppTransitionFinished() { - mCommandQueue.appTransitionFinished(); + mCommandQueue.appTransitionFinished(DEFAULT_DISPLAY); waitForIdleSync(); verify(mCallbacks).appTransitionFinished(); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java index e9e8eb785d1a..c207feff26f3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java @@ -72,6 +72,8 @@ import com.android.systemui.appops.AppOpsControllerImpl; import com.android.systemui.assist.AssistManager; import com.android.systemui.bubbles.BubbleController; import com.android.systemui.classifier.FalsingManager; +import com.android.systemui.doze.DozeHost; +import com.android.systemui.doze.DozeLog; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.plugins.ActivityStarter.OnDismissAction; @@ -123,6 +125,7 @@ public class StatusBarTest extends SysuiTestCase { @Mock private IStatusBarService mBarService; @Mock private IDreamManager mDreamManager; @Mock private ScrimController mScrimController; + @Mock private DozeScrimController mDozeScrimController; @Mock private ArrayList<Entry> mNotificationList; @Mock private BiometricUnlockController mBiometricUnlockController; @Mock private NotificationData mNotificationData; @@ -211,7 +214,7 @@ public class StatusBarTest extends SysuiTestCase { mKeyguardViewMediator, mRemoteInputManager, mock(NotificationGroupManager.class), mock(NotificationGroupAlertTransferHelper.class), mock(FalsingManager.class), mock(StatusBarWindowController.class), mock(NotificationIconAreaController.class), - mock(DozeScrimController.class), mock(NotificationShelf.class), + mDozeScrimController, mock(NotificationShelf.class), mLockscreenUserManager, mCommandQueue, mNotificationPresenter, mock(BubbleController.class)); mStatusBar.mContext = mContext; @@ -570,7 +573,28 @@ public class StatusBarTest extends SysuiTestCase { } @Test + public void testPulseWhileDozing_updatesScrimController() { + mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD); + mStatusBar.showKeyguardImpl(); + + // Keep track of callback to be able to stop the pulse + DozeHost.PulseCallback[] pulseCallback = new DozeHost.PulseCallback[1]; + doAnswer(invocation -> { + pulseCallback[0] = invocation.getArgument(0); + return null; + }).when(mDozeScrimController).pulse(any(), anyInt()); + // Starting a pulse should change the scrim controller to the pulsing state + mStatusBar.mDozeServiceHost.pulseWhileDozing(mock(DozeHost.PulseCallback.class), + DozeLog.PULSE_REASON_NOTIFICATION); + verify(mScrimController).transitionTo(eq(ScrimState.PULSING), any()); + + // Ending a pulse should take it back to keyguard state + pulseCallback[0].onPulseFinished(); + verify(mScrimController).transitionTo(eq(ScrimState.KEYGUARD)); + } + + @Test public void testSetState_changesIsFullScreenUserSwitcherState() { mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD); assertFalse(mStatusBar.isFullScreenUserSwitcherState()); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java index df7aeab2ed38..506fa974944a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java @@ -801,4 +801,55 @@ public class SmartReplyViewTest extends SysuiTestCase { assertReplyButtonShownWithEqualMeasures(expectedView.getChildAt(1), mView.getChildAt(1)); assertReplyButtonShownWithEqualMeasures(expectedView.getChildAt(2), mView.getChildAt(2)); } + + @Test + public void testMeasure_choicesAndActionsPrioritizeActionsOnlyActions() { + String[] choices = new String[] {"Reply"}; + String[] actions = new String[] {"Looooooong actioooon", "second action", "third action"}; + + // All actions should be displayed as DOUBLE-line smart action buttons. + ViewGroup expectedView = buildExpectedView(new String[0], 2, + createActions(new String[] { + "Looooooong \nactioooon", "second \naction", "third \naction"})); + expectedView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); + + setSmartRepliesAndActions(choices, actions); + mView.measure( + MeasureSpec.makeMeasureSpec(expectedView.getMeasuredWidth(), MeasureSpec.AT_MOST), + MeasureSpec.UNSPECIFIED); + + assertEqualMeasures(expectedView, mView); + // smart replies + assertReplyButtonHidden(mView.getChildAt(0)); + // smart actions + assertReplyButtonShownWithEqualMeasures(expectedView.getChildAt(0), mView.getChildAt(1)); + assertReplyButtonShownWithEqualMeasures(expectedView.getChildAt(1), mView.getChildAt(2)); + assertReplyButtonShownWithEqualMeasures(expectedView.getChildAt(2), mView.getChildAt(3)); + } + + @Test + public void testMeasure_choicesAndActionsPrioritizeActions() { + String[] choices = new String[] {"Short", "longer reply"}; + String[] actions = new String[] {"Looooooong actioooon", "second action"}; + + // All actions should be displayed as DOUBLE-line smart action buttons. + ViewGroup expectedView = buildExpectedView(new String[] {"Short"}, 2, + createActions(new String[] {"Looooooong \nactioooon", "second \naction"})); + expectedView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); + + setSmartRepliesAndActions(choices, actions); + mView.measure( + MeasureSpec.makeMeasureSpec(expectedView.getMeasuredWidth(), MeasureSpec.AT_MOST), + MeasureSpec.UNSPECIFIED); + + Button firstAction = ((Button) mView.getChildAt(1)); + + assertEqualMeasures(expectedView, mView); + // smart replies + assertReplyButtonShownWithEqualMeasures(expectedView.getChildAt(0), mView.getChildAt(0)); + assertReplyButtonHidden(mView.getChildAt(1)); + // smart actions + assertReplyButtonShownWithEqualMeasures(expectedView.getChildAt(1), mView.getChildAt(2)); + assertReplyButtonShownWithEqualMeasures(expectedView.getChildAt(2), mView.getChildAt(3)); + } } diff --git a/packages/overlays/AdaptiveIconChangeOverlay/Android.mk b/packages/overlays/AdaptiveIconChangeOverlay/Android.mk new file mode 100644 index 000000000000..6e3b8cbbcf2f --- /dev/null +++ b/packages/overlays/AdaptiveIconChangeOverlay/Android.mk @@ -0,0 +1,30 @@ +# +# Copyright 2018, The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_RRO_THEME := SquareIcon +LOCAL_CERTIFICATE := platform + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res + +LOCAL_PACKAGE_NAME := SquareIconOverlay +LOCAL_SDK_VERSION := current + +include $(BUILD_RRO_PACKAGE) diff --git a/packages/overlays/AdaptiveIconChangeOverlay/AndroidManifest.xml b/packages/overlays/AdaptiveIconChangeOverlay/AndroidManifest.xml new file mode 100644 index 000000000000..33da51047bf0 --- /dev/null +++ b/packages/overlays/AdaptiveIconChangeOverlay/AndroidManifest.xml @@ -0,0 +1,27 @@ +<!-- +/** + * Copyright (c) 2018, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.theme.icon.square" + android:versionCode="1" + android:versionName="1.0"> + <overlay android:targetPackage="android" + android:category="android.theme.customization.adaptive_icon_shape" + android:priority="1"/> + + <application android:label="@string/square_icon_overlay" android:hasCode="false"/> +</manifest> diff --git a/packages/overlays/AdaptiveIconChangeOverlay/res/values/config.xml b/packages/overlays/AdaptiveIconChangeOverlay/res/values/config.xml new file mode 100644 index 000000000000..54623f5c9fb0 --- /dev/null +++ b/packages/overlays/AdaptiveIconChangeOverlay/res/values/config.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2018, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Specifies the path that is used by AdaptiveIconDrawable class to crop launcher icons. --> + <string name="config_icon_mask" translatable="false">"M50,0L100,0 100,100 0,100 0,0z"</string> + <!-- Flag indicating whether round icons should be parsed from the application manifest. --> + <bool name="config_useRoundIcon">false</bool> + +</resources> + diff --git a/packages/overlays/AdaptiveIconChangeOverlay/res/values/strings.xml b/packages/overlays/AdaptiveIconChangeOverlay/res/values/strings.xml new file mode 100644 index 000000000000..64b7d0dc16b5 --- /dev/null +++ b/packages/overlays/AdaptiveIconChangeOverlay/res/values/strings.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright (c) 2018, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Square icon overlay [DO NOT TRANSLATE] --> + <string name="square_icon_overlay">Square Icons</string> + +</resources> diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java index 0df99d4b6642..18bc856700f7 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java @@ -190,6 +190,11 @@ final class AutofillManagerServiceImpl return mInfo.getServiceInfo(); } + @Override // from PerUserSystemService + protected String getDefaultComponentName() { + return getComponentNameFromSettings(); + } + @Nullable String[] getUrlBarResourceIdsForCompatMode(@NonNull String packageName) { return mAutofillCompatState.getUrlBarResourceIds(packageName, mUserId); @@ -369,7 +374,7 @@ final class AutofillManagerServiceImpl final long identity = Binder.clearCallingIdentity(); try { - final String autoFillService = getComponentNameFromSettings(); + final String autoFillService = getComponentNameLocked(); final ComponentName componentName = serviceInfo.getComponentName(); if (componentName.equals(ComponentName.unflattenFromString(autoFillService))) { mMetricsLogger.action(MetricsEvent.AUTOFILL_SERVICE_DISABLED_SELF, diff --git a/services/backup/java/com/android/server/backup/encryption/keys/RecoverableKeyStoreSecondaryKey.java b/services/backup/java/com/android/server/backup/encryption/keys/RecoverableKeyStoreSecondaryKey.java new file mode 100644 index 000000000000..f356b4f102e2 --- /dev/null +++ b/services/backup/java/com/android/server/backup/encryption/keys/RecoverableKeyStoreSecondaryKey.java @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.backup.encryption.keys; + +import static com.android.internal.util.Preconditions.checkNotNull; + +import android.annotation.IntDef; +import android.content.Context; +import android.security.keystore.recovery.InternalRecoveryServiceException; +import android.security.keystore.recovery.RecoveryController; +import android.util.Slog; + +import javax.crypto.SecretKey; + +/** + * Wraps a {@link RecoveryController}'s {@link SecretKey}. These are kept in "AndroidKeyStore" (a + * provider for {@link java.security.KeyStore} and {@link javax.crypto.KeyGenerator}. They are also + * synced with the recoverable key store, wrapped by the primary key. This allows them to be + * recovered on a user's subsequent device through providing their lock screen secret. + */ +public class RecoverableKeyStoreSecondaryKey { + private static final String TAG = "RecoverableKeyStoreSecondaryKey"; + + private final String mAlias; + private final SecretKey mSecretKey; + + /** + * A new instance. + * + * @param alias The alias. It is keyed with this in AndroidKeyStore and the recoverable key + * store. + * @param secretKey The key. + */ + public RecoverableKeyStoreSecondaryKey(String alias, SecretKey secretKey) { + mAlias = checkNotNull(alias); + mSecretKey = checkNotNull(secretKey); + } + + /** + * The ID, as stored in the recoverable {@link java.security.KeyStore}, and as used to identify + * wrapped tertiary keys on the backup server. + */ + public String getAlias() { + return mAlias; + } + + /** The secret key, to be used to wrap tertiary keys. */ + public SecretKey getSecretKey() { + return mSecretKey; + } + + /** + * The status of the key. i.e., whether it's been synced to remote trusted hardware. + * + * @param context The application context. + * @return One of {@link Status#SYNCED}, {@link Status#NOT_SYNCED} or {@link Status#DESTROYED}. + */ + public @Status int getStatus(Context context) { + try { + return getStatusInternal(context); + } catch (InternalRecoveryServiceException e) { + Slog.wtf(TAG, "Internal error getting recovery status", e); + // Return NOT_SYNCED by default, as we do not want the backups to fail or to repeatedly + // attempt to reinitialize. + return Status.NOT_SYNCED; + } + } + + private @Status int getStatusInternal(Context context) throws InternalRecoveryServiceException { + int status = RecoveryController.getInstance(context).getRecoveryStatus(mAlias); + switch (status) { + case RecoveryController.RECOVERY_STATUS_PERMANENT_FAILURE: + return Status.DESTROYED; + case RecoveryController.RECOVERY_STATUS_SYNCED: + return Status.SYNCED; + case RecoveryController.RECOVERY_STATUS_SYNC_IN_PROGRESS: + return Status.NOT_SYNCED; + default: + // Throw an exception if we encounter a status that doesn't match any of the above. + throw new InternalRecoveryServiceException( + "Unexpected status from getRecoveryStatus: " + status); + } + } + + /** Status of a key in the recoverable key store. */ + @IntDef({Status.NOT_SYNCED, Status.SYNCED, Status.DESTROYED}) + public @interface Status { + /** + * The key has not yet been synced to remote trusted hardware. This may be because the user + * has not yet unlocked their device. + */ + int NOT_SYNCED = 1; + + /** + * The key has been synced with remote trusted hardware. It should now be recoverable on + * another device. + */ + int SYNCED = 2; + + /** The key has been lost forever. This can occur if the user disables their lock screen. */ + int DESTROYED = 3; + } +} diff --git a/services/backup/java/com/android/server/backup/encryption/keys/RecoverableKeyStoreSecondaryKeyManager.java b/services/backup/java/com/android/server/backup/encryption/keys/RecoverableKeyStoreSecondaryKeyManager.java new file mode 100644 index 000000000000..db5fe77478a5 --- /dev/null +++ b/services/backup/java/com/android/server/backup/encryption/keys/RecoverableKeyStoreSecondaryKeyManager.java @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.backup.encryption.keys; + +import android.content.Context; +import android.security.keystore.recovery.InternalRecoveryServiceException; +import android.security.keystore.recovery.LockScreenRequiredException; +import android.security.keystore.recovery.RecoveryController; +import android.util.ByteStringUtils; + +import com.android.internal.annotations.VisibleForTesting; + +import java.security.SecureRandom; +import java.security.UnrecoverableKeyException; +import java.util.Optional; + +import javax.crypto.SecretKey; + +/** + * Manages generating, deleting, and retrieving secondary keys through {@link RecoveryController}. + * + * <p>The recoverable key store will be synced remotely via the {@link RecoveryController}, allowing + * recovery of keys on other devices owned by the user. + */ +public class RecoverableKeyStoreSecondaryKeyManager { + private static final String BACKUP_KEY_ALIAS_PREFIX = + "com.android.server.backup/recoverablekeystore/"; + private static final int BACKUP_KEY_SUFFIX_LENGTH_BITS = 128; + private static final int BITS_PER_BYTE = 8; + + /** A new instance. */ + public static RecoverableKeyStoreSecondaryKeyManager getInstance(Context context) { + return new RecoverableKeyStoreSecondaryKeyManager( + RecoveryController.getInstance(context), new SecureRandom()); + } + + private final RecoveryController mRecoveryController; + private final SecureRandom mSecureRandom; + + @VisibleForTesting + public RecoverableKeyStoreSecondaryKeyManager( + RecoveryController recoveryController, SecureRandom secureRandom) { + mRecoveryController = recoveryController; + mSecureRandom = secureRandom; + } + + /** + * Generates a new recoverable key using the {@link RecoveryController}. + * + * @throws InternalRecoveryServiceException if an unexpected error occurred generating the key. + * @throws LockScreenRequiredException if the user does not have a lock screen. A lock screen is + * required to generate a recoverable key. + */ + public RecoverableKeyStoreSecondaryKey generate() + throws InternalRecoveryServiceException, LockScreenRequiredException, + UnrecoverableKeyException { + String alias = generateId(); + mRecoveryController.generateKey(alias); + SecretKey key = (SecretKey) mRecoveryController.getKey(alias); + if (key == null) { + throw new InternalRecoveryServiceException( + String.format( + "Generated key %s but could not get it back immediately afterwards.", + alias)); + } + return new RecoverableKeyStoreSecondaryKey(alias, key); + } + + /** + * Removes the secondary key. This means the key will no longer be recoverable. + * + * @param alias The alias of the key. + * @throws InternalRecoveryServiceException if there was a {@link RecoveryController} error. + */ + public void remove(String alias) throws InternalRecoveryServiceException { + mRecoveryController.removeKey(alias); + } + + /** + * Returns the {@link RecoverableKeyStoreSecondaryKey} with {@code alias} if it is in the {@link + * RecoveryController}. Otherwise, {@link Optional#empty()}. + */ + public Optional<RecoverableKeyStoreSecondaryKey> get(String alias) + throws InternalRecoveryServiceException, UnrecoverableKeyException { + SecretKey secretKey = (SecretKey) mRecoveryController.getKey(alias); + return Optional.ofNullable(secretKey) + .map(key -> new RecoverableKeyStoreSecondaryKey(alias, key)); + } + + /** + * Generates a new key alias. This has more entropy than a UUID - it can be considered + * universally unique. + */ + private String generateId() { + byte[] id = new byte[BACKUP_KEY_SUFFIX_LENGTH_BITS / BITS_PER_BYTE]; + mSecureRandom.nextBytes(id); + return BACKUP_KEY_ALIAS_PREFIX + ByteStringUtils.toHexString(id); + } + + /** Constructs a {@link RecoverableKeyStoreSecondaryKeyManager}. */ + public interface RecoverableKeyStoreSecondaryKeyManagerProvider { + /** Returns a newly constructed {@link RecoverableKeyStoreSecondaryKeyManager}. */ + RecoverableKeyStoreSecondaryKeyManager get(); + } +} diff --git a/services/backup/java/com/android/server/backup/encryption/keys/TertiaryKeyGenerator.java b/services/backup/java/com/android/server/backup/encryption/keys/TertiaryKeyGenerator.java new file mode 100644 index 000000000000..ebf09dfd6ba6 --- /dev/null +++ b/services/backup/java/com/android/server/backup/encryption/keys/TertiaryKeyGenerator.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.backup.encryption.keys; + +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; + +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; + +/** 256-bit AES key generator. Each app should have its own separate AES key. */ +public class TertiaryKeyGenerator { + private static final int KEY_SIZE_BITS = 256; + private static final String KEY_ALGORITHM = "AES"; + + private final KeyGenerator mKeyGenerator; + + /** New instance generating keys using {@code secureRandom}. */ + public TertiaryKeyGenerator(SecureRandom secureRandom) { + try { + mKeyGenerator = KeyGenerator.getInstance(KEY_ALGORITHM); + mKeyGenerator.init(KEY_SIZE_BITS, secureRandom); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException( + "Impossible condition: JCE thinks it does not support AES.", e); + } + } + + /** Generates a new random AES key. */ + public SecretKey generate() { + return mKeyGenerator.generateKey(); + } +} diff --git a/services/backup/java/com/android/server/backup/encryption/keys/TertiaryKeyRotationTracker.java b/services/backup/java/com/android/server/backup/encryption/keys/TertiaryKeyRotationTracker.java new file mode 100644 index 000000000000..ec90f6c8c95e --- /dev/null +++ b/services/backup/java/com/android/server/backup/encryption/keys/TertiaryKeyRotationTracker.java @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.backup.encryption.keys; + +import android.content.Context; +import android.content.SharedPreferences; +import android.util.Slog; + +import com.android.internal.annotations.VisibleForTesting; + +import java.util.Locale; + +/** + * Tracks when a tertiary key rotation is due. + * + * <p>After a certain number of incremental backups, the device schedules a full backup, which will + * generate a new encryption key, effecting a key rotation. We should do this on a regular basis so + * that if a key does become compromised it has limited value to the attacker. + * + * <p>No additional synchronization of this class is provided. Only one instance should be used at + * any time. This should be fine as there should be no parallelism in backups. + */ +public class TertiaryKeyRotationTracker { + private static final int MAX_BACKUPS_UNTIL_TERTIARY_KEY_ROTATION = 31; + private static final String SHARED_PREFERENCES_NAME = "tertiary_key_rotation_tracker"; + + private static final String TAG = "TertiaryKeyRotationTracker"; + private static final boolean DEBUG = false; + + /** + * A new instance, using {@code context} to commit data to disk via {@link SharedPreferences}. + */ + public static TertiaryKeyRotationTracker getInstance(Context context) { + return new TertiaryKeyRotationTracker( + context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)); + } + + private final SharedPreferences mSharedPreferences; + + /** New instance, storing data in {@code mSharedPreferences}. */ + @VisibleForTesting + TertiaryKeyRotationTracker(SharedPreferences sharedPreferences) { + mSharedPreferences = sharedPreferences; + } + + /** + * Returns {@code true} if the given app is due having its key rotated. + * + * @param packageName The package name of the app. + */ + public boolean isKeyRotationDue(String packageName) { + return getBackupsSinceRotation(packageName) >= MAX_BACKUPS_UNTIL_TERTIARY_KEY_ROTATION; + } + + /** + * Records that an incremental backup has occurred. Each incremental backup brings the app + * closer to the time when its key should be rotated. + * + * @param packageName The package name of the app for which the backup occurred. + */ + public void recordBackup(String packageName) { + int backupsSinceRotation = getBackupsSinceRotation(packageName) + 1; + mSharedPreferences.edit().putInt(packageName, backupsSinceRotation).apply(); + if (DEBUG) { + Slog.d( + TAG, + String.format( + Locale.US, + "Incremental backup for %s. %d backups until key rotation.", + packageName, + Math.max( + 0, + MAX_BACKUPS_UNTIL_TERTIARY_KEY_ROTATION + - backupsSinceRotation))); + } + } + + /** + * Resets the rotation delay for the given app. Should be invoked after a key rotation. + * + * @param packageName Package name of the app whose key has rotated. + */ + public void resetCountdown(String packageName) { + mSharedPreferences.edit().putInt(packageName, 0).apply(); + } + + /** Marks all enrolled packages for key rotation. */ + public void markAllForRotation() { + SharedPreferences.Editor editor = mSharedPreferences.edit(); + for (String packageName : mSharedPreferences.getAll().keySet()) { + editor.putInt(packageName, MAX_BACKUPS_UNTIL_TERTIARY_KEY_ROTATION); + } + editor.apply(); + } + + private int getBackupsSinceRotation(String packageName) { + return mSharedPreferences.getInt(packageName, 0); + } +} diff --git a/services/core/java/com/android/server/AbstractMasterSystemService.java b/services/core/java/com/android/server/AbstractMasterSystemService.java index 1759ce195485..76010b346a3b 100644 --- a/services/core/java/com/android/server/AbstractMasterSystemService.java +++ b/services/core/java/com/android/server/AbstractMasterSystemService.java @@ -39,6 +39,7 @@ import android.util.SparseBooleanArray; import com.android.internal.annotations.GuardedBy; import com.android.internal.content.PackageMonitor; import com.android.internal.os.BackgroundThread; +import com.android.internal.util.Preconditions; import java.io.PrintWriter; import java.util.List; @@ -211,6 +212,66 @@ public abstract class AbstractMasterSystemService<M extends AbstractMasterSystem } /** + * Temporary sets the service implementation. + * + * <p>Typically used by Shell command and/or CTS tests. + * + * @param componentName name of the new component + * @param durationMs how long the change will be valid (the service will be automatically reset + * to the default component after this timeout expires). + * @throws SecurityException if caller is not allowed to manage this service's settings. + * @throws IllegalArgumentException if value of {@code durationMs} is higher than + * {@link #getMaximumTemporaryServiceDurationMs()}. + */ + public final void setTemporaryService(@UserIdInt int userId, @NonNull String componentName, + int durationMs) { + Slog.i(mTag, "setTemporaryService(" + userId + ") to " + componentName + " for " + + durationMs + "ms"); + enforceCallingPermissionForManagement(); + + Preconditions.checkNotNull(componentName); + final int maxDurationMs = getMaximumTemporaryServiceDurationMs(); + if (durationMs > maxDurationMs) { + throw new IllegalArgumentException( + "Max duration is " + maxDurationMs + " (called with " + durationMs + ")"); + } + + synchronized (mLock) { + final S service = getServiceForUserLocked(userId); + if (service != null) { + service.setTemporaryServiceLocked(componentName, durationMs); + } + } + } + + /** + * Gets the maximum time the service implementation can be changed. + * + * @throws UnsupportedOperationException if subclass doesn't override it. + */ + protected int getMaximumTemporaryServiceDurationMs() { + throw new UnsupportedOperationException("Not implemented by " + getClass()); + } + + /** + * Resets the temporary service implementation to the default component. + * + * <p>Typically used by Shell command and/or CTS tests. + * + * @throws SecurityException if caller is not allowed to manage this service's settings. + */ + public final void resetTemporaryService(@UserIdInt int userId) { + Slog.i(mTag, "resetTemporaryService(): " + userId); + enforceCallingPermissionForManagement(); + synchronized (mLock) { + final S service = getServiceForUserLocked(userId); + if (service != null) { + service.resetTemporaryServiceLocked(); + } + } + } + + /** * Asserts that the caller has permissions to manage this service. * * <p>Typically called by {@code ShellCommand} implementations. diff --git a/services/core/java/com/android/server/AbstractPerUserSystemService.java b/services/core/java/com/android/server/AbstractPerUserSystemService.java index 001d85f1b798..a26102d57297 100644 --- a/services/core/java/com/android/server/AbstractPerUserSystemService.java +++ b/services/core/java/com/android/server/AbstractPerUserSystemService.java @@ -26,12 +26,17 @@ import android.content.pm.PackageItemInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ServiceInfo; import android.graphics.drawable.Drawable; +import android.os.Handler; +import android.os.Looper; +import android.os.Message; import android.os.Process; import android.os.RemoteException; +import android.os.SystemClock; import android.os.UserManager; import android.provider.Settings; import android.text.TextUtils; import android.util.Slog; +import android.util.TimeUtils; import com.android.internal.annotations.GuardedBy; @@ -49,6 +54,9 @@ import java.io.PrintWriter; public abstract class AbstractPerUserSystemService<S extends AbstractPerUserSystemService<S, M>, M extends AbstractMasterSystemService<M, S>> { + /** Handler message to {@link #resetTemporaryServiceLocked()} */ + private static final int MSG_RESET_TEMPORARY_SERVICE = 0; + protected final @UserIdInt int mUserId; protected final Object mLock; protected final String mTag = getClass().getSimpleName(); @@ -70,6 +78,26 @@ public abstract class AbstractPerUserSystemService<S extends AbstractPerUserSyst @GuardedBy("mLock") private ServiceInfo mServiceInfo; + /** + * Temporary service name set by {@link #setTemporaryServiceLocked(String, int)}. + * + * <p>Typically used by Shell command and/or CTS tests. + */ + @GuardedBy("mLock") + private String mTemporaryServiceName; + + /** + * When the temporary service will expire (and reset back to the default). + */ + @GuardedBy("mLock") + private long mTemporaryServiceExpiration; + + /** + * Handler used to reset the temporary service name. + */ + @GuardedBy("mLock") + private Handler mTemporaryHandler; + protected AbstractPerUserSystemService(@NonNull M master, @NonNull Object lock, @UserIdInt int userId) { mMaster = master; @@ -130,7 +158,7 @@ public abstract class AbstractPerUserSystemService<S extends AbstractPerUserSyst mDisabled = disabled; ComponentName serviceComponent = null; ServiceInfo serviceInfo = null; - final String componentName = getComponentNameFromSettings(); + final String componentName = getComponentNameLocked(); if (!TextUtils.isEmpty(componentName)) { try { serviceComponent = ComponentName.unflattenFromString(componentName); @@ -191,6 +219,29 @@ public abstract class AbstractPerUserSystemService<S extends AbstractPerUserSyst } /** + * Gets the current name of the service, which is either the + * {@link #getDefaultComponentName() default service} or the + * {@link #setTemporaryServiceLocked(String, int) temporary one}. + */ + protected final String getComponentNameLocked() { + if (mTemporaryServiceName != null) { + // Always log it, as it should only be used on CTS or during development + Slog.w(mTag, "getComponentName(): using temporary name " + mTemporaryServiceName); + return mTemporaryServiceName; + } + return getDefaultComponentName(); + } + + /** + * Gets the name of the default component for the service. + * + * <p>Typically implemented by returning {@link #getComponentNameFromSettings()} or by using + * a string from the system resources. + */ + @Nullable + protected abstract String getDefaultComponentName(); + + /** * Gets this name of the remote service this service binds to as defined by {@link Settings}. */ @Nullable @@ -201,6 +252,66 @@ public abstract class AbstractPerUserSystemService<S extends AbstractPerUserSyst } /** + * Checks whether the current service for the user was temporarily set. + */ + public final boolean isTemporaryServiceSetLocked() { + return mTemporaryServiceName != null; + } + + /** + * Temporary sets the service implementation. + * + * @param componentName name of the new component + * @param durationMs how long the change will be valid (the service will be automatically reset + * to the default component after this timeout expires). + */ + protected final void setTemporaryServiceLocked(@NonNull String componentName, int durationMs) { + mTemporaryServiceName = componentName; + + if (mTemporaryHandler == null) { + mTemporaryHandler = new Handler(Looper.getMainLooper(), null, true) { + @Override + public void handleMessage(Message msg) { + if (msg.what == MSG_RESET_TEMPORARY_SERVICE) { + synchronized (mLock) { + resetTemporaryServiceLocked(); + } + } else { + Slog.wtf(mTag, "invalid handler msg: " + msg); + } + } + }; + } else { + removeResetTemporaryServiceMessageLocked(); + } + mTemporaryServiceExpiration = SystemClock.elapsedRealtime() + durationMs; + mTemporaryHandler.sendEmptyMessageDelayed(MSG_RESET_TEMPORARY_SERVICE, durationMs); + + updateLocked(mDisabled); + } + + private void removeResetTemporaryServiceMessageLocked() { + if (mMaster.verbose) { + Slog.v(mTag, "setTemporaryServiceLocked(): removing old message"); + } + // NOTE: caller should already have checked it + mTemporaryHandler.removeMessages(MSG_RESET_TEMPORARY_SERVICE); + } + + /** + * Resets the temporary service implementation to the default component. + */ + protected final void resetTemporaryServiceLocked() { + Slog.i(mTag, "resetting temporary service from " + mTemporaryServiceName); + mTemporaryServiceName = null; + if (mTemporaryHandler != null) { + removeResetTemporaryServiceMessageLocked(); + mTemporaryHandler = null; + } + updateLocked(mDisabled); + } + + /** * Gets the {@link ComponentName} of the remote service this service binds to, or {@code null} * if the service is disabled. */ @@ -290,12 +401,14 @@ public abstract class AbstractPerUserSystemService<S extends AbstractPerUserSyst pw.print(prefix); pw.print("Service UID: "); pw.println(mServiceInfo.applicationInfo.uid); } - final String componentName = getComponentNameFromSettings(); - if (componentName != null) { - pw.print(prefix); pw.print("Service name: "); - pw.println(componentName); + if (mTemporaryServiceName != null) { + pw.print(prefix); pw.print("Temporary service name: "); pw.print(mTemporaryServiceName); + final long ttl = mTemporaryServiceExpiration - SystemClock.elapsedRealtime(); + pw.print(" (expires in "); TimeUtils.formatDuration(ttl, pw); pw.println(")"); + pw.print(prefix); pw.print(prefix); + pw.print("Default service name: "); pw.println(getDefaultComponentName()); } else { - pw.println("No service package set"); + pw.print(prefix); pw.print("Service name: "); pw.println(getDefaultComponentName()); } } } diff --git a/services/core/java/com/android/server/BinderCallsStatsService.java b/services/core/java/com/android/server/BinderCallsStatsService.java index 01716a0ea40a..81f0259bfd71 100644 --- a/services/core/java/com/android/server/BinderCallsStatsService.java +++ b/services/core/java/com/android/server/BinderCallsStatsService.java @@ -116,6 +116,7 @@ public class BinderCallsStatsService extends Binder { } mEnabled = enabled; mBinderCallsStats.reset(); + mBinderCallsStats.setAddDebugEntries(enabled); } } } diff --git a/services/core/java/com/android/server/IpSecService.java b/services/core/java/com/android/server/IpSecService.java index 7ee3d3b3bdc7..126bf6556538 100644 --- a/services/core/java/com/android/server/IpSecService.java +++ b/services/core/java/com/android/server/IpSecService.java @@ -1236,7 +1236,8 @@ public class IpSecService extends IIpSecService.Stub { OsConstants.UDP_ENCAP, OsConstants.UDP_ENCAP_ESPINUDP); - mSrvConfig.getNetdInstance().ipSecSetEncapSocketOwner(sockFd, callingUid); + mSrvConfig.getNetdInstance().ipSecSetEncapSocketOwner( + new ParcelFileDescriptor(sockFd), callingUid); if (port != 0) { Log.v(TAG, "Binding to port " + port); Os.bind(sockFd, INADDR_ANY, port); @@ -1696,7 +1697,7 @@ public class IpSecService extends IIpSecService.Stub { mSrvConfig .getNetdInstance() .ipSecApplyTransportModeTransform( - socket.getFileDescriptor(), + socket, callingUid, direction, c.getSourceAddress(), @@ -1715,7 +1716,7 @@ public class IpSecService extends IIpSecService.Stub { throws RemoteException { mSrvConfig .getNetdInstance() - .ipSecRemoveTransportModeTransform(socket.getFileDescriptor()); + .ipSecRemoveTransportModeTransform(socket); } /** diff --git a/services/core/java/com/android/server/LooperStatsService.java b/services/core/java/com/android/server/LooperStatsService.java index c563ad224da6..fa3babad639d 100644 --- a/services/core/java/com/android/server/LooperStatsService.java +++ b/services/core/java/com/android/server/LooperStatsService.java @@ -94,6 +94,8 @@ public class LooperStatsService extends Binder { if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return; pw.print("Start time: "); pw.println(DateFormat.format("yyyy-MM-dd HH:mm:ss", mStats.getStartTimeMillis())); + pw.print("On battery time (ms): "); + pw.println(mStats.getBatteryTimeMillis()); final List<LooperStats.ExportedEntry> entries = mStats.getEntries(); entries.sort(Comparator .comparing((LooperStats.ExportedEntry entry) -> entry.workSourceUid) diff --git a/services/core/java/com/android/server/display/ColorDisplayService.java b/services/core/java/com/android/server/display/ColorDisplayService.java index 0b6786cf8c07..521fa236cf7d 100644 --- a/services/core/java/com/android/server/display/ColorDisplayService.java +++ b/services/core/java/com/android/server/display/ColorDisplayService.java @@ -16,6 +16,8 @@ package com.android.server.display; +import static com.android.server.display.DisplayTransformManager.LEVEL_COLOR_MATRIX_NIGHT_DISPLAY; + import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.TypeEvaluator; @@ -29,8 +31,10 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.database.ContentObserver; +import android.hardware.display.IColorDisplayManager; import android.net.Uri; import android.opengl.Matrix; +import android.os.Binder; import android.os.Handler; import android.os.Looper; import android.os.UserHandle; @@ -39,6 +43,7 @@ import android.util.MathUtils; import android.util.Slog; import android.view.animation.AnimationUtils; +import com.android.internal.R; import com.android.internal.app.ColorDisplayController; import com.android.server.SystemService; import com.android.server.twilight.TwilightListener; @@ -49,12 +54,8 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneId; -import com.android.internal.R; - -import static com.android.server.display.DisplayTransformManager.LEVEL_COLOR_MATRIX_NIGHT_DISPLAY; - /** - * Tints the display at night. + * Controls the display's color transforms. */ public final class ColorDisplayService extends SystemService implements ColorDisplayController.Callback { @@ -101,7 +102,7 @@ public final class ColorDisplayService extends SystemService @Override public void onStart() { - // Nothing to publish. + publishBinderService(Context.COLOR_DISPLAY_SERVICE, new BinderService()); } @Override @@ -171,7 +172,7 @@ public final class ColorDisplayService extends SystemService } }; cr.registerContentObserver(Secure.getUriFor(Secure.USER_SETUP_COMPLETE), - false /* notifyForDescendents */, mUserSetupObserver, mCurrentUser); + false /* notifyForDescendants */, mUserSetupObserver, mCurrentUser); } else if (mBootCompleted) { setUp(); } @@ -405,8 +406,8 @@ public final class ColorDisplayService extends SystemService } /** - * Returns the first date time corresponding to the local time that occurs before the - * provided date time. + * Returns the first date time corresponding to the local time that occurs before the provided + * date time. * * @param compareTime the LocalDateTime to compare against * @return the prior LocalDateTime corresponding to this local time @@ -420,8 +421,8 @@ public final class ColorDisplayService extends SystemService } /** - * Returns the first date time corresponding to this local time that occurs after the - * provided date time. + * Returns the first date time corresponding to this local time that occurs after the provided + * date time. * * @param compareTime the LocalDateTime to compare against * @return the next LocalDateTime corresponding to this local time @@ -434,6 +435,11 @@ public final class ColorDisplayService extends SystemService return ldt.isBefore(compareTime) ? ldt.plusDays(1) : ldt; } + private boolean isDeviceColorManagedInternal() { + final DisplayTransformManager dtm = getLocalService(DisplayTransformManager.class); + return dtm.isDeviceColorManaged(); + } + private abstract class AutoMode implements ColorDisplayController.Callback { public abstract void onStart(); @@ -616,4 +622,16 @@ public final class ColorDisplayService extends SystemService return mResultMatrix; } } + + private final class BinderService extends IColorDisplayManager.Stub { + @Override + public boolean isDeviceColorManaged() { + final long token = Binder.clearCallingIdentity(); + try { + return isDeviceColorManagedInternal(); + } finally { + Binder.restoreCallingIdentity(token); + } + } + } } diff --git a/services/core/java/com/android/server/display/DisplayTransformManager.java b/services/core/java/com/android/server/display/DisplayTransformManager.java index d6931e006479..5ca1755131ab 100644 --- a/services/core/java/com/android/server/display/DisplayTransformManager.java +++ b/services/core/java/com/android/server/display/DisplayTransformManager.java @@ -16,7 +16,6 @@ package com.android.server.display; -import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.opengl.Matrix; import android.os.IBinder; @@ -27,8 +26,10 @@ import android.os.SystemProperties; import android.util.Log; import android.util.Slog; import android.util.SparseArray; + import com.android.internal.annotations.GuardedBy; import com.android.internal.app.ColorDisplayController; + import java.util.Arrays; /** @@ -59,10 +60,6 @@ public class DisplayTransformManager { private static final int SURFACE_FLINGER_TRANSACTION_COLOR_MATRIX = 1015; private static final int SURFACE_FLINGER_TRANSACTION_DALTONIZER = 1014; - - private static final String PERSISTENT_PROPERTY_SATURATION = "persist.sys.sf.color_saturation"; - private static final String PERSISTENT_PROPERTY_DISPLAY_COLOR = "persist.sys.sf.native_mode"; - /** * SurfaceFlinger global saturation factor. */ @@ -71,6 +68,10 @@ public class DisplayTransformManager { * SurfaceFlinger display color (managed, unmanaged, etc.). */ private static final int SURFACE_FLINGER_TRANSACTION_DISPLAY_COLOR = 1023; + private static final int SURFACE_FLINGER_TRANSACTION_QUERY_WIDE_COLOR = 1030; + + private static final String PERSISTENT_PROPERTY_SATURATION = "persist.sys.sf.color_saturation"; + private static final String PERSISTENT_PROPERTY_DISPLAY_COLOR = "persist.sys.sf.native_mode"; private static final float COLOR_SATURATION_NATURAL = 1.0f; private static final float COLOR_SATURATION_BOOSTED = 1.1f; @@ -269,6 +270,29 @@ public class DisplayTransformManager { } /** + * Returns whether the screen is wide color gamut via SurfaceFlinger's + * {@link #SURFACE_FLINGER_TRANSACTION_QUERY_WIDE_COLOR}. + */ + public boolean isDeviceColorManaged() { + final IBinder flinger = ServiceManager.getService(SURFACE_FLINGER); + if (flinger != null) { + final Parcel data = Parcel.obtain(); + final Parcel reply = Parcel.obtain(); + data.writeInterfaceToken("android.ui.ISurfaceComposer"); + try { + flinger.transact(SURFACE_FLINGER_TRANSACTION_QUERY_WIDE_COLOR, data, reply, 0); + return reply.readBoolean(); + } catch (RemoteException ex) { + Log.e(TAG, "Failed to query wide color support", ex); + } finally { + data.recycle(); + reply.recycle(); + } + } + return false; + } + + /** * Propagates the provided saturation to the SurfaceFlinger. */ private void applySaturation(float saturation) { diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index b148a2f3fff5..c0d3fdfb8f91 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -980,7 +980,7 @@ public class HdmiControlService extends SystemService { * @param sourceAddress a logical address of source device where sends polling message * @param pickStrategy strategy how to pick polling candidates * @param retryCount the number of retry used to send polling message to remote devices - * @throw IllegalArgumentException if {@code pickStrategy} is invalid value + * @throws IllegalArgumentException if {@code pickStrategy} is invalid value */ @ServiceThreadOnly void pollDevices(DevicePollingCallback callback, int sourceAddress, int pickStrategy, diff --git a/services/core/java/com/android/server/notification/NotificationComparator.java b/services/core/java/com/android/server/notification/NotificationComparator.java index 2584187fffe6..9b9f4de7a18f 100644 --- a/services/core/java/com/android/server/notification/NotificationComparator.java +++ b/services/core/java/com/android/server/notification/NotificationComparator.java @@ -15,12 +15,15 @@ */ package com.android.server.notification; +import static android.app.NotificationManager.IMPORTANCE_DEFAULT; + import android.app.Notification; import android.app.NotificationManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.provider.Settings; import android.telecom.TelecomManager; import com.android.internal.util.NotificationMessagingUtil; @@ -47,6 +50,21 @@ public class NotificationComparator @Override public int compare(NotificationRecord left, NotificationRecord right) { + final int leftImportance = left.getImportance(); + final int rightImportance = right.getImportance(); + final boolean isLeftHighImportance = leftImportance >= IMPORTANCE_DEFAULT; + final boolean isRightHighImportance = rightImportance >= IMPORTANCE_DEFAULT; + + // With new interruption model, prefer importance bucket above all other criteria + // (to ensure buckets are contiguous) + if (Settings.Secure.getInt(mContext.getContentResolver(), + Settings.Secure.NOTIFICATION_NEW_INTERRUPTION_MODEL, 1) == 1) { + if (isLeftHighImportance != isRightHighImportance) { + // by importance bucket, high importance higher than low importance + return -1 * Boolean.compare(isLeftHighImportance, isRightHighImportance); + } + } + // first all colorized notifications boolean leftImportantColorized = isImportantColorized(left); boolean rightImportantColorized = isImportantColorized(right); @@ -86,8 +104,6 @@ public class NotificationComparator return -1 * Boolean.compare(leftPeople, rightPeople); } - final int leftImportance = left.getImportance(); - final int rightImportance = right.getImportance(); if (leftImportance != rightImportance) { // by importance, high to low return -1 * Integer.compare(leftImportance, rightImportance); diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 25a1626df865..95e1962fdbfb 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -207,7 +207,6 @@ import com.android.internal.util.Preconditions; import com.android.internal.util.XmlUtils; import com.android.server.DeviceIdleController; import com.android.server.EventLogTags; -import com.android.server.IoThread; import com.android.server.LocalServices; import com.android.server.SystemService; import com.android.server.lights.Light; @@ -266,7 +265,7 @@ public class NotificationManagerService extends SystemService { // message codes static final int MESSAGE_DURATION_REACHED = 2; - // 3: removed to a different handler + static final int MESSAGE_SAVE_POLICY_FILE = 3; static final int MESSAGE_SEND_RANKING_UPDATE = 4; static final int MESSAGE_LISTENER_HINTS_CHANGED = 5; static final int MESSAGE_LISTENER_NOTIFICATION_FILTER_CHANGED = 6; @@ -574,7 +573,7 @@ public class NotificationManagerService extends SystemService { mListeners.migrateToXml(); mAssistants.migrateToXml(); mConditionProviders.migrateToXml(); - handleSavePolicyFile(); + savePolicyFile(); } mAssistants.ensureAssistant(); @@ -604,28 +603,34 @@ public class NotificationManagerService extends SystemService { } } + /** + * Saves notification policy + */ + public void savePolicyFile() { + mHandler.removeMessages(MESSAGE_SAVE_POLICY_FILE); + mHandler.sendEmptyMessage(MESSAGE_SAVE_POLICY_FILE); + } + private void handleSavePolicyFile() { - IoThread.getHandler().post(() -> { - if (DBG) Slog.d(TAG, "handleSavePolicyFile"); - synchronized (mPolicyFile) { - final FileOutputStream stream; - try { - stream = mPolicyFile.startWrite(); - } catch (IOException e) { - Slog.w(TAG, "Failed to save policy file", e); - return; - } + if (DBG) Slog.d(TAG, "handleSavePolicyFile"); + synchronized (mPolicyFile) { + final FileOutputStream stream; + try { + stream = mPolicyFile.startWrite(); + } catch (IOException e) { + Slog.w(TAG, "Failed to save policy file", e); + return; + } - try { - writePolicyXml(stream, false /*forBackup*/); - mPolicyFile.finishWrite(stream); - } catch (IOException e) { - Slog.w(TAG, "Failed to save policy file, restoring backup", e); - mPolicyFile.failWrite(stream); - } + try { + writePolicyXml(stream, false /*forBackup*/); + mPolicyFile.finishWrite(stream); + } catch (IOException e) { + Slog.w(TAG, "Failed to save policy file, restoring backup", e); + mPolicyFile.failWrite(stream); } - BackupManager.dataChanged(getContext().getPackageName()); - }); + } + BackupManager.dataChanged(getContext().getPackageName()); } private void writePolicyXml(OutputStream stream, boolean forBackup) throws IOException { @@ -1133,8 +1138,8 @@ public class NotificationManagerService extends SystemService { } } - mHandler.scheduleOnPackageChanged(removingPackage, changeUserId, pkgList, uidList); + savePolicyFile(); } } }; @@ -1201,7 +1206,7 @@ public class NotificationManagerService extends SystemService { mListeners.onUserRemoved(userId); mConditionProviders.onUserRemoved(userId); mAssistants.onUserRemoved(userId); - handleSavePolicyFile(); + savePolicyFile(); } else if (action.equals(Intent.ACTION_USER_UNLOCKED)) { final int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, USER_NULL); mUserProfiles.updateCache(context); @@ -1457,7 +1462,7 @@ public class NotificationManagerService extends SystemService { mZenModeHelper.addCallback(new ZenModeHelper.Callback() { @Override public void onConfigChanged() { - handleSavePolicyFile(); + savePolicyFile(); } @Override @@ -1759,7 +1764,7 @@ public class NotificationManagerService extends SystemService { modifiedChannel, NOTIFICATION_CHANNEL_OR_GROUP_UPDATED); } - handleSavePolicyFile(); + savePolicyFile(); } private void maybeNotifyChannelOwner(String pkg, int uid, NotificationChannel preUpdate, @@ -2227,7 +2232,7 @@ public class NotificationManagerService extends SystemService { Slog.w(TAG, "Can't notify app about app block change", e); } - handleSavePolicyFile(); + savePolicyFile(); } /** @@ -2284,7 +2289,7 @@ public class NotificationManagerService extends SystemService { public void setShowBadge(String pkg, int uid, boolean showBadge) { checkCallerIsSystem(); mPreferencesHelper.setShowBadge(pkg, uid, showBadge); - handleSavePolicyFile(); + savePolicyFile(); } @Override @@ -2300,7 +2305,7 @@ public class NotificationManagerService extends SystemService { if (info != null) { mPreferencesHelper.setNotificationDelegate( callingPkg, callingUid, delegate, info.uid); - handleSavePolicyFile(); + savePolicyFile(); } } catch (RemoteException e) { // :( @@ -2311,7 +2316,7 @@ public class NotificationManagerService extends SystemService { public void revokeNotificationDelegate(String callingPkg) { checkCallerIsSameApp(callingPkg); mPreferencesHelper.revokeNotificationDelegate(callingPkg, Binder.getCallingUid()); - handleSavePolicyFile(); + savePolicyFile(); } @Override @@ -2346,7 +2351,7 @@ public class NotificationManagerService extends SystemService { NotificationChannelGroup group) throws RemoteException { enforceSystemOrSystemUI("Caller not system or systemui"); createNotificationChannelGroup(pkg, uid, group, false, false); - handleSavePolicyFile(); + savePolicyFile(); } @Override @@ -2359,7 +2364,7 @@ public class NotificationManagerService extends SystemService { final NotificationChannelGroup group = groups.get(i); createNotificationChannelGroup(pkg, Binder.getCallingUid(), group, true, false); } - handleSavePolicyFile(); + savePolicyFile(); } private void createNotificationChannelsImpl(String pkg, int uid, @@ -2377,7 +2382,7 @@ public class NotificationManagerService extends SystemService { mPreferencesHelper.getNotificationChannel(pkg, uid, channel.getId(), false), NOTIFICATION_CHANNEL_OR_GROUP_ADDED); } - handleSavePolicyFile(); + savePolicyFile(); } @Override @@ -2422,7 +2427,7 @@ public class NotificationManagerService extends SystemService { UserHandle.getUserHandleForUid(callingUid), mPreferencesHelper.getNotificationChannel(pkg, callingUid, channelId, true), NOTIFICATION_CHANNEL_OR_GROUP_DELETED); - handleSavePolicyFile(); + savePolicyFile(); } @Override @@ -2464,7 +2469,7 @@ public class NotificationManagerService extends SystemService { mListeners.notifyNotificationChannelGroupChanged( pkg, UserHandle.getUserHandleForUid(callingUid), groupToDelete, NOTIFICATION_CHANNEL_OR_GROUP_DELETED); - handleSavePolicyFile(); + savePolicyFile(); } } @@ -2597,7 +2602,7 @@ public class NotificationManagerService extends SystemService { true, UserHandle.getCallingUserId(), packages, uids); } - handleSavePolicyFile(); + savePolicyFile(); } @@ -3385,7 +3390,7 @@ public class NotificationManagerService extends SystemService { final ByteArrayInputStream bais = new ByteArrayInputStream(payload); try { readPolicyXml(bais, true /*forRestore*/); - handleSavePolicyFile(); + savePolicyFile(); } catch (NumberFormatException | XmlPullParserException | IOException e) { Slog.w(TAG, "applyRestore: error reading payload", e); } @@ -3426,7 +3431,7 @@ public class NotificationManagerService extends SystemService { .setPackage(pkg) .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY), UserHandle.of(userId), null); - handleSavePolicyFile(); + savePolicyFile(); } } finally { Binder.restoreCallingIdentity(identity); @@ -3570,7 +3575,7 @@ public class NotificationManagerService extends SystemService { .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY), UserHandle.of(userId), null); - handleSavePolicyFile(); + savePolicyFile(); } } finally { Binder.restoreCallingIdentity(identity); @@ -3596,7 +3601,7 @@ public class NotificationManagerService extends SystemService { .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY), UserHandle.of(userId), null); - handleSavePolicyFile(); + savePolicyFile(); } } finally { Binder.restoreCallingIdentity(identity); @@ -3679,7 +3684,7 @@ public class NotificationManagerService extends SystemService { verifyPrivilegedListener(token, user, false); createNotificationChannelGroup( pkg, getUidForPackageAndUser(pkg, user), group, false, true); - handleSavePolicyFile(); + savePolicyFile(); } @Override @@ -3728,7 +3733,7 @@ public class NotificationManagerService extends SystemService { } if (allow != mLockScreenAllowSecureNotifications) { mLockScreenAllowSecureNotifications = allow; - handleSavePolicyFile(); + savePolicyFile(); } } @@ -4487,7 +4492,7 @@ public class NotificationManagerService extends SystemService { Slog.d(TAG, "Ignored enqueue for snoozed notification " + r.getKey()); } mSnoozeHelper.update(userId, r); - handleSavePolicyFile(); + savePolicyFile(); return false; } @@ -4618,7 +4623,7 @@ public class NotificationManagerService extends SystemService { mSnoozeHelper.snooze(r, mDuration); } r.recordSnoozed(); - handleSavePolicyFile(); + savePolicyFile(); } } @@ -4696,7 +4701,7 @@ public class NotificationManagerService extends SystemService { if (mReason != REASON_SNOOZED) { final boolean wasSnoozed = mSnoozeHelper.cancel(mUserId, mPkg, mTag, mId); if (wasSnoozed) { - handleSavePolicyFile(); + savePolicyFile(); } } } @@ -5740,6 +5745,9 @@ public class NotificationManagerService extends SystemService { case MESSAGE_FINISH_TOKEN_TIMEOUT: handleKillTokenTimeout((ToastRecord) msg.obj); break; + case MESSAGE_SAVE_POLICY_FILE: + handleSavePolicyFile(); + break; case MESSAGE_SEND_RANKING_UPDATE: handleSendRankingUpdate(); break; @@ -6257,7 +6265,7 @@ public class NotificationManagerService extends SystemService { Slog.d(TAG, String.format("unsnooze event(%s, %s)", key, listenerName)); } mSnoozeHelper.repost(key); - handleSavePolicyFile(); + savePolicyFile(); } @GuardedBy("mNotificationLock") diff --git a/services/core/java/com/android/server/signedconfig/SignedConfigApplicator.java b/services/core/java/com/android/server/signedconfig/SignedConfigApplicator.java new file mode 100644 index 000000000000..7ce071faab04 --- /dev/null +++ b/services/core/java/com/android/server/signedconfig/SignedConfigApplicator.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.signedconfig; + +import android.content.Context; + +class SignedConfigApplicator { + + static void applyConfig(Context context, String config, String signature) { + //TODO verify signature + //TODO parse & apply config + } + +} diff --git a/services/core/java/com/android/server/signedconfig/SignedConfigService.java b/services/core/java/com/android/server/signedconfig/SignedConfigService.java new file mode 100644 index 000000000000..148568628397 --- /dev/null +++ b/services/core/java/com/android/server/signedconfig/SignedConfigService.java @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.signedconfig; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManagerInternal; +import android.net.Uri; +import android.os.Bundle; +import android.util.Slog; + +import com.android.server.LocalServices; + +/** + * Signed config service. This is not an Android Service, but just owns a broadcast receiver for + * receiving package install and update notifications from the package manager. + */ +public class SignedConfigService { + + private static final boolean DBG = false; + private static final String TAG = "SignedConfig"; + + // TODO should these be elsewhere? In a public API? + private static final String KEY_CONFIG = "android.signedconfig"; + private static final String KEY_CONFIG_SIGNATURE = "android.signedconfig.signature"; + + private static class UpdateReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + new SignedConfigService(context).handlePackageBroadcast(intent); + } + } + + private final Context mContext; + private final PackageManagerInternal mPacMan; + + public SignedConfigService(Context context) { + mContext = context; + mPacMan = LocalServices.getService(PackageManagerInternal.class); + } + + void handlePackageBroadcast(Intent intent) { + if (DBG) Slog.d(TAG, "handlePackageBroadcast " + intent); + Uri packageData = intent.getData(); + String packageName = packageData == null ? null : packageData.getSchemeSpecificPart(); + if (DBG) Slog.d(TAG, "handlePackageBroadcast package=" + packageName); + if (packageName == null) { + return; + } + int userId = mContext.getUser().getIdentifier(); + PackageInfo pi = mPacMan.getPackageInfo(packageName, PackageManager.GET_META_DATA, + android.os.Process.SYSTEM_UID, userId); + if (pi == null) { + Slog.w(TAG, "Got null PackageInfo for " + packageName + "; user " + userId); + return; + } + Bundle metaData = pi.applicationInfo.metaData; + if (metaData == null) { + if (DBG) Slog.d(TAG, "handlePackageBroadcast: no metadata"); + return; + } + if (metaData.containsKey(KEY_CONFIG) + && metaData.containsKey(KEY_CONFIG_SIGNATURE)) { + String config = metaData.getString(KEY_CONFIG); + String signature = metaData.getString(KEY_CONFIG_SIGNATURE); + if (DBG) { + Slog.d(TAG, "Got signed config: " + config); + Slog.d(TAG, "Got config signature: " + signature); + } + SignedConfigApplicator.applyConfig(mContext, config, signature); + } else { + if (DBG) Slog.d(TAG, "Package has no config/signature."); + } + } + + /** + * Register to receive broadcasts from the package manager. + */ + public static void registerUpdateReceiver(Context context) { + if (DBG) Slog.d(TAG, "Registering receiver"); + IntentFilter filter = new IntentFilter(); + filter.addAction(Intent.ACTION_PACKAGE_ADDED); + filter.addAction(Intent.ACTION_PACKAGE_REPLACED); + filter.addDataScheme("package"); + context.registerReceiver(new UpdateReceiver(), filter); + } +} diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java index e645b84e83a0..6e4c00eed181 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java @@ -17,6 +17,7 @@ package com.android.server.statusbar; import static android.app.StatusBarManager.DISABLE2_GLOBAL_ACTIONS; +import static android.view.Display.DEFAULT_DISPLAY; import android.app.ActivityThread; import android.app.Notification; @@ -25,6 +26,8 @@ import android.content.ComponentName; import android.content.Context; import android.graphics.Rect; import android.hardware.biometrics.IBiometricServiceReceiverInternal; +import android.hardware.display.DisplayManager; +import android.hardware.display.DisplayManager.DisplayListener; import android.os.Binder; import android.os.Bundle; import android.os.Handler; @@ -40,7 +43,7 @@ import android.text.TextUtils; import android.util.ArrayMap; import android.util.Log; import android.util.Slog; -import android.view.Display; +import android.util.SparseArray; import com.android.internal.R; import com.android.internal.statusbar.IStatusBar; @@ -63,7 +66,7 @@ import java.util.List; * A note on locking: We rely on the fact that calls onto mBar are oneway or * if they are local, that they just enqueue messages to not deadlock. */ -public class StatusBarManagerService extends IStatusBarService.Stub { +public class StatusBarManagerService extends IStatusBarService.Stub implements DisplayListener { private static final String TAG = "StatusBarManagerService"; private static final boolean SPEW = false; @@ -79,24 +82,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub { private final ArrayList<DisableRecord> mDisableRecords = new ArrayList<DisableRecord>(); private GlobalActionsProvider.GlobalActionsListener mGlobalActionListener; private IBinder mSysUiVisToken = new Binder(); - private int mDisabled1 = 0; - private int mDisabled2 = 0; private final Object mLock = new Object(); private final DeathRecipient mDeathRecipient = new DeathRecipient(); - // encompasses lights-out mode and other flags defined on View - private int mSystemUiVisibility = 0; - private int mFullscreenStackSysUiVisibility; - private int mDockedStackSysUiVisibility; - private final Rect mFullscreenStackBounds = new Rect(); - private final Rect mDockedStackBounds = new Rect(); - private boolean mMenuVisible = false; - private int mImeWindowVis = 0; - private int mImeBackDisposition; - private boolean mShowImeSwitcher; - private IBinder mImeToken = null; private int mCurrentUserId; + private SparseArray<UiState> mDisplayUiState = new SparseArray<>(); + private class DeathRecipient implements IBinder.DeathRecipient { public void binderDied() { mBar.asBinder().unlinkToDeath(this,0); @@ -185,8 +177,29 @@ public class StatusBarManagerService extends IStatusBarService.Stub { LocalServices.addService(StatusBarManagerInternal.class, mInternalService); LocalServices.addService(GlobalActionsProvider.class, mGlobalActionsProvider); + + // We always have a default display. + final UiState state = new UiState(); + mDisplayUiState.put(DEFAULT_DISPLAY, state); + + final DisplayManager displayManager = + (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE); + displayManager.registerDisplayListener(this, mHandler); } + @Override + public void onDisplayAdded(int displayId) {} + + @Override + public void onDisplayRemoved(int displayId) { + synchronized (mLock) { + mDisplayUiState.remove(displayId); + } + } + + @Override + public void onDisplayChanged(int displayId) {} + /** * Private API used by NotificationManagerService. */ @@ -240,22 +253,14 @@ public class StatusBarManagerService extends IStatusBarService.Stub { @Override public void topAppWindowChanged(int displayId, boolean menuVisible) { - if (displayId != Display.DEFAULT_DISPLAY) { - // TODO (b/117478341): Resolve one status bar/ navigation bar assumption - return; - } - StatusBarManagerService.this.topAppWindowChanged(menuVisible); + StatusBarManagerService.this.topAppWindowChanged(displayId, menuVisible); } @Override public void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis, int dockedStackVis, int mask, Rect fullscreenBounds, Rect dockedBounds, String cause) { - if (displayId != Display.DEFAULT_DISPLAY) { - // TODO (b/117478341): Resolve one status bar/ navigation bar assumption - return; - } - StatusBarManagerService.this.setSystemUiVisibility(vis, fullscreenStackVis, + StatusBarManagerService.this.setSystemUiVisibility(displayId, vis, fullscreenStackVis, dockedStackVis, mask, fullscreenBounds, dockedBounds, cause); } @@ -272,13 +277,9 @@ public class StatusBarManagerService extends IStatusBarService.Stub { @Override public void appTransitionFinished(int displayId) { enforceStatusBarService(); - if (displayId != Display.DEFAULT_DISPLAY) { - // TODO (b/117478341): Resolve one status bar/ navigation bar assumption - return; - } if (mBar != null) { try { - mBar.appTransitionFinished(); + mBar.appTransitionFinished(displayId); } catch (RemoteException ex) {} } } @@ -374,39 +375,27 @@ public class StatusBarManagerService extends IStatusBarService.Stub { @Override public void setWindowState(int displayId, int window, int state) { - if (displayId != Display.DEFAULT_DISPLAY) { - // TODO (b/117478341): Resolve one status bar/ navigation bar assumption - return; - } if (mBar != null) { try { - mBar.setWindowState(window, state); + mBar.setWindowState(displayId, window, state); } catch (RemoteException ex) {} } } @Override public void appTransitionPending(int displayId) { - if (displayId != Display.DEFAULT_DISPLAY) { - // TODO (b/117478341): Resolve one status bar/ navigation bar assumption - return; - } if (mBar != null) { try { - mBar.appTransitionPending(); + mBar.appTransitionPending(displayId); } catch (RemoteException ex) {} } } @Override public void appTransitionCancelled(int displayId) { - if (displayId != Display.DEFAULT_DISPLAY) { - // TODO (b/117478341): Resolve one status bar/ navigation bar assumption - return; - } if (mBar != null) { try { - mBar.appTransitionCancelled(); + mBar.appTransitionCancelled(displayId); } catch (RemoteException ex) {} } } @@ -414,14 +403,10 @@ public class StatusBarManagerService extends IStatusBarService.Stub { @Override public void appTransitionStarting(int displayId, long statusBarAnimationsStartTime, long statusBarAnimationsDuration) { - if (displayId != Display.DEFAULT_DISPLAY) { - // TODO (b/117478341): Resolve one status bar/ navigation bar assumption - return; - } if (mBar != null) { try { mBar.appTransitionStarting( - statusBarAnimationsStartTime, statusBarAnimationsDuration); + displayId, statusBarAnimationsStartTime, statusBarAnimationsDuration); } catch (RemoteException ex) {} } } @@ -449,6 +434,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub { return false; } + // TODO(b/118592525): support it per display if necessary. @Override public void onProposedRotationChanged(int rotation, boolean isValid) { if (mBar != null){ @@ -462,7 +448,9 @@ public class StatusBarManagerService extends IStatusBarService.Stub { private final GlobalActionsProvider mGlobalActionsProvider = new GlobalActionsProvider() { @Override public boolean isGlobalActionsDisabled() { - return (mDisabled2 & DISABLE2_GLOBAL_ACTIONS) != 0; + // TODO(b/118592525): support global actions for multi-display. + final int disabled2 = mDisplayUiState.get(DEFAULT_DISPLAY).getDisabled2(); + return (disabled2 & DISABLE2_GLOBAL_ACTIONS) != 0; } @Override @@ -664,20 +652,23 @@ public class StatusBarManagerService extends IStatusBarService.Stub { } } + // TODO(b/117478341): make it aware of multi-display if needed. @Override public void disable(int what, IBinder token, String pkg) { disableForUser(what, token, pkg, mCurrentUserId); } + // TODO(b/117478341): make it aware of multi-display if needed. @Override public void disableForUser(int what, IBinder token, String pkg, int userId) { enforceStatusBar(); synchronized (mLock) { - disableLocked(userId, what, token, pkg, 1); + disableLocked(DEFAULT_DISPLAY, userId, what, token, pkg, 1); } } + // TODO(b/117478341): make it aware of multi-display if needed. /** * Disable additional status bar features. Pass the bitwise-or of the DISABLE2_* flags. * To re-enable everything, pass {@link #DISABLE_NONE}. @@ -689,6 +680,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub { disable2ForUser(what, token, pkg, mCurrentUserId); } + // TODO(b/117478341): make it aware of multi-display if needed. /** * Disable additional status bar features for a given user. Pass the bitwise-or of the * DISABLE2_* flags. To re-enable everything, pass {@link #DISABLE_NONE}. @@ -700,11 +692,12 @@ public class StatusBarManagerService extends IStatusBarService.Stub { enforceStatusBar(); synchronized (mLock) { - disableLocked(userId, what, token, pkg, 2); + disableLocked(DEFAULT_DISPLAY, userId, what, token, pkg, 2); } } - private void disableLocked(int userId, int what, IBinder token, String pkg, int whichFlag) { + private void disableLocked(int displayId, int userId, int what, IBinder token, String pkg, + int whichFlag) { // It's important that the the callback and the call to mBar get done // in the same order when multiple threads are calling this function // so they are paired correctly. The messages on the handler will be @@ -723,22 +716,19 @@ public class StatusBarManagerService extends IStatusBarService.Stub { disabledData += " ([" + i + "] " + tok + "), "; } disabledData += " }"; - Log.d(TAG, "disabledlocked (b/113914868): net1=" + net1 + ", mDisabled1=" + mDisabled1 - + ", token=" + token + ", mDisableRecords=" + mDisableRecords.size() + " => " - + disabledData); - } + final UiState state = getUiState(displayId); - if (net1 != mDisabled1 || net2 != mDisabled2) { - mDisabled1 = net1; - mDisabled2 = net2; - mHandler.post(new Runnable() { - public void run() { - mNotificationDelegate.onSetDisabled(net1); - } - }); + Log.d(TAG, "disabledlocked (b/113914868): displayId=" + displayId + "net1=" + net1 + + ", mDisabled1=" + state.mDisabled1 + ", token=" + token + + ", mDisableRecords=" + mDisableRecords.size() + " => " + disabledData); + } + final UiState state = getUiState(displayId); + if (state.disableEquals(net1, net2)) { + state.setDisabled(net1, net2); + mHandler.post(() -> mNotificationDelegate.onSetDisabled(net1)); if (mBar != null) { try { - mBar.disable(net1, net2); + mBar.disable(displayId, net1, net2); } catch (RemoteException ex) { } } @@ -808,26 +798,27 @@ public class StatusBarManagerService extends IStatusBarService.Stub { * response to a window with {@link android.view.WindowManager.LayoutParams#needsMenuKey} set * to {@link android.view.WindowManager.LayoutParams#NEEDS_MENU_SET_TRUE}. */ - private void topAppWindowChanged(final boolean menuVisible) { + private void topAppWindowChanged(int displayId, final boolean menuVisible) { enforceStatusBar(); - if (SPEW) Slog.d(TAG, (menuVisible?"showing":"hiding") + " MENU key"); - + if (SPEW) { + Slog.d(TAG, "display#" + displayId + ": " + + (menuVisible ? "showing" : "hiding") + " MENU key"); + } synchronized(mLock) { - mMenuVisible = menuVisible; - mHandler.post(new Runnable() { - public void run() { - if (mBar != null) { - try { - mBar.topAppWindowChanged(menuVisible); - } catch (RemoteException ex) { - } + getUiState(displayId).setMenuVisible(menuVisible); + mHandler.post(() -> { + if (mBar != null) { + try { + mBar.topAppWindowChanged(displayId, menuVisible); + } catch (RemoteException ex) { } } }); } } + // TODO(b/117478341): support back button change when IME is showing on a external display. @Override public void setImeWindowStatus(final IBinder token, final int vis, final int backDisposition, final boolean showImeSwitcher) { @@ -841,39 +832,42 @@ public class StatusBarManagerService extends IStatusBarService.Stub { // In case of IME change, we need to call up setImeWindowStatus() regardless of // mImeWindowVis because mImeWindowVis may not have been set to false when the // previous IME was destroyed. - mImeWindowVis = vis; - mImeBackDisposition = backDisposition; - mImeToken = token; - mShowImeSwitcher = showImeSwitcher; - mHandler.post(new Runnable() { - public void run() { - if (mBar != null) { - try { - mBar.setImeWindowStatus(token, vis, backDisposition, showImeSwitcher); - } catch (RemoteException ex) { - } - } - } + // TODO(b/117478341): support back button change when IME is showing on a external + // display. + getUiState(DEFAULT_DISPLAY) + .setImeWindowState(vis, backDisposition, showImeSwitcher, token); + + mHandler.post(() -> { + if (mBar == null) return; + try { + // TODO(b/117478341): support back button change when IME is showing on a + // external display. + mBar.setImeWindowStatus( + DEFAULT_DISPLAY, token, vis, backDisposition, showImeSwitcher); + } catch (RemoteException ex) { } }); } } @Override - public void setSystemUiVisibility(int vis, int mask, String cause) { - setSystemUiVisibility(vis, 0, 0, mask, mFullscreenStackBounds, mDockedStackBounds, cause); + public void setSystemUiVisibility(int displayId, int vis, int mask, String cause) { + final UiState state = getUiState(displayId); + setSystemUiVisibility(displayId, vis, 0, 0, mask, + state.mFullscreenStackBounds, state.mDockedStackBounds, cause); } - private void setSystemUiVisibility(int vis, int fullscreenStackVis, int dockedStackVis, int mask, - Rect fullscreenBounds, Rect dockedBounds, String cause) { + private void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis, + int dockedStackVis, int mask, Rect fullscreenBounds, Rect dockedBounds, String cause) { // also allows calls from window manager which is in this process. enforceStatusBarService(); if (SPEW) Slog.d(TAG, "setSystemUiVisibility(0x" + Integer.toHexString(vis) + ")"); synchronized (mLock) { - updateUiVisibilityLocked(vis, fullscreenStackVis, dockedStackVis, mask, + updateUiVisibilityLocked(displayId, vis, fullscreenStackVis, dockedStackVis, mask, fullscreenBounds, dockedBounds); disableLocked( + displayId, mCurrentUserId, vis & StatusBarManager.DISABLE_MASK, mSysUiVisToken, @@ -881,30 +875,107 @@ public class StatusBarManagerService extends IStatusBarService.Stub { } } - private void updateUiVisibilityLocked(final int vis, + private void updateUiVisibilityLocked(final int displayId, final int vis, final int fullscreenStackVis, final int dockedStackVis, final int mask, final Rect fullscreenBounds, final Rect dockedBounds) { - if (mSystemUiVisibility != vis - || mFullscreenStackSysUiVisibility != fullscreenStackVis - || mDockedStackSysUiVisibility != dockedStackVis - || !mFullscreenStackBounds.equals(fullscreenBounds) - || !mDockedStackBounds.equals(dockedBounds)) { + final UiState state = getUiState(displayId); + if (!state.systemUiStateEquals(vis, fullscreenStackVis, dockedStackVis, + fullscreenBounds, dockedBounds)) { + state.setSystemUiState(vis, fullscreenStackVis, dockedStackVis, fullscreenBounds, + dockedBounds); + mHandler.post(() -> { + if (mBar != null) { + try { + mBar.setSystemUiVisibility(displayId, vis, fullscreenStackVis, + dockedStackVis, mask, fullscreenBounds, dockedBounds); + } catch (RemoteException ex) { + Log.w(TAG, "Can not get StatusBar!"); + } + } + }); + } + } + + /** + * @return {@link UiState} specified by {@code displayId}. + * + * <p> + * Note: If {@link UiState} specified by {@code displayId} does not exist, {@link UiState} + * will be allocated and {@code mDisplayUiState} will be updated accordingly. + * <p/> + */ + private UiState getUiState(int displayId) { + UiState state = mDisplayUiState.get(displayId); + if (state == null) { + state = new UiState(); + mDisplayUiState.put(displayId, state); + } + return state; + } + + private class UiState { + private int mSystemUiVisibility = 0; + private int mFullscreenStackSysUiVisibility = 0; + private int mDockedStackSysUiVisibility = 0; + private final Rect mFullscreenStackBounds = new Rect(); + private final Rect mDockedStackBounds = new Rect(); + private boolean mMenuVisible = false; + private int mDisabled1 = 0; + private int mDisabled2 = 0; + private int mImeWindowVis = 0; + private int mImeBackDisposition = 0; + private boolean mShowImeSwitcher = false; + private IBinder mImeToken = null; + + private int getDisabled1() { + return mDisabled1; + } + + private int getDisabled2() { + return mDisabled2; + } + + private void setDisabled(int disabled1, int disabled2) { + mDisabled1 = disabled1; + mDisabled2 = disabled2; + } + + private boolean isMenuVisible() { + return mMenuVisible; + } + + private void setMenuVisible(boolean menuVisible) { + mMenuVisible = menuVisible; + } + + private boolean disableEquals(int disabled1, int disabled2) { + return mDisabled1 == disabled1 && mDisabled2 == disabled2; + } + + private void setSystemUiState(final int vis, final int fullscreenStackVis, + final int dockedStackVis, final Rect fullscreenBounds, final Rect dockedBounds) { mSystemUiVisibility = vis; mFullscreenStackSysUiVisibility = fullscreenStackVis; mDockedStackSysUiVisibility = dockedStackVis; mFullscreenStackBounds.set(fullscreenBounds); mDockedStackBounds.set(dockedBounds); - mHandler.post(new Runnable() { - public void run() { - if (mBar != null) { - try { - mBar.setSystemUiVisibility(vis, fullscreenStackVis, dockedStackVis, - mask, fullscreenBounds, dockedBounds); - } catch (RemoteException ex) { - } - } - } - }); + } + + private boolean systemUiStateEquals(final int vis, final int fullscreenStackVis, + final int dockedStackVis, final Rect fullscreenBounds, final Rect dockedBounds) { + return mSystemUiVisibility == vis + && mFullscreenStackSysUiVisibility == fullscreenStackVis + && mDockedStackSysUiVisibility == dockedStackVis + && mFullscreenStackBounds.equals(fullscreenBounds) + && mDockedStackBounds.equals(dockedBounds); + } + + private void setImeWindowState(final int vis, final int backDisposition, + final boolean showImeSwitcher, final IBinder token) { + mImeWindowVis = vis; + mImeBackDisposition = backDisposition; + mShowImeSwitcher = showImeSwitcher; + mImeToken = token; } } @@ -939,6 +1010,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub { // ================================================================================ // Callbacks from the status bar service. // ================================================================================ + // TODO(b/118592525): refactor it as an IStatusBar API. @Override public void registerStatusBar(IStatusBar bar, List<String> iconSlots, List<StatusBarIcon> iconList, int switches[], List<IBinder> binders, @@ -956,18 +1028,21 @@ public class StatusBarManagerService extends IStatusBarService.Stub { } } synchronized (mLock) { + // TODO(b/118592525): Currently, status bar only works on the default display. + // Make it aware of multi-display if needed. + final UiState state = mDisplayUiState.get(DEFAULT_DISPLAY); switches[0] = gatherDisableActionsLocked(mCurrentUserId, 1); - switches[1] = mSystemUiVisibility; - switches[2] = mMenuVisible ? 1 : 0; - switches[3] = mImeWindowVis; - switches[4] = mImeBackDisposition; - switches[5] = mShowImeSwitcher ? 1 : 0; + switches[1] = state.mSystemUiVisibility; + switches[2] = state.mMenuVisible ? 1 : 0; + switches[3] = state.mImeWindowVis; + switches[4] = state.mImeBackDisposition; + switches[5] = state.mShowImeSwitcher ? 1 : 0; switches[6] = gatherDisableActionsLocked(mCurrentUserId, 2); - switches[7] = mFullscreenStackSysUiVisibility; - switches[8] = mDockedStackSysUiVisibility; - binders.add(mImeToken); - fullscreenStackBounds.set(mFullscreenStackBounds); - dockedStackBounds.set(mDockedStackBounds); + switches[7] = state.mFullscreenStackSysUiVisibility; + switches[8] = state.mDockedStackSysUiVisibility; + binders.add(state.mImeToken); + fullscreenStackBounds.set(state.mFullscreenStackBounds); + dockedStackBounds.set(state.mDockedStackBounds); } } @@ -1309,8 +1384,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub { if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return; synchronized (mLock) { - pw.println(" mDisabled1=0x" + Integer.toHexString(mDisabled1)); - pw.println(" mDisabled2=0x" + Integer.toHexString(mDisabled2)); + for (int i = 0; i < mDisplayUiState.size(); i++) { + final int key = mDisplayUiState.keyAt(i); + final UiState state = mDisplayUiState.get(key); + pw.println(" displayId=" + key); + pw.println(" mDisabled1=0x" + Integer.toHexString(state.getDisabled1())); + pw.println(" mDisabled2=0x" + Integer.toHexString(state.getDisabled2())); + } final int N = mDisableRecords.size(); pw.println(" mDisableRecords.size=" + N); for (int i=0; i<N; i++) { diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index cfec8effeede..64ff9cf21ba0 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -2822,8 +2822,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub IoUtils.closeQuietly(stream); if (!success) { - wpdData.mWidth = -1; - wpdData.mHeight = -1; wallpaper.cropHint.set(0, 0, 0, 0); wpdData.mPadding.set(0, 0, 0, 0); wallpaper.name = ""; @@ -2839,6 +2837,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub } } + ensureSaneWallpaperDisplaySize(wpdData, DEFAULT_DISPLAY); ensureSaneWallpaperData(wallpaper, DEFAULT_DISPLAY); WallpaperData lockWallpaper = mLockWallpaperMap.get(userId); if (lockWallpaper != null) { diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index 0967afda6d2d..37db6711fac0 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -863,6 +863,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { */ Configuration getGlobalConfigurationForCallingPid() { final int pid = Binder.getCallingPid(); + return getGlobalConfigurationForPid(pid); + } + + /** + * Return the global configuration used by the process corresponding to the given pid. + */ + Configuration getGlobalConfigurationForPid(int pid) { if (pid == MY_PID || pid < 0) { return getGlobalConfiguration(); } diff --git a/services/core/java/com/android/server/wm/ConfigurationContainer.java b/services/core/java/com/android/server/wm/ConfigurationContainer.java index 64553a8c7ade..e779d1bb20f5 100644 --- a/services/core/java/com/android/server/wm/ConfigurationContainer.java +++ b/services/core/java/com/android/server/wm/ConfigurationContainer.java @@ -319,6 +319,13 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> { onOverrideConfigurationChanged(mTmpConfig); } + /** Sets the windowing mode for the configuration container. */ + void setDisplayWindowingMode(int windowingMode) { + mTmpConfig.setTo(getOverrideConfiguration()); + mTmpConfig.windowConfiguration.setDisplayWindowingMode(windowingMode); + onOverrideConfigurationChanged(mTmpConfig); + } + /** * Returns true if this container is currently in multi-window mode. I.e. sharing the screen * with another activity. diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 05e82676a40a..aba2eb38ce15 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -1546,6 +1546,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo final int dh = displayInfo.logicalHeight; config.orientation = (dw <= dh) ? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE; config.windowConfiguration.setWindowingMode(getWindowingMode()); + config.windowConfiguration.setDisplayWindowingMode(getWindowingMode()); config.windowConfiguration.setRotation(displayInfo.rotation); final float density = mDisplayMetrics.density; @@ -1953,6 +1954,17 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo mWmService.mWindowsChanged = true; } + @Override + public void setWindowingMode(int windowingMode) { + super.setWindowingMode(windowingMode); + super.setDisplayWindowingMode(windowingMode); + } + + @Override + void setDisplayWindowingMode(int windowingMode) { + setWindowingMode(windowingMode); + } + /** * In split-screen mode we process the IME containers above the docked divider * rather than directly above their target. diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java index 58b7e02b3d12..83ba384c9069 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -504,10 +504,12 @@ public class RecentsAnimationController implements DeathRecipient { public void binderDied() { cancelAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION, "binderDied"); - // Clear associated input consumers on runner death - final InputMonitor inputMonitor = - mService.mRoot.getDisplayContent(mDisplayId).getInputMonitor(); - inputMonitor.destroyInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION); + synchronized (mService.getWindowManagerLock()) { + // Clear associated input consumers on runner death + final InputMonitor inputMonitor = + mService.mRoot.getDisplayContent(mDisplayId).getInputMonitor(); + inputMonitor.destroyInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION); + } } void checkAnimationReady(WallpaperController wallpaperController) { diff --git a/services/core/java/com/android/server/wm/WindowManagerInternal.java b/services/core/java/com/android/server/wm/WindowManagerInternal.java index e83b8634925e..9f1a58770611 100644 --- a/services/core/java/com/android/server/wm/WindowManagerInternal.java +++ b/services/core/java/com/android/server/wm/WindowManagerInternal.java @@ -19,7 +19,6 @@ package com.android.server.wm; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ClipData; -import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.Region; import android.hardware.display.DisplayManagerInternal; @@ -449,11 +448,4 @@ public abstract class WindowManagerInternal { * Return the display Id for given window. */ public abstract int getDisplayIdForWindow(IBinder windowToken); - - // TODO: use WindowProcessController once go/wm-unified is done. - /** - * Notifies the window manager that configuration of the process associated with the input pid - * changed. - */ - public abstract void onProcessConfigurationChanged(int pid, Configuration newConfig); } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 52b24b3e7307..002d6d409abe 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -735,6 +735,7 @@ public class WindowManagerService extends IWindowManager.Stub final InputManagerService mInputManager; final DisplayManagerInternal mDisplayManagerInternal; final DisplayManager mDisplayManager; + final ActivityTaskManagerService mAtmService; // Indicates whether this device supports wide color gamut / HDR rendering private boolean mHasWideColorGamutSupport; @@ -897,11 +898,10 @@ public class WindowManagerService extends IWindowManager.Stub public static WindowManagerService main(final Context context, final InputManagerService im, final boolean showBootMsgs, final boolean onlyCore, WindowManagerPolicy policy, - final WindowManagerGlobalLock globalLock) { + ActivityTaskManagerService atm) { DisplayThread.getHandler().runWithScissors(() -> sInstance = new WindowManagerService(context, im, showBootMsgs, onlyCore, policy, - globalLock), - 0); + atm), 0); return sInstance; } @@ -923,9 +923,10 @@ public class WindowManagerService extends IWindowManager.Stub private WindowManagerService(Context context, InputManagerService inputManager, boolean showBootMsgs, boolean onlyCore, WindowManagerPolicy policy, - WindowManagerGlobalLock globalLock) { + ActivityTaskManagerService atm) { installLock(this, INDEX_WINDOW); - mGlobalLock = globalLock; + mGlobalLock = atm.getGlobalLock(); + mAtmService = atm; mContext = context; mAllowBootMessages = showBootMsgs; mOnlyCore = onlyCore; @@ -7281,19 +7282,6 @@ public class WindowManagerService extends IWindowManager.Stub return Display.INVALID_DISPLAY; } } - - @Override - public void onProcessConfigurationChanged(int pid, Configuration newConfig) { - synchronized (mGlobalLock) { - Configuration currentConfig = mProcessConfigurations.get(pid); - if (currentConfig == null) { - currentConfig = new Configuration(newConfig); - } else { - currentConfig.setTo(newConfig); - } - mProcessConfigurations.put(pid, currentConfig); - } - } } void registerAppFreezeListener(AppFreezeListener listener) { diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index ad43e74eca2f..31e0d83387e8 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -2174,9 +2174,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP getTouchableRegion(region); } - // The area containing the shadows is not touchable. - region.translate(mAttrs.surfaceInsets.left, mAttrs.surfaceInsets.top); - return flags; } @@ -2266,8 +2263,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // For child windows we want to use the pid for the parent window in case the the child // window was added from another process. final int pid = getParentWindow() != null ? getParentWindow().mSession.mPid : mSession.mPid; - mTempConfiguration.setTo(mWmService.mProcessConfigurations.get( - pid, mWmService.mRoot.getConfiguration())); + final Configuration processConfig = + mWmService.mAtmService.getGlobalConfigurationForPid(pid); + mTempConfiguration.setTo(processConfig == null + ? mWmService.mRoot.getConfiguration() : processConfig); return mTempConfiguration; } diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java b/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java index b9dabb9ee7ec..65d32450b27f 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java @@ -120,4 +120,9 @@ abstract class BaseIDevicePolicyManager extends IDevicePolicyManager.Stub { int userHandle) { return false; } + + @Override + public List<String> getCrossProfileCalendarPackagesForUser(int userHandle) { + return Collections.emptyList(); + } } diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 6fbb850e4e40..f68f4d7424f4 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -13426,10 +13426,25 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { enforceCrossUsersPermission(userHandle); synchronized (getLockObject()) { final ActiveAdmin admin = getProfileOwnerAdminLocked(userHandle); - if (admin != null && admin.mCrossProfileCalendarPackages != null) { + if (admin != null) { return admin.mCrossProfileCalendarPackages.contains(packageName); } } return false; } + + @Override + public List<String> getCrossProfileCalendarPackagesForUser(int userHandle) { + if (!mHasFeature) { + return Collections.emptyList(); + } + enforceCrossUsersPermission(userHandle); + synchronized (getLockObject()) { + final ActiveAdmin admin = getProfileOwnerAdminLocked(userHandle); + if (admin != null) { + return new ArrayList<String>(admin.mCrossProfileCalendarPackages); + } + } + return Collections.emptyList(); + } } diff --git a/services/intelligence/java/com/android/server/intelligence/IntelligenceManagerService.java b/services/intelligence/java/com/android/server/intelligence/IntelligenceManagerService.java index 4c68064b46f6..b8f2ad01d502 100644 --- a/services/intelligence/java/com/android/server/intelligence/IntelligenceManagerService.java +++ b/services/intelligence/java/com/android/server/intelligence/IntelligenceManagerService.java @@ -65,6 +65,8 @@ public final class IntelligenceManagerService extends static final String RECEIVER_BUNDLE_EXTRA_SESSIONS = "sessions"; + private static final int MAX_TEMP_SERVICE_DURATION_MS = 1_000 * 60 * 2; // 2 minutes + @GuardedBy("mLock") private ActivityManagerInternal mAm; @@ -75,12 +77,6 @@ public final class IntelligenceManagerService extends } @Override // from AbstractMasterSystemService - protected String getServiceSettingsProperty() { - // TODO(b/111276913): STOPSHIP temporary settings, until it's set by resourcs + cmd - return "smart_suggestions_service"; - } - - @Override // from AbstractMasterSystemService protected IntelligencePerUserService newServiceLocked(@UserIdInt int resolvedUserId, boolean disabled) { return new IntelligencePerUserService(this, mLock, resolvedUserId); @@ -104,6 +100,11 @@ public final class IntelligenceManagerService extends getContext().enforceCallingPermission(MANAGE_SMART_SUGGESTIONS, TAG); } + @Override // from AbstractMasterSystemService + protected int getMaximumTemporaryServiceDurationMs() { + return MAX_TEMP_SERVICE_DURATION_MS; + } + // Called by Shell command. void destroySessions(@UserIdInt int userId, @NonNull IResultReceiver receiver) { Slog.i(TAG, "destroySessions() for userId " + userId); diff --git a/services/intelligence/java/com/android/server/intelligence/IntelligencePerUserService.java b/services/intelligence/java/com/android/server/intelligence/IntelligencePerUserService.java index dbf8601849bb..6f047c51633a 100644 --- a/services/intelligence/java/com/android/server/intelligence/IntelligencePerUserService.java +++ b/services/intelligence/java/com/android/server/intelligence/IntelligencePerUserService.java @@ -36,6 +36,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.service.intelligence.InteractionSessionId; import android.service.intelligence.SnapshotData; +import android.text.TextUtils; import android.util.ArrayMap; import android.util.Slog; import android.view.autofill.AutofillId; @@ -77,17 +78,24 @@ final class IntelligencePerUserService protected ServiceInfo newServiceInfo(@NonNull ComponentName serviceComponent) throws NameNotFoundException { + int flags = PackageManager.GET_META_DATA; + final boolean isTemp = isTemporaryServiceSetLocked(); + if (!isTemp) { + flags |= PackageManager.MATCH_SYSTEM_ONLY; + } + ServiceInfo si; try { - // TODO(b/111276913): must check that either the service is from a system component, - // or it matches a service set by shell cmd (so it can be used on CTS tests and when - // OEMs are implementing the real service - si = AppGlobals.getPackageManager().getServiceInfo(serviceComponent, - PackageManager.GET_META_DATA, mUserId); + si = AppGlobals.getPackageManager().getServiceInfo(serviceComponent, flags, mUserId); } catch (RemoteException e) { Slog.w(TAG, "Could not get service for " + serviceComponent + ": " + e); return null; } + if (si == null) { + Slog.w(TAG, "Could not get serviceInfo for " + (isTemp ? " (temp)" : "(default system)") + + " " + serviceComponent.flattenToShortString()); + return null; + } if (!Manifest.permission.BIND_SMART_SUGGESTIONS_SERVICE.equals(si.permission)) { Slog.w(TAG, "SmartSuggestionsService from '" + si.packageName + "' does not require permission " @@ -105,6 +113,13 @@ final class IntelligencePerUserService return super.updateLocked(disabled); } + @Override // from PerUserSystemService + protected String getDefaultComponentName() { + final String name = getContext() + .getString(com.android.internal.R.string.config_defaultSmartSuggestionsService); + return TextUtils.isEmpty(name) ? null : name; + } + // TODO(b/111276913): log metrics @GuardedBy("mLock") public void startSessionLocked(@NonNull IBinder activityToken, diff --git a/services/intelligence/java/com/android/server/intelligence/IntelligenceServiceShellCommand.java b/services/intelligence/java/com/android/server/intelligence/IntelligenceServiceShellCommand.java index b7c1f789e46c..0d92a972aa96 100644 --- a/services/intelligence/java/com/android/server/intelligence/IntelligenceServiceShellCommand.java +++ b/services/intelligence/java/com/android/server/intelligence/IntelligenceServiceShellCommand.java @@ -75,6 +75,10 @@ public final class IntelligenceServiceShellCommand extends ShellCommand { pw.println(" set bind-instant-service-allowed [true | false]"); pw.println(" Sets whether binding to services provided by instant apps is allowed"); pw.println(""); + pw.println(" set temporary-service USER_ID [COMPONENT_NAME DURATION]"); + pw.println(" Temporarily (for DURATION ms) changes the service implemtation."); + pw.println(" To reset, call with just the USER_ID argument."); + pw.println(""); pw.println(" list sessions [--user USER_ID]"); pw.println(" Lists all pending sessions."); pw.println(""); @@ -101,6 +105,8 @@ public final class IntelligenceServiceShellCommand extends ShellCommand { switch(what) { case "bind-instant-service-allowed": return setBindInstantService(pw); + case "temporary-service": + return setTemporaryService(); default: pw.println("Invalid set: " + what); return -1; @@ -131,6 +137,18 @@ public final class IntelligenceServiceShellCommand extends ShellCommand { } } + private int setTemporaryService() { + final int userId = getNextIntArgRequired(); + final String serviceName = getNextArg(); + if (serviceName == null) { + mService.resetTemporaryService(userId); + return 0; + } + final int duration = getNextIntArgRequired(); + mService.setTemporaryService(userId, serviceName, duration); + return 0; + } + private int requestDestroy(PrintWriter pw) { if (!isNextArgSessions(pw)) { return -1; @@ -204,4 +222,8 @@ public final class IntelligenceServiceShellCommand extends ShellCommand { } return UserHandle.USER_ALL; } + + private int getNextIntArgRequired() { + return Integer.parseInt(getNextArgRequired()); + } } diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 9c6f4b356a0b..c4d2a914facf 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -22,6 +22,7 @@ import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL; import static android.os.IServiceManager.DUMP_FLAG_PROTO; import static android.view.Display.DEFAULT_DISPLAY; +import android.annotation.NonNull; import android.app.ActivityThread; import android.app.INotificationManager; import android.app.usage.UsageStatsManagerInternal; @@ -55,7 +56,9 @@ import android.os.SystemProperties; import android.os.Trace; import android.os.UserHandle; import android.os.storage.IStorageManager; +import android.provider.Settings; import android.sysprop.VoldProperties; +import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.EventLog; import android.util.Slog; @@ -121,6 +124,7 @@ import com.android.server.restrictions.RestrictionsManagerService; import com.android.server.role.RoleManagerService; import com.android.server.security.KeyAttestationApplicationIdProviderService; import com.android.server.security.KeyChainSystemService; +import com.android.server.signedconfig.SignedConfigService; import com.android.server.soundtrigger.SoundTriggerService; import com.android.server.stats.StatsCompanionService; import com.android.server.statusbar.StatusBarManagerService; @@ -797,10 +801,6 @@ public final class SystemServer { boolean disableSystemTextClassifier = SystemProperties.getBoolean( "config.disable_systemtextclassifier", false); - //TODO(b/111276913): temporarily disabled until the manager is properly implemented to - // ignore events when disabled and buffer when enabled - boolean disableIntelligence = SystemProperties.getBoolean( - "config.disable_intelligence", true); boolean disableNetworkTime = SystemProperties.getBoolean("config.disable_networktime", false); boolean disableCameraService = SystemProperties.getBoolean("config.disable_cameraservice", @@ -926,7 +926,7 @@ public final class SystemServer { ConcurrentUtils.waitForFutureNoInterrupt(mSensorServiceStart, START_SENSOR_SERVICE); mSensorServiceStart = null; wm = WindowManagerService.main(context, inputManager, !mFirstBoot, mOnlyCore, - new PhoneWindowManager(), mWindowManagerGlobalLock); + new PhoneWindowManager(), mActivityManagerService.mActivityTaskManager); ServiceManager.addService(Context.WINDOW_SERVICE, wm, /* allowIsolated= */ false, DUMP_FLAG_PRIORITY_CRITICAL | DUMP_FLAG_PROTO); ServiceManager.addService(Context.INPUT_SERVICE, inputManager, @@ -995,6 +995,11 @@ public final class SystemServer { traceBeginAndSlog("PinnerService"); mSystemServiceManager.startService(PinnerService.class); traceEnd(); + + traceBeginAndSlog("SignedConfigService"); + SignedConfigService.registerUpdateReceiver(mSystemContext); + traceEnd(); + } catch (RuntimeException e) { Slog.e("System", "******************************************"); Slog.e("System", "************ Failure starting core service", e); @@ -1131,13 +1136,7 @@ public final class SystemServer { traceEnd(); } - if (!disableIntelligence) { - traceBeginAndSlog("StartIntelligenceService"); - mSystemServiceManager.startService(INTELLIGENCE_MANAGER_SERVICE_CLASS); - traceEnd(); - } else { - Slog.d(TAG, "IntelligenceService disabled"); - } + startIntelligenceService(context); // NOTE: ClipboardService indirectly depends on IntelligenceService traceBeginAndSlog("StartClipboardService"); @@ -2101,6 +2100,37 @@ public final class SystemServer { }, BOOT_TIMINGS_TRACE_LOG); } + private void startIntelligenceService(@NonNull Context context) { + + // First check if it was explicitly enabled by Settings + boolean explicitlySupported = false; + final String settings = Settings.Global.getString(context.getContentResolver(), + Settings.Global.SMART_SUGGESTIONS_SERVICE_EXPLICITLY_ENABLED); + if (settings != null) { + explicitlySupported = Boolean.parseBoolean(settings); + if (explicitlySupported) { + Slog.d(TAG, "IntelligenceService explicitly enabled by Settings"); + } else { + Slog.d(TAG, "IntelligenceService explicitly disabled by Settings"); + return; + } + } + + // Then check if OEM overlaid the resource that defines the service. + if (!explicitlySupported) { + final String serviceName = context + .getString(com.android.internal.R.string.config_defaultSmartSuggestionsService); + if (TextUtils.isEmpty(serviceName)) { + Slog.d(TAG, "IntelligenceService disabled because config resource is not overlaid"); + return; + } + } + + traceBeginAndSlog("StartIntelligenceService"); + mSystemServiceManager.startService(INTELLIGENCE_MANAGER_SERVICE_CLASS); + traceEnd(); + } + static final void startSystemUi(Context context, WindowManagerService windowManager) { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.systemui", diff --git a/services/robotests/src/com/android/server/backup/encryption/keys/RecoverableKeyStoreSecondaryKeyManagerTest.java b/services/robotests/src/com/android/server/backup/encryption/keys/RecoverableKeyStoreSecondaryKeyManagerTest.java new file mode 100644 index 000000000000..5342efa18a97 --- /dev/null +++ b/services/robotests/src/com/android/server/backup/encryption/keys/RecoverableKeyStoreSecondaryKeyManagerTest.java @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.backup.encryption.keys; + +import static com.google.common.truth.Truth.assertThat; + +import static org.testng.Assert.assertThrows; + +import android.content.Context; +import android.platform.test.annotations.Presubmit; +import android.security.keystore.recovery.InternalRecoveryServiceException; +import android.security.keystore.recovery.RecoveryController; + +import com.android.server.testing.shadows.ShadowInternalRecoveryServiceException; +import com.android.server.testing.shadows.ShadowRecoveryController; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; + +import java.security.SecureRandom; +import java.util.Optional; + +/** Tests for {@link RecoverableKeyStoreSecondaryKeyManager}. */ +@RunWith(RobolectricTestRunner.class) +@Presubmit +@Config(shadows = {ShadowRecoveryController.class, ShadowInternalRecoveryServiceException.class}) +public class RecoverableKeyStoreSecondaryKeyManagerTest { + private static final String BACKUP_KEY_ALIAS_PREFIX = + "com.android.server.backup/recoverablekeystore/"; + private static final int BITS_PER_BYTE = 8; + private static final int BACKUP_KEY_SUFFIX_LENGTH_BYTES = 128 / BITS_PER_BYTE; + private static final int HEX_PER_BYTE = 2; + private static final int BACKUP_KEY_ALIAS_LENGTH = + BACKUP_KEY_ALIAS_PREFIX.length() + BACKUP_KEY_SUFFIX_LENGTH_BYTES * HEX_PER_BYTE; + private static final String NONEXISTENT_KEY_ALIAS = "NONEXISTENT_KEY_ALIAS"; + + private RecoverableKeyStoreSecondaryKeyManager mRecoverableKeyStoreSecondaryKeyManager; + private Context mContext; + + /** Create a new {@link RecoverableKeyStoreSecondaryKeyManager} to use in tests. */ + @Before + public void setUp() throws Exception { + mContext = RuntimeEnvironment.application; + + mRecoverableKeyStoreSecondaryKeyManager = + new RecoverableKeyStoreSecondaryKeyManager( + RecoveryController.getInstance(mContext), new SecureRandom()); + } + + /** Reset the {@link ShadowRecoveryController}. */ + @After + public void tearDown() throws Exception { + ShadowRecoveryController.reset(); + } + + /** The generated key should always have the prefix {@code BACKUP_KEY_ALIAS_PREFIX}. */ + @Test + public void generate_generatesKeyWithExpectedPrefix() throws Exception { + RecoverableKeyStoreSecondaryKey key = mRecoverableKeyStoreSecondaryKeyManager.generate(); + + assertThat(key.getAlias()).startsWith(BACKUP_KEY_ALIAS_PREFIX); + } + + /** The generated key should always have length {@code BACKUP_KEY_ALIAS_LENGTH}. */ + @Test + public void generate_generatesKeyWithExpectedLength() throws Exception { + RecoverableKeyStoreSecondaryKey key = mRecoverableKeyStoreSecondaryKeyManager.generate(); + + assertThat(key.getAlias()).hasLength(BACKUP_KEY_ALIAS_LENGTH); + } + + /** Ensure that hidden API exceptions are rethrown when generating keys. */ + @Test + public void generate_encounteringHiddenApiException_rethrowsException() { + ShadowRecoveryController.setThrowsInternalError(true); + + assertThrows( + InternalRecoveryServiceException.class, + mRecoverableKeyStoreSecondaryKeyManager::generate); + } + + /** Ensure that retrieved keys correspond to those generated earlier. */ + @Test + public void get_getsKeyGeneratedByController() throws Exception { + RecoverableKeyStoreSecondaryKey key = mRecoverableKeyStoreSecondaryKeyManager.generate(); + + Optional<RecoverableKeyStoreSecondaryKey> retrievedKey = + mRecoverableKeyStoreSecondaryKeyManager.get(key.getAlias()); + + assertThat(retrievedKey.isPresent()).isTrue(); + assertThat(retrievedKey.get().getAlias()).isEqualTo(key.getAlias()); + assertThat(retrievedKey.get().getSecretKey()).isEqualTo(key.getSecretKey()); + } + + /** + * Ensure that a call to {@link RecoverableKeyStoreSecondaryKeyManager#get(java.lang.String)} + * for nonexistent aliases returns an emtpy {@link Optional}. + */ + @Test + public void get_forNonExistentKey_returnsEmptyOptional() throws Exception { + Optional<RecoverableKeyStoreSecondaryKey> retrievedKey = + mRecoverableKeyStoreSecondaryKeyManager.get(NONEXISTENT_KEY_ALIAS); + + assertThat(retrievedKey.isPresent()).isFalse(); + } + + /** + * Ensure that exceptions occurring during {@link + * RecoverableKeyStoreSecondaryKeyManager#get(java.lang.String)} are not rethrown. + */ + @Test + public void get_encounteringInternalException_doesNotPropagateException() throws Exception { + ShadowRecoveryController.setThrowsInternalError(true); + + // Should not throw exception + mRecoverableKeyStoreSecondaryKeyManager.get(NONEXISTENT_KEY_ALIAS); + } + + /** Ensure that keys are correctly removed from the store. */ + @Test + public void remove_removesKeyFromRecoverableStore() throws Exception { + RecoverableKeyStoreSecondaryKey key = mRecoverableKeyStoreSecondaryKeyManager.generate(); + + mRecoverableKeyStoreSecondaryKeyManager.remove(key.getAlias()); + + assertThat(RecoveryController.getInstance(mContext).getAliases()) + .doesNotContain(key.getAlias()); + } +} diff --git a/services/robotests/src/com/android/server/backup/encryption/keys/RecoverableKeyStoreSecondaryKeyTest.java b/services/robotests/src/com/android/server/backup/encryption/keys/RecoverableKeyStoreSecondaryKeyTest.java new file mode 100644 index 000000000000..89977f82c145 --- /dev/null +++ b/services/robotests/src/com/android/server/backup/encryption/keys/RecoverableKeyStoreSecondaryKeyTest.java @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.backup.encryption.keys; + +import static com.google.common.truth.Truth.assertThat; + +import static org.testng.Assert.assertThrows; + +import android.content.Context; +import android.platform.test.annotations.Presubmit; +import android.security.keystore.recovery.RecoveryController; + +import com.android.server.backup.encryption.keys.RecoverableKeyStoreSecondaryKey.Status; +import com.android.server.backup.testing.CryptoTestUtils; +import com.android.server.testing.shadows.ShadowInternalRecoveryServiceException; +import com.android.server.testing.shadows.ShadowRecoveryController; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; + +import javax.crypto.SecretKey; + +/** Tests for {@link RecoverableKeyStoreSecondaryKey}. */ +@RunWith(RobolectricTestRunner.class) +@Presubmit +@Config(shadows = {ShadowRecoveryController.class, ShadowInternalRecoveryServiceException.class}) +public class RecoverableKeyStoreSecondaryKeyTest { + private static final String TEST_ALIAS = "test"; + private static final int NONEXISTENT_STATUS_CODE = 42; + + private RecoverableKeyStoreSecondaryKey mSecondaryKey; + private SecretKey mGeneratedSecretKey; + private Context mContext; + + /** Instantiate a {@link RecoverableKeyStoreSecondaryKey} to use in tests. */ + @Before + public void setUp() throws Exception { + mContext = RuntimeEnvironment.application; + mGeneratedSecretKey = CryptoTestUtils.generateAesKey(); + mSecondaryKey = new RecoverableKeyStoreSecondaryKey(TEST_ALIAS, mGeneratedSecretKey); + } + + /** Reset the {@link ShadowRecoveryController}. */ + @After + public void tearDown() throws Exception { + ShadowRecoveryController.reset(); + } + + /** + * Checks that {@link RecoverableKeyStoreSecondaryKey#getAlias()} returns the value supplied in + * the constructor. + */ + @Test + public void getAlias() { + String alias = mSecondaryKey.getAlias(); + + assertThat(alias).isEqualTo(TEST_ALIAS); + } + + /** + * Checks that {@link RecoverableKeyStoreSecondaryKey#getSecretKey()} returns the value supplied + * in the constructor. + */ + @Test + public void getSecretKey() { + SecretKey secretKey = mSecondaryKey.getSecretKey(); + + assertThat(secretKey).isEqualTo(mGeneratedSecretKey); + } + + /** + * Checks that passing a secret key that is null to the constructor throws an exception. + */ + @Test + public void constructor_withNullSecretKey_throwsNullPointerException() { + assertThrows( + NullPointerException.class, + () -> new RecoverableKeyStoreSecondaryKey(TEST_ALIAS, null)); + } + + /** + * Checks that passing an alias that is null to the constructor throws an exception. + */ + @Test + public void constructor_withNullAlias_throwsNullPointerException() { + assertThrows( + NullPointerException.class, + () -> new RecoverableKeyStoreSecondaryKey(null, mGeneratedSecretKey)); + } + + /** Checks that the synced status is returned correctly. */ + @Test + public void getStatus_whenSynced_returnsSynced() throws Exception { + setStatus(RecoveryController.RECOVERY_STATUS_SYNCED); + + int status = mSecondaryKey.getStatus(mContext); + + assertThat(status).isEqualTo(Status.SYNCED); + } + + /** Checks that the in progress sync status is returned correctly. */ + @Test + public void getStatus_whenNotSynced_returnsNotSynced() throws Exception { + setStatus(RecoveryController.RECOVERY_STATUS_SYNC_IN_PROGRESS); + + int status = mSecondaryKey.getStatus(mContext); + + assertThat(status).isEqualTo(Status.NOT_SYNCED); + } + + /** Checks that the failure status is returned correctly. */ + @Test + public void getStatus_onPermanentFailure_returnsDestroyed() throws Exception { + setStatus(RecoveryController.RECOVERY_STATUS_PERMANENT_FAILURE); + + int status = mSecondaryKey.getStatus(mContext); + + assertThat(status).isEqualTo(Status.DESTROYED); + } + + /** Checks that an unknown status results in {@code NOT_SYNCED} being returned. */ + @Test + public void getStatus_forUnknownStatusCode_returnsNotSynced() throws Exception { + setStatus(NONEXISTENT_STATUS_CODE); + + int status = mSecondaryKey.getStatus(mContext); + + assertThat(status).isEqualTo(Status.NOT_SYNCED); + } + + /** Checks that an internal error results in {@code NOT_SYNCED} being returned. */ + @Test + public void getStatus_onInternalError_returnsNotSynced() throws Exception { + ShadowRecoveryController.setThrowsInternalError(true); + + int status = mSecondaryKey.getStatus(mContext); + + assertThat(status).isEqualTo(Status.NOT_SYNCED); + } + + private void setStatus(int status) throws Exception { + ShadowRecoveryController.setRecoveryStatus(TEST_ALIAS, status); + } +} diff --git a/services/robotests/src/com/android/server/backup/encryption/keys/TertiaryKeyGeneratorTest.java b/services/robotests/src/com/android/server/backup/encryption/keys/TertiaryKeyGeneratorTest.java new file mode 100644 index 000000000000..48216f8d7aca --- /dev/null +++ b/services/robotests/src/com/android/server/backup/encryption/keys/TertiaryKeyGeneratorTest.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.backup.encryption.keys; + +import static com.google.common.truth.Truth.assertThat; + +import android.platform.test.annotations.Presubmit; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; + +import java.security.SecureRandom; + +import javax.crypto.SecretKey; + +/** Tests for {@link TertiaryKeyGenerator}. */ +@RunWith(RobolectricTestRunner.class) +@Presubmit +public class TertiaryKeyGeneratorTest { + private static final String KEY_ALGORITHM = "AES"; + private static final int KEY_SIZE_BITS = 256; + + private TertiaryKeyGenerator mTertiaryKeyGenerator; + + /** Instantiate a new {@link TertiaryKeyGenerator} for use in tests. */ + @Before + public void setUp() { + mTertiaryKeyGenerator = new TertiaryKeyGenerator(new SecureRandom()); + } + + /** Generated keys should be AES keys. */ + @Test + public void generate_generatesAESKeys() { + SecretKey secretKey = mTertiaryKeyGenerator.generate(); + + assertThat(secretKey.getAlgorithm()).isEqualTo(KEY_ALGORITHM); + } + + /** Generated keys should be 256 bits in size. */ + @Test + public void generate_generates256BitKeys() { + SecretKey secretKey = mTertiaryKeyGenerator.generate(); + + assertThat(secretKey.getEncoded()).hasLength(KEY_SIZE_BITS / 8); + } + + /** + * Subsequent calls to {@link TertiaryKeyGenerator#generate()} should generate different keys. + */ + @Test + public void generate_generatesNewKeys() { + SecretKey key1 = mTertiaryKeyGenerator.generate(); + SecretKey key2 = mTertiaryKeyGenerator.generate(); + + assertThat(key1).isNotEqualTo(key2); + } +} diff --git a/services/robotests/src/com/android/server/backup/encryption/keys/TertiaryKeyRotationTrackerTest.java b/services/robotests/src/com/android/server/backup/encryption/keys/TertiaryKeyRotationTrackerTest.java new file mode 100644 index 000000000000..49bb410ceb65 --- /dev/null +++ b/services/robotests/src/com/android/server/backup/encryption/keys/TertiaryKeyRotationTrackerTest.java @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.backup.encryption.keys; + +import static com.google.common.truth.Truth.assertThat; + +import android.platform.test.annotations.Presubmit; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; + +/** Tests for {@link TertiaryKeyRotationTracker}. */ +@RunWith(RobolectricTestRunner.class) +@Presubmit +public class TertiaryKeyRotationTrackerTest { + private static final String PACKAGE_1 = "com.package.one"; + private static final int NUMBER_OF_BACKUPS_BEFORE_ROTATION = 31; + + private TertiaryKeyRotationTracker mTertiaryKeyRotationTracker; + + /** Instantiate a {@link TertiaryKeyRotationTracker} for use in tests. */ + @Before + public void setUp() { + mTertiaryKeyRotationTracker = newInstance(); + } + + /** New packages should not be due for key rotation. */ + @Test + public void isKeyRotationDue_forNewPackage_isFalse() { + // Simulate a new package by not calling simulateBackups(). As a result, PACKAGE_1 hasn't + // been seen by mTertiaryKeyRotationTracker before. + boolean keyRotationDue = mTertiaryKeyRotationTracker.isKeyRotationDue(PACKAGE_1); + + assertThat(keyRotationDue).isFalse(); + } + + /** + * Key rotation should not be due after less than {@code NUMBER_OF_BACKUPS_BEFORE_ROTATION} + * backups. + */ + @Test + public void isKeyRotationDue_afterLessThanRotationAmountBackups_isFalse() { + simulateBackups(PACKAGE_1, NUMBER_OF_BACKUPS_BEFORE_ROTATION - 1); + + boolean keyRotationDue = mTertiaryKeyRotationTracker.isKeyRotationDue(PACKAGE_1); + + assertThat(keyRotationDue).isFalse(); + } + + /** Key rotation should be due after {@code NUMBER_OF_BACKUPS_BEFORE_ROTATION} backups. */ + @Test + public void isKeyRotationDue_afterRotationAmountBackups_isTrue() { + simulateBackups(PACKAGE_1, NUMBER_OF_BACKUPS_BEFORE_ROTATION); + + boolean keyRotationDue = mTertiaryKeyRotationTracker.isKeyRotationDue(PACKAGE_1); + + assertThat(keyRotationDue).isTrue(); + } + + /** + * A call to {@link TertiaryKeyRotationTracker#resetCountdown(String)} should make sure no key + * rotation is due. + */ + @Test + public void resetCountdown_makesKeyRotationNotDue() { + simulateBackups(PACKAGE_1, NUMBER_OF_BACKUPS_BEFORE_ROTATION); + + mTertiaryKeyRotationTracker.resetCountdown(PACKAGE_1); + + assertThat(mTertiaryKeyRotationTracker.isKeyRotationDue(PACKAGE_1)).isFalse(); + } + + /** + * New instances of {@link TertiaryKeyRotationTracker} should read state about the number of + * backups from disk. + */ + @Test + public void isKeyRotationDue_forNewInstance_readsStateFromDisk() { + simulateBackups(PACKAGE_1, NUMBER_OF_BACKUPS_BEFORE_ROTATION); + + boolean keyRotationDueForNewInstance = newInstance().isKeyRotationDue(PACKAGE_1); + + assertThat(keyRotationDueForNewInstance).isTrue(); + } + + /** + * A call to {@link TertiaryKeyRotationTracker#markAllForRotation()} should mark all previously + * seen packages for rotation. + */ + @Test + public void markAllForRotation_marksSeenPackagesForKeyRotation() { + simulateBackups(PACKAGE_1, /*numberOfBackups=*/ 1); + + mTertiaryKeyRotationTracker.markAllForRotation(); + + assertThat(mTertiaryKeyRotationTracker.isKeyRotationDue(PACKAGE_1)).isTrue(); + } + + /** + * A call to {@link TertiaryKeyRotationTracker#markAllForRotation()} should not mark any new + * packages for rotation. + */ + @Test + public void markAllForRotation_doesNotMarkUnseenPackages() { + mTertiaryKeyRotationTracker.markAllForRotation(); + + assertThat(mTertiaryKeyRotationTracker.isKeyRotationDue(PACKAGE_1)).isFalse(); + } + + private void simulateBackups(String packageName, int numberOfBackups) { + while (numberOfBackups > 0) { + mTertiaryKeyRotationTracker.recordBackup(packageName); + numberOfBackups--; + } + } + + private static TertiaryKeyRotationTracker newInstance() { + return TertiaryKeyRotationTracker.getInstance(RuntimeEnvironment.application); + } +} diff --git a/services/robotests/src/com/android/server/testing/shadows/ShadowInternalRecoveryServiceException.java b/services/robotests/src/com/android/server/testing/shadows/ShadowInternalRecoveryServiceException.java new file mode 100644 index 000000000000..9c06d81ce550 --- /dev/null +++ b/services/robotests/src/com/android/server/testing/shadows/ShadowInternalRecoveryServiceException.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.testing.shadows; + +import android.security.keystore.recovery.InternalRecoveryServiceException; + +import org.robolectric.annotation.Implementation; +import org.robolectric.annotation.Implements; + +/** Shadow {@link InternalRecoveryServiceException}. */ +@Implements(InternalRecoveryServiceException.class) +public class ShadowInternalRecoveryServiceException { + private String mMessage; + + @Implementation + public void __constructor__(String message) { + mMessage = message; + } + + @Implementation + public void __constructor__(String message, Throwable cause) { + mMessage = message; + } + + @Implementation + public String getMessage() { + return mMessage; + } +} diff --git a/services/robotests/src/com/android/server/testing/shadows/ShadowRecoveryController.java b/services/robotests/src/com/android/server/testing/shadows/ShadowRecoveryController.java new file mode 100644 index 000000000000..7dad8a4e3ff3 --- /dev/null +++ b/services/robotests/src/com/android/server/testing/shadows/ShadowRecoveryController.java @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.testing.shadows; + +import android.content.Context; +import android.security.keystore.recovery.InternalRecoveryServiceException; +import android.security.keystore.recovery.LockScreenRequiredException; +import android.security.keystore.recovery.RecoveryController; + +import com.google.common.collect.ImmutableList; + +import org.robolectric.annotation.Implementation; +import org.robolectric.annotation.Implements; +import org.robolectric.annotation.Resetter; + +import java.lang.reflect.Constructor; +import java.security.Key; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.util.HashMap; +import java.util.List; + +import javax.crypto.KeyGenerator; + +/** + * Shadow of {@link RecoveryController}. + * + * <p>Instead of generating keys via the {@link RecoveryController}, this shadow generates them in + * memory. + */ +@Implements(RecoveryController.class) +public class ShadowRecoveryController { + private static final String KEY_GENERATOR_ALGORITHM = "AES"; + private static final int KEY_SIZE_BITS = 256; + + private static boolean sIsSupported = true; + private static boolean sThrowsInternalError = false; + private static HashMap<String, Key> sKeysByAlias = new HashMap<>(); + private static HashMap<String, Integer> sKeyStatusesByAlias = new HashMap<>(); + + @Implementation + public void __constructor__() { + // do not throw + } + + @Implementation + public static RecoveryController getInstance(Context context) { + // Call non-public constructor. + try { + Constructor<RecoveryController> constructor = RecoveryController.class.getConstructor(); + return constructor.newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Implementation + public static boolean isRecoverableKeyStoreEnabled(Context context) { + return sIsSupported; + } + + @Implementation + public Key generateKey(String alias) + throws InternalRecoveryServiceException, LockScreenRequiredException { + maybeThrowError(); + KeyGenerator keyGenerator; + try { + keyGenerator = KeyGenerator.getInstance(KEY_GENERATOR_ALGORITHM); + } catch (NoSuchAlgorithmException e) { + // Should never happen + throw new RuntimeException(e); + } + + keyGenerator.init(KEY_SIZE_BITS); + Key key = keyGenerator.generateKey(); + sKeysByAlias.put(alias, key); + sKeyStatusesByAlias.put(alias, RecoveryController.RECOVERY_STATUS_SYNC_IN_PROGRESS); + return key; + } + + @Implementation + public Key getKey(String alias) + throws InternalRecoveryServiceException, UnrecoverableKeyException { + return sKeysByAlias.get(alias); + } + + @Implementation + public void removeKey(String alias) throws InternalRecoveryServiceException { + sKeyStatusesByAlias.remove(alias); + sKeysByAlias.remove(alias); + } + + @Implementation + public int getRecoveryStatus(String alias) throws InternalRecoveryServiceException { + maybeThrowError(); + return sKeyStatusesByAlias.getOrDefault( + alias, RecoveryController.RECOVERY_STATUS_PERMANENT_FAILURE); + } + + @Implementation + public List<String> getAliases() throws InternalRecoveryServiceException { + return ImmutableList.copyOf(sKeyStatusesByAlias.keySet()); + } + + private static void maybeThrowError() throws InternalRecoveryServiceException { + if (sThrowsInternalError) { + throw new InternalRecoveryServiceException("test error"); + } + } + + /** Sets the recovery status of the key with {@code alias} to {@code status}. */ + public static void setRecoveryStatus(String alias, int status) { + sKeyStatusesByAlias.put(alias, status); + } + + /** Sets all existing keys to being synced. */ + public static void syncAllKeys() { + for (String alias : sKeysByAlias.keySet()) { + sKeyStatusesByAlias.put(alias, RecoveryController.RECOVERY_STATUS_SYNCED); + } + } + + public static void setThrowsInternalError(boolean throwsInternalError) { + ShadowRecoveryController.sThrowsInternalError = throwsInternalError; + } + + public static void setIsSupported(boolean isSupported) { + ShadowRecoveryController.sIsSupported = isSupported; + } + + @Resetter + public static void reset() { + sIsSupported = true; + sThrowsInternalError = false; + sKeysByAlias.clear(); + sKeyStatusesByAlias.clear(); + } +} diff --git a/services/tests/servicestests/AndroidManifest.xml b/services/tests/servicestests/AndroidManifest.xml index 746c4530a5e1..cf4d3a8070f9 100644 --- a/services/tests/servicestests/AndroidManifest.xml +++ b/services/tests/servicestests/AndroidManifest.xml @@ -66,6 +66,7 @@ <uses-permission android:name="android.permission.SUSPEND_APPS"/> <uses-permission android:name="android.permission.CONTROL_KEYGUARD"/> <uses-permission android:name="android.permission.MANAGE_BIND_INSTANT_SERVICE"/> + <uses-permission android:name="android.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS" /> <!-- Uses API introduced in O (26) --> <uses-sdk android:minSdkVersion="1" diff --git a/services/tests/servicestests/src/com/android/server/CachedDeviceStateServiceTest.java b/services/tests/servicestests/src/com/android/server/CachedDeviceStateServiceTest.java index 81107cf2ef4f..2a78b6f6ca24 100644 --- a/services/tests/servicestests/src/com/android/server/CachedDeviceStateServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/CachedDeviceStateServiceTest.java @@ -17,9 +17,10 @@ package com.android.server; -import static org.mockito.Mockito.when; import static com.google.common.truth.Truth.assertThat; +import static org.mockito.Mockito.when; + import android.content.Context; import android.content.Intent; import android.os.BatteryManager; @@ -134,4 +135,44 @@ public class CachedDeviceStateServiceTest { mContext.sendBroadcast(intentUnplugged); assertThat(deviceState.isCharging()).isFalse(); } + + @Test + public void correctlyTracksTimeOnBattery() throws Exception { + CachedDeviceStateService service = new CachedDeviceStateService(mContext); + when(mBatteryManager.getPlugType()).thenReturn(OsProtoEnums.BATTERY_PLUGGED_NONE); + + service.onStart(); + CachedDeviceState.Readonly deviceState = + LocalServices.getService(CachedDeviceState.Readonly.class); + + CachedDeviceState.TimeInStateStopwatch stopwatch = + deviceState.createTimeOnBatteryStopwatch(); + + // State can be initialized correctly only after PHASE_SYSTEM_SERVICES_READY. + assertThat(stopwatch.isRunning()).isFalse(); + service.onBootPhase(SystemService.PHASE_SYSTEM_SERVICES_READY); + + assertThat(stopwatch.isRunning()).isTrue(); + stopwatch.reset(); + + Thread.sleep(100); + assertThat(stopwatch.isRunning()).isTrue(); + assertThat(stopwatch.getMillis()).isAtLeast(100L); + + long timeOnBatteryBeforePluggedIn = stopwatch.getMillis(); + Intent intentPluggedIn = new Intent(Intent.ACTION_BATTERY_CHANGED); + intentPluggedIn.putExtra(BatteryManager.EXTRA_PLUGGED, OsProtoEnums.BATTERY_PLUGGED_AC); + mContext.sendBroadcast(intentPluggedIn); + + assertThat(stopwatch.getMillis()).isAtLeast(timeOnBatteryBeforePluggedIn); + assertThat(stopwatch.isRunning()).isFalse(); + + long timeOnBatteryAfterPluggedIn = stopwatch.getMillis(); + Thread.sleep(20); + assertThat(stopwatch.getMillis()).isEqualTo(timeOnBatteryAfterPluggedIn); + + stopwatch.reset(); + assertThat(stopwatch.getMillis()).isEqualTo(0L); + assertThat(stopwatch.isRunning()).isFalse(); + } } diff --git a/services/tests/servicestests/src/com/android/server/display/ColorDisplayServiceTest.java b/services/tests/servicestests/src/com/android/server/display/ColorDisplayServiceTest.java index 53711a623704..e0ecd3ee24f0 100644 --- a/services/tests/servicestests/src/com/android/server/display/ColorDisplayServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/display/ColorDisplayServiceTest.java @@ -35,6 +35,7 @@ import android.test.mock.MockContentResolver; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; +import com.android.internal.R; import com.android.internal.app.ColorDisplayController; import com.android.internal.util.test.FakeSettingsProvider; import com.android.server.LocalServices; @@ -911,7 +912,11 @@ public class ColorDisplayServiceTest { startService(); assertAccessibilityTransformActivated(true /* activated */ ); assertUserColorMode(ColorDisplayController.COLOR_MODE_NATURAL); - assertActiveColorMode(ColorDisplayController.COLOR_MODE_SATURATED); + if (isColorModeValid(ColorDisplayController.COLOR_MODE_SATURATED)) { + assertActiveColorMode(ColorDisplayController.COLOR_MODE_SATURATED); + } else if (isColorModeValid(ColorDisplayController.COLOR_MODE_AUTOMATIC)) { + assertActiveColorMode(ColorDisplayController.COLOR_MODE_AUTOMATIC); + } } @Test @@ -926,7 +931,11 @@ public class ColorDisplayServiceTest { startService(); assertAccessibilityTransformActivated(true /* activated */ ); assertUserColorMode(ColorDisplayController.COLOR_MODE_NATURAL); - assertActiveColorMode(ColorDisplayController.COLOR_MODE_SATURATED); + if (isColorModeValid(ColorDisplayController.COLOR_MODE_SATURATED)) { + assertActiveColorMode(ColorDisplayController.COLOR_MODE_SATURATED); + } else if (isColorModeValid(ColorDisplayController.COLOR_MODE_AUTOMATIC)) { + assertActiveColorMode(ColorDisplayController.COLOR_MODE_AUTOMATIC); + } } @Test @@ -942,7 +951,11 @@ public class ColorDisplayServiceTest { startService(); assertAccessibilityTransformActivated(true /* activated */ ); assertUserColorMode(ColorDisplayController.COLOR_MODE_NATURAL); - assertActiveColorMode(ColorDisplayController.COLOR_MODE_SATURATED); + if (isColorModeValid(ColorDisplayController.COLOR_MODE_SATURATED)) { + assertActiveColorMode(ColorDisplayController.COLOR_MODE_SATURATED); + } else if (isColorModeValid(ColorDisplayController.COLOR_MODE_AUTOMATIC)) { + assertActiveColorMode(ColorDisplayController.COLOR_MODE_AUTOMATIC); + } } @Test @@ -1030,6 +1043,24 @@ public class ColorDisplayServiceTest { } /** + * Returns whether the color mode is valid on the device the tests are running on. + * + * @param mode the mode to check + */ + private boolean isColorModeValid(int mode) { + final int[] availableColorModes = mContext.getResources().getIntArray( + R.array.config_availableColorModes); + if (availableColorModes != null) { + for (int availableMode : availableColorModes) { + if (mode == availableMode) { + return true; + } + } + } + return false; + } + + /** * Convenience method to start {@link #mColorDisplayService}. */ private void startService() { @@ -1038,7 +1069,6 @@ public class ColorDisplayServiceTest { InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { - mColorDisplayService.onStart(); mColorDisplayService.onBootPhase(SystemService.PHASE_BOOT_COMPLETED); mColorDisplayService.onStartUser(mUserId); } diff --git a/services/tests/servicestests/src/com/android/server/power/ThermalManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/power/ThermalManagerServiceTest.java index 5077f9289477..c1963da3b3af 100644 --- a/services/tests/servicestests/src/com/android/server/power/ThermalManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/power/ThermalManagerServiceTest.java @@ -268,7 +268,7 @@ public class ThermalManagerServiceTest { @Test public void testGetCurrentStatus() throws RemoteException { - int status = Temperature.THROTTLING_WARNING; + int status = Temperature.THROTTLING_EMERGENCY; Temperature newSkin = new Temperature(100, Temperature.TYPE_SKIN, "skin1", status); mFakeHal.mCallback.onValues(newSkin); assertEquals(status, mService.mService.getCurrentThermalStatus()); diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java index b30bb4b37c12..068129569d14 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java @@ -15,8 +15,9 @@ */ package com.android.server.notification; -import static org.junit.Assert.assertEquals; +import static org.hamcrest.Matchers.contains; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyString; @@ -34,8 +35,8 @@ import android.os.Build; import android.os.UserHandle; import android.provider.Settings; import android.service.notification.StatusBarNotification; -import android.telecom.TelecomManager; import android.support.test.runner.AndroidJUnit4; +import android.telecom.TelecomManager; import android.test.suitebuilder.annotation.SmallTest; import com.android.server.UiServiceTestCase; @@ -211,7 +212,7 @@ public class NotificationComparatorTest extends UiServiceTestCase { mRecordColorized = new NotificationRecord(mContext, new StatusBarNotification(pkg2, pkg2, 1, "colorized", uid2, uid2, n13, new UserHandle(userId), "", 1999), getDefaultChannel()); - mRecordHighCall.setSystemImportance(NotificationManager.IMPORTANCE_HIGH); + mRecordColorized.setSystemImportance(NotificationManager.IMPORTANCE_HIGH); Notification n14 = new Notification.Builder(mContext, TEST_CHANNEL_ID) .setCategory(Notification.CATEGORY_CALL) @@ -225,11 +226,11 @@ public class NotificationComparatorTest extends UiServiceTestCase { } @Test - public void testOrdering() throws Exception { + public void testOrdering() { final List<NotificationRecord> expected = new ArrayList<>(); expected.add(mRecordColorizedCall); - expected.add(mRecordDefaultMedia); expected.add(mRecordColorized); + expected.add(mRecordDefaultMedia); expected.add(mRecordHighCall); expected.add(mRecordInlineReply); if (mRecordSms != null) { @@ -250,11 +251,11 @@ public class NotificationComparatorTest extends UiServiceTestCase { Collections.sort(actual, new NotificationComparator(mContext)); - assertEquals(expected, actual); + assertThat(actual, contains(expected.toArray())); } @Test - public void testMessaging() throws Exception { + public void testMessaging() { NotificationComparator comp = new NotificationComparator(mContext); assertTrue(comp.isImportantMessaging(mRecordInlineReply)); if (mRecordSms != null) { @@ -265,7 +266,7 @@ public class NotificationComparatorTest extends UiServiceTestCase { } @Test - public void testPeople() throws Exception { + public void testPeople() { NotificationComparator comp = new NotificationComparator(mContext); assertTrue(comp.isImportantPeople(mRecordStarredContact)); assertTrue(comp.isImportantPeople(mRecordContact)); diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java index 266d88493b9e..50fd188cc00b 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java @@ -30,6 +30,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.when; import android.app.ActivityManagerInternal; import android.content.Context; @@ -125,11 +126,12 @@ public class WindowManagerServiceRule implements TestRule { if (input != null && input.length > 1) { doReturn(input[1]).when(ims).monitorInput(anyString(), anyInt()); } + ActivityTaskManagerService atms = mock(ActivityTaskManagerService.class); + when(atms.getGlobalLock()).thenReturn(new WindowManagerGlobalLock()); mService = WindowManagerService.main(context, ims, false, false, mPolicy = new TestWindowManagerPolicy( - WindowManagerServiceRule.this::getWindowManagerService), - new WindowManagerGlobalLock()); + WindowManagerServiceRule.this::getWindowManagerService), atms); mService.mTransactionFactory = () -> { final SurfaceControl.Transaction transaction = new SurfaceControl.Transaction(); mSurfaceTransactions.add(new WeakReference<>(transaction)); diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index cef998651cfe..d617de0af6a1 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -29,7 +29,6 @@ import android.os.ParcelFileDescriptor; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import java.lang.String; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.nio.charset.StandardCharsets; @@ -908,10 +907,16 @@ public final class Call { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("[pa: "); + sb.append("[id: "); + sb.append(mTelecomCallId); + sb.append(", pa: "); sb.append(mAccountHandle); sb.append(", hdl: "); - sb.append(Log.pii(mHandle)); + sb.append(Log.piiHandle(mHandle)); + sb.append(", hdlPres: "); + sb.append(mHandlePresentation); + sb.append(", videoState: "); + sb.append(VideoProfile.videoStateToString(mVideoState)); sb.append(", caps: "); sb.append(capabilitiesToString(mCallCapabilities)); sb.append(", props: "); diff --git a/telecomm/java/android/telecom/CallScreeningService.java b/telecomm/java/android/telecom/CallScreeningService.java index 7db69407ad3d..662874316a7f 100644 --- a/telecomm/java/android/telecom/CallScreeningService.java +++ b/telecomm/java/android/telecom/CallScreeningService.java @@ -27,8 +27,8 @@ import android.os.Message; import android.os.RemoteException; import com.android.internal.os.SomeArgs; -import com.android.internal.telecom.ICallScreeningService; import com.android.internal.telecom.ICallScreeningAdapter; +import com.android.internal.telecom.ICallScreeningService; /** * This service can be implemented by the default dialer (see @@ -147,7 +147,7 @@ public abstract class CallScreeningService extends Service { private boolean mShouldSkipCallLog; private boolean mShouldSkipNotification; - /* + /** * Sets whether the incoming call should be blocked. */ public Builder setDisallowCall(boolean shouldDisallowCall) { @@ -155,7 +155,7 @@ public abstract class CallScreeningService extends Service { return this; } - /* + /** * Sets whether the incoming call should be disconnected as if the user had manually * rejected it. This property should only be set to true if the call is disallowed. */ @@ -164,16 +164,20 @@ public abstract class CallScreeningService extends Service { return this; } - /* + /** * Sets whether the incoming call should not be displayed in the call log. This property * should only be set to true if the call is disallowed. + * <p> + * Note: Calls will still be logged with type + * {@link android.provider.CallLog.Calls#BLOCKED_TYPE}, regardless of how this property + * is set. */ public Builder setSkipCallLog(boolean shouldSkipCallLog) { mShouldSkipCallLog = shouldSkipCallLog; return this; } - /* + /** * Sets whether a missed call notification should not be shown for the incoming call. * This property should only be set to true if the call is disallowed. */ @@ -211,6 +215,17 @@ public abstract class CallScreeningService extends Service { * Called when a new incoming call is added. * {@link CallScreeningService#respondToCall(Call.Details, CallScreeningService.CallResponse)} * should be called to allow or disallow the call. + * <p> + * Note: The {@link Call.Details} instance provided to a call screening service will only have + * the following properties set. The rest of the {@link Call.Details} properties will be set to + * their default value or {@code null}. + * <ul> + * <li>{@link Call.Details#getState()}</li> + * <li>{@link Call.Details#getConnectTimeMillis()}</li> + * <li>{@link Call.Details#getCreationTimeMillis()}</li> + * <li>{@link Call.Details#getHandle()}</li> + * <li>{@link Call.Details#getHandlePresentation()}</li> + * </ul> * * @param callDetails Information about a new incoming call, see {@link Call.Details}. */ diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 2a01ac4b8df2..2c06c4720650 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -1590,14 +1590,23 @@ public class SubscriptionManager { return subId; } - /** @hide */ - @UnsupportedAppUsage - public void setDefaultSmsSubId(int subId) { - if (VDBG) logd("setDefaultSmsSubId sub id = " + subId); + /** + * Set the subscription which will be used by default for SMS, with the subscription which + * the supplied subscription ID corresponds to; or throw a RuntimeException if the supplied + * subscription ID is not usable (check with {@link #isUsableSubscriptionId(int)}). + * + * @param subscriptionId the supplied subscription ID + * + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public void setDefaultSmsSubId(int subscriptionId) { + if (VDBG) logd("setDefaultSmsSubId sub id = " + subscriptionId); try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - iSub.setDefaultSmsSubId(subId); + iSub.setDefaultSmsSubId(subscriptionId); } } catch (RemoteException ex) { // ignore it @@ -1645,14 +1654,23 @@ public class SubscriptionManager { return subId; } - /** @hide */ - @UnsupportedAppUsage - public void setDefaultDataSubId(int subId) { - if (VDBG) logd("setDataSubscription sub id = " + subId); + /** + * Set the subscription which will be used by default for data, with the subscription which + * the supplied subscription ID corresponds to; or throw a RuntimeException if the supplied + * subscription ID is not usable (check with {@link #isUsableSubscriptionId(int)}). + * + * @param subscriptionId the supplied subscription ID + * + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public void setDefaultDataSubId(int subscriptionId) { + if (VDBG) logd("setDataSubscription sub id = " + subscriptionId); try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - iSub.setDefaultDataSubId(subId); + iSub.setDefaultDataSubId(subscriptionId); } } catch (RemoteException ex) { // ignore it diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 45d914e0dfdd..fa9b76de2e6b 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -5541,19 +5541,40 @@ public class TelephonyManager { public void requestNumberVerification(@NonNull PhoneNumberRange range, long timeoutMillis, @NonNull @CallbackExecutor Executor executor, @NonNull NumberVerificationCallback callback) { + if (executor == null) { + throw new NullPointerException("Executor must be non-null"); + } + if (callback == null) { + throw new NullPointerException("Callback must be non-null"); + } + INumberVerificationCallback internalCallback = new INumberVerificationCallback.Stub() { @Override - public void onCallReceived(String phoneNumber) throws RemoteException { - Binder.withCleanCallingIdentity(() -> callback.onCallReceived(phoneNumber)); + public void onCallReceived(String phoneNumber) { + Binder.withCleanCallingIdentity(() -> + executor.execute(() -> + callback.onCallReceived(phoneNumber))); } @Override - public void onVerificationFailed(int reason) throws RemoteException { - Binder.withCleanCallingIdentity(() -> callback.onVerificationFailed(reason)); + public void onVerificationFailed(int reason) { + Binder.withCleanCallingIdentity(() -> + executor.execute(() -> + callback.onVerificationFailed(reason))); } }; - // TODO -- call the aidl method + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + telephony.requestNumberVerification(range, timeoutMillis, internalCallback, + getOpPackageName()); + } + } catch (RemoteException ex) { + Rlog.e(TAG, "requestNumberVerification RemoteException", ex); + executor.execute(() -> + callback.onVerificationFailed(NumberVerificationCallback.REASON_UNSPECIFIED)); + } } /** diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 32e939a0c925..399dc5255176 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -35,6 +35,7 @@ import android.telephony.ICellInfoCallback; import android.telephony.ModemActivityInfo; import android.telephony.NeighboringCellInfo; import android.telephony.NetworkScanRequest; +import android.telephony.PhoneNumberRange; import android.telephony.RadioAccessFamily; import android.telephony.ServiceState; import android.telephony.SignalStrength; @@ -49,6 +50,7 @@ import android.telephony.ims.aidl.IImsRegistration; import android.telephony.ims.aidl.IImsRegistrationCallback; import com.android.ims.internal.IImsServiceFeatureCallback; import com.android.internal.telephony.CellNetworkScanResult; +import com.android.internal.telephony.INumberVerificationCallback; import com.android.internal.telephony.OperatorInfo; import java.util.List; @@ -871,6 +873,17 @@ interface ITelephony { String getCdmaMin(int subId); /** + * Request that the next incoming call from a number matching {@code range} be intercepted. + * @param range The range of phone numbers the caller expects a phone call from. + * @param timeoutMillis The amount of time to wait for such a call, or + * {@link #MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS}, whichever is lesser. + * @param callback the callback aidl + * @param callingPackage the calling package name. + */ + void requestNumberVerification(in PhoneNumberRange range, long timeoutMillis, + in INumberVerificationCallback callback, String callingPackage); + + /** * Has the calling application been granted special privileges by the carrier. * * If any of the packages in the calling UID has carrier privileges, the diff --git a/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java b/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java index 4dc0341c8e2b..d8f961850906 100644 --- a/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java +++ b/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java @@ -542,7 +542,7 @@ public class IpSecServiceParameterizedTest { verify(mMockNetd) .ipSecApplyTransportModeTransform( - eq(pfd.getFileDescriptor()), + eq(pfd), eq(mUid), eq(IpSecManager.DIRECTION_OUT), anyString(), @@ -555,7 +555,7 @@ public class IpSecServiceParameterizedTest { ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket(new Socket()); mIpSecService.removeTransportModeTransforms(pfd); - verify(mMockNetd).ipSecRemoveTransportModeTransform(pfd.getFileDescriptor()); + verify(mMockNetd).ipSecRemoveTransportModeTransform(pfd); } private IpSecTunnelInterfaceResponse createAndValidateTunnel( diff --git a/tests/net/java/com/android/server/IpSecServiceTest.java b/tests/net/java/com/android/server/IpSecServiceTest.java index 2c94a601fbf6..724446e11c83 100644 --- a/tests/net/java/com/android/server/IpSecServiceTest.java +++ b/tests/net/java/com/android/server/IpSecServiceTest.java @@ -425,7 +425,7 @@ public class IpSecServiceTest { ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket(new Socket()); mIpSecService.removeTransportModeTransforms(pfd); - verify(mMockNetd).ipSecRemoveTransportModeTransform(pfd.getFileDescriptor()); + verify(mMockNetd).ipSecRemoveTransportModeTransform(pfd); } @Test @@ -620,10 +620,10 @@ public class IpSecServiceTest { mIpSecService.openUdpEncapsulationSocket(0, new Binder()); FileDescriptor sockFd = udpEncapResp.fileDescriptor.getFileDescriptor(); - ArgumentMatcher<FileDescriptor> fdMatcher = (arg) -> { + ArgumentMatcher<ParcelFileDescriptor> fdMatcher = (arg) -> { try { StructStat sockStat = Os.fstat(sockFd); - StructStat argStat = Os.fstat(arg); + StructStat argStat = Os.fstat(arg.getFileDescriptor()); return sockStat.st_ino == argStat.st_ino && sockStat.st_dev == argStat.st_dev; diff --git a/tools/aapt2/format/binary/BinaryResourceParser.cpp b/tools/aapt2/format/binary/BinaryResourceParser.cpp index ed70fb3c57d6..df0daebe8453 100644 --- a/tools/aapt2/format/binary/BinaryResourceParser.cpp +++ b/tools/aapt2/format/binary/BinaryResourceParser.cpp @@ -240,6 +240,12 @@ bool BinaryResourceParser::ParsePackage(const ResChunk_header* chunk) { } break; + case android::RES_TABLE_OVERLAYABLE_TYPE: + if (!ParseOverlayable(parser.chunk())) { + return false; + } + break; + default: diag_->Warn(DiagMessage(source_) << "unexpected chunk type " @@ -383,24 +389,12 @@ bool BinaryResourceParser::ParseType(const ResourceTablePackage* package, return false; } - const uint32_t type_spec_flags = entry_type_spec_flags_[res_id]; - if ((entry->flags & ResTable_entry::FLAG_PUBLIC) != 0 || - (type_spec_flags & ResTable_typeSpec::SPEC_OVERLAYABLE) != 0) { - if (entry->flags & ResTable_entry::FLAG_PUBLIC) { - Visibility visibility; - visibility.level = Visibility::Level::kPublic; - visibility.source = source_.WithLine(0); - if (!table_->SetVisibilityWithIdMangled(name, visibility, res_id, diag_)) { - return false; - } - } - - if (type_spec_flags & ResTable_typeSpec::SPEC_OVERLAYABLE) { - Overlayable overlayable; - overlayable.source = source_.WithLine(0); - if (!table_->AddOverlayableMangled(name, overlayable, diag_)) { - return false; - } + if (entry->flags & ResTable_entry::FLAG_PUBLIC) { + Visibility visibility; + visibility.level = Visibility::Level::kPublic; + visibility.source = source_.WithLine(0); + if (!table_->SetVisibilityWithIdMangled(name, visibility, res_id, diag_)) { + return false; } // Erase the ID from the map once processed, so that we don't mark the same symbol more than @@ -433,6 +427,72 @@ bool BinaryResourceParser::ParseLibrary(const ResChunk_header* chunk) { return true; } +bool BinaryResourceParser::ParseOverlayable(const ResChunk_header* chunk) { + const ResTable_overlayable_header* header = ConvertTo<ResTable_overlayable_header>(chunk); + if (!header) { + diag_->Error(DiagMessage(source_) << "corrupt ResTable_category_header chunk"); + return false; + } + + ResChunkPullParser parser(GetChunkData(chunk), + GetChunkDataLen(chunk)); + while (ResChunkPullParser::IsGoodEvent(parser.Next())) { + if (util::DeviceToHost16(parser.chunk()->type) == android::RES_TABLE_OVERLAYABLE_POLICY_TYPE) { + const ResTable_overlayable_policy_header* policy_header = + ConvertTo<ResTable_overlayable_policy_header>(parser.chunk()); + + std::vector<Overlayable::Policy> policies; + if (policy_header->policy_flags & ResTable_overlayable_policy_header::POLICY_PUBLIC) { + policies.push_back(Overlayable::Policy::kPublic); + } + if (policy_header->policy_flags + & ResTable_overlayable_policy_header::POLICY_SYSTEM_PARTITION) { + policies.push_back(Overlayable::Policy::kSystem); + } + if (policy_header->policy_flags + & ResTable_overlayable_policy_header::POLICY_VENDOR_PARTITION) { + policies.push_back(Overlayable::Policy::kVendor); + } + if (policy_header->policy_flags + & ResTable_overlayable_policy_header::POLICY_PRODUCT_PARTITION) { + policies.push_back(Overlayable::Policy::kProduct); + } + if (policy_header->policy_flags + & ResTable_overlayable_policy_header::POLICY_PRODUCT_SERVICES_PARTITION) { + policies.push_back(Overlayable::Policy::kProductServices); + } + + const ResTable_ref* const ref_begin = reinterpret_cast<const ResTable_ref*>( + ((uint8_t *)policy_header) + util::DeviceToHost32(policy_header->header.headerSize)); + const ResTable_ref* const ref_end = ref_begin + + util::DeviceToHost32(policy_header->entry_count); + for (auto ref_iter = ref_begin; ref_iter != ref_end; ++ref_iter) { + ResourceId res_id(util::DeviceToHost32(ref_iter->ident)); + const auto iter = id_index_.find(res_id); + + // If the overlayable chunk comes before the type chunks, the resource ids and resource name + // pairing will not exist at this point. + if (iter == id_index_.cend()) { + diag_->Error(DiagMessage(source_) << "failed to find resource name for overlayable" + << " resource " << res_id); + return false; + } + + for (Overlayable::Policy policy : policies) { + Overlayable overlayable; + overlayable.source = source_.WithLine(0); + overlayable.policy = policy; + if (!table_->AddOverlayable(iter->second, overlayable, diag_)) { + return false; + } + } + } + } + } + + return true; +} + std::unique_ptr<Item> BinaryResourceParser::ParseValue(const ResourceNameRef& name, const ConfigDescription& config, const android::Res_value& value) { diff --git a/tools/aapt2/format/binary/BinaryResourceParser.h b/tools/aapt2/format/binary/BinaryResourceParser.h index 2bdc051f4e29..a2eee5006964 100644 --- a/tools/aapt2/format/binary/BinaryResourceParser.h +++ b/tools/aapt2/format/binary/BinaryResourceParser.h @@ -54,6 +54,7 @@ class BinaryResourceParser { bool ParseTypeSpec(const ResourceTablePackage* package, const android::ResChunk_header* chunk); bool ParseType(const ResourceTablePackage* package, const android::ResChunk_header* chunk); bool ParseLibrary(const android::ResChunk_header* chunk); + bool ParseOverlayable(const android::ResChunk_header* chunk); std::unique_ptr<Item> ParseValue(const ResourceNameRef& name, const android::ConfigDescription& config, diff --git a/tools/aapt2/format/binary/TableFlattener.cpp b/tools/aapt2/format/binary/TableFlattener.cpp index 6c1a9ba2cbad..976c3288bfca 100644 --- a/tools/aapt2/format/binary/TableFlattener.cpp +++ b/tools/aapt2/format/binary/TableFlattener.cpp @@ -24,6 +24,7 @@ #include "android-base/logging.h" #include "android-base/macros.h" #include "android-base/stringprintf.h" +#include "androidfw/ResourceUtils.h" #include "ResourceTable.h" #include "ResourceValues.h" @@ -216,6 +217,11 @@ class MapFlattenVisitor : public ValueVisitor { size_t entry_count_ = 0; }; +struct PolicyChunk { + uint32_t policy_flags; + std::set<ResourceId> ids; +}; + class PackageFlattener { public: PackageFlattener(IAaptContext* context, ResourceTablePackage* package, @@ -267,6 +273,8 @@ class PackageFlattener { FlattenLibrarySpec(buffer); } + FlattenOverlayable(buffer); + pkg_writer.Finish(); return true; } @@ -413,6 +421,97 @@ class PackageFlattener { return sorted_entries; } + void FlattenOverlayable(BigBuffer* buffer) { + std::vector<PolicyChunk> policies; + + CHECK(bool(package_->id)) << "package must have an ID set when flattening <overlayable>"; + for (auto& type : package_->types) { + CHECK(bool(type->id)) << "type must have an ID set when flattening <overlayable>"; + for (auto& entry : type->entries) { + CHECK(bool(type->id)) << "entry must have an ID set when flattening <overlayable>"; + + // TODO(b/120298168): Convert the policies vector to a policy set or bitmask + if (!entry->overlayable_declarations.empty()) { + uint16_t policy_flags = 0; + for (Overlayable overlayable : entry->overlayable_declarations) { + if (overlayable.policy) { + switch (overlayable.policy.value()) { + case Overlayable::Policy::kPublic: + policy_flags |= ResTable_overlayable_policy_header::POLICY_PUBLIC; + break; + case Overlayable::Policy::kSystem: + policy_flags |= ResTable_overlayable_policy_header::POLICY_SYSTEM_PARTITION; + break; + case Overlayable::Policy::kVendor: + policy_flags |= ResTable_overlayable_policy_header::POLICY_VENDOR_PARTITION; + break; + case Overlayable::Policy::kProduct: + policy_flags |= ResTable_overlayable_policy_header::POLICY_PRODUCT_PARTITION; + break; + case Overlayable::Policy::kProductServices: + policy_flags |= + ResTable_overlayable_policy_header::POLICY_PRODUCT_SERVICES_PARTITION; + break; + } + } else { + // Encode overlayable entries defined without a policy as publicly overlayable + policy_flags |= ResTable_overlayable_policy_header::POLICY_PUBLIC; + } + } + + // Find the overlayable policy chunk with the same policies as the entry + PolicyChunk* policy_chunk = nullptr; + for (PolicyChunk& policy : policies) { + if (policy.policy_flags == policy_flags) { + policy_chunk = &policy; + break; + } + } + + // Create a new policy chunk if an existing one with the same policy cannot be found + if (policy_chunk == nullptr) { + PolicyChunk p; + p.policy_flags = policy_flags; + policies.push_back(p); + policy_chunk = &policies.back(); + } + + policy_chunk->ids.insert(android::make_resid(package_->id.value(), type->id.value(), + entry->id.value())); + } + } + } + + if (policies.empty()) { + // Only write the overlayable chunk if the APK has overlayable entries + return; + } + + ChunkWriter writer(buffer); + writer.StartChunk<ResTable_overlayable_header>(RES_TABLE_OVERLAYABLE_TYPE); + + // Write each policy block for the overlayable + for (PolicyChunk& policy : policies) { + ChunkWriter policy_writer(buffer); + ResTable_overlayable_policy_header* policy_type = + policy_writer.StartChunk<ResTable_overlayable_policy_header>( + RES_TABLE_OVERLAYABLE_POLICY_TYPE); + policy_type->policy_flags = util::HostToDevice32(policy.policy_flags); + policy_type->entry_count = util::HostToDevice32(static_cast<uint32_t>(policy.ids.size())); + + // Write the ids after the policy header + ResTable_ref* id_block = policy_writer.NextBlock<ResTable_ref>(policy.ids.size()); + for (const ResourceId& id : policy.ids) { + id_block->ident = util::HostToDevice32(id.id); + id_block++; + } + + policy_writer.Finish(); + } + + writer.Finish(); + } + bool FlattenTypeSpec(ResourceTableType* type, std::vector<ResourceEntry*>* sorted_entries, BigBuffer* buffer) { ChunkWriter type_spec_writer(buffer); @@ -446,11 +545,6 @@ class PackageFlattener { config_masks[entry->id.value()] |= util::HostToDevice32(ResTable_typeSpec::SPEC_PUBLIC); } - if (!entry->overlayable_declarations.empty()) { - config_masks[entry->id.value()] |= - util::HostToDevice32(ResTable_typeSpec::SPEC_OVERLAYABLE); - } - const size_t config_count = entry->values.size(); for (size_t i = 0; i < config_count; i++) { const ConfigDescription& config = entry->values[i]->config; diff --git a/tools/aapt2/format/binary/TableFlattener_test.cpp b/tools/aapt2/format/binary/TableFlattener_test.cpp index cd1414c7e628..410efbe83b1b 100644 --- a/tools/aapt2/format/binary/TableFlattener_test.cpp +++ b/tools/aapt2/format/binary/TableFlattener_test.cpp @@ -628,24 +628,108 @@ TEST_F(TableFlattenerTest, ObfuscatingResourceNamesWithWhitelistSucceeds) { } TEST_F(TableFlattenerTest, FlattenOverlayable) { + std::string name = "com.app.test:integer/overlayable"; std::unique_ptr<ResourceTable> table = test::ResourceTableBuilder() .SetPackageId("com.app.test", 0x7f) - .AddSimple("com.app.test:integer/overlayable", ResourceId(0x7f020000)) + .AddSimple(name, ResourceId(0x7f020000)) + .AddOverlayable(name, Overlayable::Policy::kProduct) + .AddOverlayable(name, Overlayable::Policy::kSystem) + .AddOverlayable(name, Overlayable::Policy::kVendor) .Build(); - ASSERT_TRUE(table->AddOverlayable(test::ParseNameOrDie("com.app.test:integer/overlayable"), - Overlayable{}, test::GetDiagnostics())); + ResourceTable output_table; + ASSERT_TRUE(Flatten(context_.get(), {}, table.get(), &output_table)); - ResTable res_table; - ASSERT_TRUE(Flatten(context_.get(), {}, table.get(), &res_table)); + auto search_result = output_table.FindResource(test::ParseNameOrDie(name)); + ASSERT_TRUE(search_result); + ASSERT_THAT(search_result.value().entry, NotNull()); + EXPECT_EQ(search_result.value().entry->overlayable_declarations.size(), 3); + EXPECT_TRUE(search_result.value().entry->overlayable_declarations[0].policy); + EXPECT_EQ(search_result.value().entry->overlayable_declarations[0].policy, + Overlayable::Policy::kSystem); + EXPECT_TRUE(search_result.value().entry->overlayable_declarations[1].policy); + EXPECT_EQ(search_result.value().entry->overlayable_declarations[1].policy, + Overlayable::Policy::kVendor); + EXPECT_TRUE(search_result.value().entry->overlayable_declarations[2].policy); + EXPECT_EQ(search_result.value().entry->overlayable_declarations[2].policy, + Overlayable::Policy::kProduct); +} + +TEST_F(TableFlattenerTest, FlattenMultipleOverlayablePolicies) { + std::string name_zero = "com.app.test:integer/overlayable_zero"; + std::string name_one = "com.app.test:integer/overlayable_one"; + std::string name_two = "com.app.test:integer/overlayable_two"; + std::string name_three = "com.app.test:integer/overlayable_three"; + std::unique_ptr<ResourceTable> table = + test::ResourceTableBuilder() + .SetPackageId("com.app.test", 0x7f) + .AddSimple(name_zero, ResourceId(0x7f020000)) + .AddOverlayable(name_zero, Overlayable::Policy::kProduct) + .AddOverlayable(name_zero, Overlayable::Policy::kSystem) + .AddOverlayable(name_zero, Overlayable::Policy::kProductServices) + .AddSimple(name_one, ResourceId(0x7f020001)) + .AddOverlayable(name_one, Overlayable::Policy::kPublic) + .AddOverlayable(name_one, Overlayable::Policy::kSystem) + .AddSimple(name_two, ResourceId(0x7f020002)) + .AddOverlayable(name_two, Overlayable::Policy::kProduct) + .AddOverlayable(name_two, Overlayable::Policy::kSystem) + .AddOverlayable(name_two, Overlayable::Policy::kProductServices) + .AddSimple(name_three, ResourceId(0x7f020003)) + .AddOverlayable(name_three, {}) + .Build(); + + ResourceTable output_table; + ASSERT_TRUE(Flatten(context_.get(), {}, table.get(), &output_table)); + + auto search_result = output_table.FindResource(test::ParseNameOrDie(name_zero)); + ASSERT_TRUE(search_result); + ASSERT_THAT(search_result.value().entry, NotNull()); + EXPECT_EQ(search_result.value().entry->overlayable_declarations.size(), 3); + EXPECT_TRUE(search_result.value().entry->overlayable_declarations[0].policy); + EXPECT_EQ(search_result.value().entry->overlayable_declarations[0].policy, + Overlayable::Policy::kSystem); + EXPECT_TRUE(search_result.value().entry->overlayable_declarations[1].policy); + EXPECT_EQ(search_result.value().entry->overlayable_declarations[1].policy, + Overlayable::Policy::kProduct); + EXPECT_TRUE(search_result.value().entry->overlayable_declarations[2].policy); + EXPECT_EQ(search_result.value().entry->overlayable_declarations[2].policy, + Overlayable::Policy::kProductServices); + + search_result = output_table.FindResource(test::ParseNameOrDie(name_one)); + ASSERT_TRUE(search_result); + ASSERT_THAT(search_result.value().entry, NotNull()); + EXPECT_EQ(search_result.value().entry->overlayable_declarations.size(), 2); + EXPECT_TRUE(search_result.value().entry->overlayable_declarations[0].policy); + EXPECT_EQ(search_result.value().entry->overlayable_declarations[0].policy, + Overlayable::Policy::kPublic); + EXPECT_TRUE(search_result.value().entry->overlayable_declarations[1].policy); + EXPECT_EQ(search_result.value().entry->overlayable_declarations[1].policy, + Overlayable::Policy::kSystem); + + search_result = output_table.FindResource(test::ParseNameOrDie(name_two)); + ASSERT_TRUE(search_result); + ASSERT_THAT(search_result.value().entry, NotNull()); + EXPECT_EQ(search_result.value().entry->overlayable_declarations.size(), 3); + EXPECT_TRUE(search_result.value().entry->overlayable_declarations[0].policy); + EXPECT_EQ(search_result.value().entry->overlayable_declarations[0].policy, + Overlayable::Policy::kSystem); + EXPECT_TRUE(search_result.value().entry->overlayable_declarations[1].policy); + EXPECT_EQ(search_result.value().entry->overlayable_declarations[1].policy, + Overlayable::Policy::kProduct); + EXPECT_TRUE(search_result.value().entry->overlayable_declarations[2].policy); + EXPECT_EQ(search_result.value().entry->overlayable_declarations[2].policy, + Overlayable::Policy::kProductServices); + + search_result = output_table.FindResource(test::ParseNameOrDie(name_three)); + ASSERT_TRUE(search_result); + ASSERT_THAT(search_result.value().entry, NotNull()); + EXPECT_EQ(search_result.value().entry->overlayable_declarations.size(), 1); + EXPECT_TRUE(search_result.value().entry->overlayable_declarations[0].policy); + EXPECT_EQ(search_result.value().entry->overlayable_declarations[0].policy, + Overlayable::Policy::kPublic); - const StringPiece16 overlayable_name(u"com.app.test:integer/overlayable"); - uint32_t spec_flags = 0u; - ASSERT_THAT(res_table.identifierForName(overlayable_name.data(), overlayable_name.size(), nullptr, - 0u, nullptr, 0u, &spec_flags), - Gt(0u)); - EXPECT_TRUE(spec_flags & android::ResTable_typeSpec::SPEC_OVERLAYABLE); } + } // namespace aapt diff --git a/tools/aapt2/link/ReferenceLinker.cpp b/tools/aapt2/link/ReferenceLinker.cpp index 3a5d5858254d..1b6626a8dfe9 100644 --- a/tools/aapt2/link/ReferenceLinker.cpp +++ b/tools/aapt2/link/ReferenceLinker.cpp @@ -368,7 +368,16 @@ bool ReferenceLinker::Consume(IAaptContext* context, ResourceTable* table) { // Symbol state information may be lost if there is no value for the resource. if (entry->visibility.level != Visibility::Level::kUndefined && entry->values.empty()) { context->GetDiagnostics()->Error(DiagMessage(entry->visibility.source) - << "no definition for declared symbol '" << name << "'"); + << "no definition for declared symbol '" << name + << "'"); + error = true; + } + + // Ensure that definitions for values declared as overlayable exist + if (!entry->overlayable_declarations.empty() && entry->values.empty()) { + context->GetDiagnostics()->Error(DiagMessage(entry->overlayable_declarations[0].source) + << "no definition for overlayable symbol '" + << name << "'"); error = true; } diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 8e0d4acf089d..89b670390171 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -1982,6 +1982,8 @@ public class WifiManager { public static final int WIFI_FEATURE_WPA3_SUITE_B = 0x10000000; // WPA3-Enterprise Suite-B /** @hide */ public static final int WIFI_FEATURE_OWE = 0x20000000; // Enhanced Open + /** @hide */ + public static final int WIFI_FEATURE_LOW_LATENCY = 0x40000000; // Low Latency modes private int getSupportedFeatures() { try { diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java index b0ed11034810..e0442f2fd5ae 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java @@ -22,7 +22,6 @@ import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; -import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.UnsupportedAppUsage; import android.content.Context; @@ -1695,7 +1694,6 @@ public class WifiP2pManager { * @param listener for callback on success or failure. Can be null. * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void factoryReset(@NonNull Channel c, @Nullable ActionListener listener) { checkChannel(c); |