summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/hiddenapi-greylist-max-p.txt50
-rw-r--r--config/hiddenapi-greylist.txt7
-rw-r--r--core/java/android/app/IUiModeManager.aidl1
-rw-r--r--core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl2
-rw-r--r--core/java/android/content/Context.java3
-rw-r--r--core/java/android/database/IContentObserver.aidl1
-rw-r--r--core/java/android/hardware/camera2/impl/CameraDeviceImpl.java6
-rw-r--r--core/java/android/net/IConnectivityManager.aidl2
-rw-r--r--core/java/android/os/BatteryStats.java30
-rw-r--r--core/java/android/os/CancellationSignal.java7
-rw-r--r--core/java/android/os/IPowerManager.aidl1
-rw-r--r--core/java/android/os/Parcel.java1
-rw-r--r--core/java/android/os/PowerManager.java1
-rw-r--r--core/java/android/os/Process.java1
-rw-r--r--core/java/android/os/Registrant.java1
-rw-r--r--core/java/android/os/RegistrantList.java1
-rw-r--r--core/java/android/os/RemoteCallback.java3
-rw-r--r--core/java/android/os/RemoteCallbackList.java1
-rw-r--r--core/java/android/os/SystemProperties.java5
-rw-r--r--core/java/android/os/UserHandle.java1
-rw-r--r--core/java/android/os/WorkSource.java4
-rw-r--r--core/java/android/service/carrier/ICarrierMessagingService.aidl1
-rw-r--r--core/java/android/view/IWindowManager.aidl2
-rw-r--r--core/java/android/webkit/WebSettings.java4
-rw-r--r--core/java/android/widget/StackView.java58
-rw-r--r--core/java/com/android/internal/preference/YesNoPreference.java2
-rw-r--r--core/java/com/android/internal/view/BaseIWindow.java6
-rw-r--r--core/jni/Android.bp3
-rw-r--r--core/tests/overlaytests/device/Android.bp26
-rw-r--r--core/tests/overlaytests/device/Android.mk32
-rw-r--r--core/tests/overlaytests/device/test-apps/Android.mk15
-rw-r--r--core/tests/overlaytests/device/test-apps/AppOverlayOne/Android.bp20
-rw-r--r--core/tests/overlaytests/device/test-apps/AppOverlayOne/Android.mk24
-rw-r--r--core/tests/overlaytests/device/test-apps/AppOverlayTwo/Android.bp20
-rw-r--r--core/tests/overlaytests/device/test-apps/AppOverlayTwo/Android.mk24
-rw-r--r--core/tests/overlaytests/device/test-apps/FrameworkOverlay/Android.bp21
-rw-r--r--core/tests/overlaytests/device/test-apps/FrameworkOverlay/Android.mk25
-rw-r--r--graphics/java/android/graphics/RectF.java2
-rw-r--r--libs/hostgraphics/Android.bp24
-rw-r--r--libs/hostgraphics/gui/IGraphicBufferProducer.h36
-rw-r--r--libs/hostgraphics/gui/Surface.h66
-rwxr-xr-xlibs/hwui/tests/scripts/skp-capture.sh8
-rw-r--r--location/java/com/android/internal/location/ILocationProvider.aidl3
-rw-r--r--packages/Shell/src/com/android/shell/BugreportProgressService.java6
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java3
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationListener.java4
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java46
-rw-r--r--packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/assist/AssistManager.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeLog.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java49
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java34
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java41
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java37
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java8
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java10
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java4
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java1
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java8
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityServiceConnection.java2
-rw-r--r--services/accessibility/java/com/android/server/accessibility/BaseEventStreamTransformation.java2
-rw-r--r--services/accessibility/java/com/android/server/accessibility/EventStreamTransformation.java2
-rw-r--r--services/accessibility/java/com/android/server/accessibility/MagnificationGestureHandler.java3
-rw-r--r--services/accessibility/java/com/android/server/accessibility/MotionEventInjector.java8
-rw-r--r--services/accessibility/java/com/android/server/accessibility/gestures/AccessibilityGestureDetector.java (renamed from services/accessibility/java/com/android/server/accessibility/AccessibilityGestureDetector.java)2
-rw-r--r--services/accessibility/java/com/android/server/accessibility/gestures/GestureUtils.java (renamed from services/accessibility/java/com/android/server/accessibility/GestureUtils.java)4
-rw-r--r--services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java (renamed from services/accessibility/java/com/android/server/accessibility/TouchExplorer.java)8
-rw-r--r--services/accessibility/java/com/android/server/accessibility/gestures/TouchState.java (renamed from services/accessibility/java/com/android/server/accessibility/TouchState.java)2
-rw-r--r--services/core/java/com/android/server/audio/AudioDeviceBroker.java114
-rw-r--r--services/core/java/com/android/server/audio/AudioDeviceInventory.java96
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java36
-rw-r--r--services/core/java/com/android/server/audio/BtHelper.java12
-rw-r--r--services/core/java/com/android/server/connectivity/Tethering.java1
-rw-r--r--services/core/java/com/android/server/pm/BackgroundDexOptService.java88
-rw-r--r--services/core/java/com/android/server/pm/ProtectedPackages.java3
-rw-r--r--services/core/java/com/android/server/role/RoleManagerService.java3
-rw-r--r--services/core/java/com/android/server/wm/DragState.java12
-rw-r--r--services/core/java/com/android/server/wm/SurfaceAnimationRunner.java4
-rw-r--r--services/core/java/com/android/server/wm/SurfaceAnimator.java6
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java6
-rw-r--r--services/tests/servicestests/AndroidManifest.xml1
-rw-r--r--services/tests/servicestests/src/com/android/server/accessibility/AccessibilityInputFilterTest.java2
-rw-r--r--services/tests/servicestests/src/com/android/server/accessibility/AccessibilityServiceConnectionTest.java6
-rw-r--r--services/tests/servicestests/src/com/android/server/accessibility/MotionEventInjectorTest.java4
-rw-r--r--services/tests/servicestests/src/com/android/server/accessibility/gestures/AccessibilityGestureDetectorTest.java (renamed from services/tests/servicestests/src/com/android/server/accessibility/AccessibilityGestureDetectorTest.java)2
-rw-r--r--services/tests/servicestests/src/com/android/server/accessibility/gestures/TouchExplorerTest.java (renamed from services/tests/servicestests/src/com/android/server/accessibility/TouchExplorerTest.java)5
-rw-r--r--services/tests/servicestests/src/com/android/server/audio/AudioDeviceBrokerTest.java162
-rw-r--r--startop/view_compiler/dex_layout_compiler.cc19
-rwxr-xr-xtelephony/java/android/telephony/CarrierConfigManager.java17
-rw-r--r--telephony/java/android/telephony/DisconnectCause.java17
-rw-r--r--telephony/java/android/telephony/ims/ImsReasonInfo.java13
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl2
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl4
101 files changed, 1125 insertions, 441 deletions
diff --git a/config/hiddenapi-greylist-max-p.txt b/config/hiddenapi-greylist-max-p.txt
index 25d45b0e6570..351e71dd9538 100644
--- a/config/hiddenapi-greylist-max-p.txt
+++ b/config/hiddenapi-greylist-max-p.txt
@@ -1,57 +1,14 @@
Landroid/app/IInstrumentationWatcher$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IInstrumentationWatcher;
Landroid/app/ISearchManager$Stub;-><init>()V
Landroid/app/IUiModeManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IUiModeManager;
-Landroid/app/IUiModeManager;->disableCarMode(I)V
Landroid/bluetooth/IBluetooth$Stub;-><init>()V
Landroid/bluetooth/IBluetoothA2dp$Stub;-><init>()V
Landroid/content/IIntentReceiver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IIntentReceiver;
Landroid/content/IIntentSender$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IIntentSender;
-Landroid/net/IConnectivityManager;->getNetworkInfo(I)Landroid/net/NetworkInfo;
-Landroid/net/IConnectivityManager;->reportInetCondition(II)V
-Landroid/os/BatteryStats$Counter;-><init>()V
-Landroid/os/BatteryStats$HistoryItem;->clear()V
-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$Timer;-><init>()V
-Landroid/os/BatteryStats$Uid$Pkg;-><init>()V
-Landroid/os/BatteryStats$Uid$Proc;-><init>()V
-Landroid/os/BatteryStats$Uid$Sensor;-><init>()V
-Landroid/os/BatteryStats$Uid$Wakelock;-><init>()V
-Landroid/os/BatteryStats;-><init>()V
-Landroid/os/BatteryStats;->getMobileRadioActiveTime(JI)J
-Landroid/os/BatteryStats;->getNetworkActivityBytes(II)J
-Landroid/os/CancellationSignal;->mCancelInProgress:Z
-Landroid/os/CancellationSignal;->mIsCanceled:Z
-Landroid/os/CancellationSignal;->mOnCancelListener:Landroid/os/CancellationSignal$OnCancelListener;
-Landroid/os/CancellationSignal;->mRemote:Landroid/os/ICancellationSignal;
-Landroid/os/CancellationSignal;->waitForCancelFinishedLocked()V
-Landroid/os/IPowerManager;->nap(J)V
-Landroid/os/Parcel;->mCreators:Ljava/util/HashMap;
-Landroid/os/PowerManager;->mHandler:Landroid/os/Handler;
-Landroid/os/Process;->sendSignalQuiet(II)V
-Landroid/os/Registrant;->getHandler()Landroid/os/Handler;
-Landroid/os/RegistrantList;->get(I)Ljava/lang/Object;
-Landroid/os/RemoteCallback;->mHandler:Landroid/os/Handler;
Landroid/os/storage/IObbActionListener$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/storage/IObbActionListener;
-Landroid/os/SystemProperties;->native_add_change_callback()V
-Landroid/os/SystemProperties;->native_get(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
-Landroid/os/SystemProperties;->native_get_boolean(Ljava/lang/String;Z)Z
-Landroid/os/SystemProperties;->native_get_int(Ljava/lang/String;I)I
-Landroid/os/SystemProperties;->native_set(Ljava/lang/String;Ljava/lang/String;)V
-Landroid/os/UserHandle;->formatUid(Ljava/io/PrintWriter;I)V
-Landroid/os/WorkSource;->sGoneWork:Landroid/os/WorkSource;
-Landroid/os/WorkSource;->sNewbWork:Landroid/os/WorkSource;
-Landroid/os/WorkSource;->sTmpWorkSource:Landroid/os/WorkSource;
-Landroid/os/WorkSource;->updateLocked(Landroid/os/WorkSource;ZZ)Z
Landroid/service/carrier/ICarrierMessagingCallback$Stub;-><init>()V
-Landroid/service/carrier/ICarrierMessagingService;->filterSms(Landroid/service/carrier/MessagePdu;Ljava/lang/String;IILandroid/service/carrier/ICarrierMessagingCallback;)V
-Landroid/telephony/CarrierMessagingServiceManager;-><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/IWindowManager;->setInTouchMode(Z)V
-Landroid/view/IWindowManager;->showStrictModeViolation(Z)V
Lcom/android/internal/R$styleable;->AndroidManifestActivityAlias:[I
Lcom/android/internal/R$styleable;->AndroidManifestGrantUriPermission:[I
Lcom/android/internal/R$styleable;->AndroidManifestInstrumentation:[I
@@ -70,10 +27,3 @@ Lcom/android/internal/R$styleable;->MenuView:[I
Lcom/android/internal/R$styleable;->Searchable:[I
Lcom/android/internal/R$styleable;->SearchableActionKey:[I
Lcom/android/internal/telephony/IPhoneSubInfo$Stub;-><init>()V
-Lcom/android/internal/telephony/ITelephony;->getDataActivity()I
-Lcom/android/internal/telephony/ITelephony;->getDataState()I
-Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCallForwardingChanged(Z)V
-Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCellLocation(Landroid/os/Bundle;)V
-Lcom/android/internal/telephony/ITelephonyRegistry;->notifyDataActivity(I)V
-Lcom/android/internal/telephony/ITelephonyRegistry;->notifyOtaspChanged(II)V
-Lcom/android/internal/view/BaseIWindow;-><init>()V
diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt
index c30a6f491807..eb53b7c20dbc 100644
--- a/config/hiddenapi-greylist.txt
+++ b/config/hiddenapi-greylist.txt
@@ -121,8 +121,6 @@ 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/content/IClipboard$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/content/IClipboard$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IClipboard;
Landroid/content/IContentService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
@@ -194,7 +192,6 @@ Landroid/content/res/DrawableCache;-><init>()V
Landroid/content/UndoManager;-><init>()V
Landroid/database/IContentObserver$Stub;-><init>()V
Landroid/database/IContentObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/database/IContentObserver;
-Landroid/database/IContentObserver;->onChange(ZLandroid/net/Uri;I)V
Landroid/database/sqlite/SQLiteConnectionPool;->$assertionsDisabled:Z
Landroid/database/sqlite/SQLiteDatabase;->$assertionsDisabled:Z
Landroid/hardware/display/IDisplayManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/display/IDisplayManager;
@@ -723,9 +720,6 @@ Lcom/android/internal/location/GpsNetInitiatedHandler;->handleNiNotification(Lco
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;->sendExtraCommand(Ljava/lang/String;Landroid/os/Bundle;)V
-Lcom/android/internal/location/ILocationProvider;->setLocationProviderManager(Lcom/android/internal/location/ILocationProviderManager;)V
-Lcom/android/internal/location/ILocationProvider;->setRequest(Lcom/android/internal/location/ProviderRequest;Landroid/os/WorkSource;)V
Lcom/android/internal/location/ILocationProviderManager$Stub;-><init>()V
Lcom/android/internal/location/ILocationProviderManager$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/location/ILocationProviderManager;
Lcom/android/internal/logging/MetricsLogger;-><init>()V
@@ -736,7 +730,6 @@ Lcom/android/internal/os/BatterySipper$DrainType;->values()[Lcom/android/interna
Lcom/android/internal/os/IDropBoxManagerService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/os/IDropBoxManagerService;
Lcom/android/internal/policy/IKeyguardService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/policy/IKeyguardService;
Lcom/android/internal/policy/IKeyguardStateCallback$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/policy/IKeyguardStateCallback;
-Lcom/android/internal/preference/YesNoPreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
Lcom/android/internal/R$anim;->fade_in:I
Lcom/android/internal/R$array;->config_autoBrightnessLcdBacklightValues:I
Lcom/android/internal/R$array;->config_autoBrightnessLevels:I
diff --git a/core/java/android/app/IUiModeManager.aidl b/core/java/android/app/IUiModeManager.aidl
index cae54b6c0611..f2c9f615c03f 100644
--- a/core/java/android/app/IUiModeManager.aidl
+++ b/core/java/android/app/IUiModeManager.aidl
@@ -30,6 +30,7 @@ interface IUiModeManager {
/**
* Disables the car mode.
*/
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void disableCarMode(int flags);
/**
diff --git a/core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl b/core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl
index 5f73e551d57c..c9dc019bd2f2 100644
--- a/core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl
+++ b/core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl
@@ -18,6 +18,8 @@ package android.companion;
/** @hide */
interface ICompanionDeviceDiscoveryServiceCallback {
+ @UnsupportedAppUsage
oneway void onDeviceSelected(String packageName, int userId, String deviceAddress);
+ @UnsupportedAppUsage
oneway void onDeviceSelectionCancel();
}
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 7a013f176691..73bc908632b2 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -3197,6 +3197,7 @@ public abstract class Context {
TELEPHONY_SERVICE,
TELEPHONY_SUBSCRIPTION_SERVICE,
CARRIER_CONFIG_SERVICE,
+ EUICC_SERVICE,
TELECOM_SERVICE,
CLIPBOARD_SERVICE,
INPUT_METHOD_SERVICE,
@@ -3387,6 +3388,8 @@ public abstract class Context {
* @see android.telephony.SubscriptionManager
* @see #CARRIER_CONFIG_SERVICE
* @see android.telephony.CarrierConfigManager
+ * @see #EUICC_SERVICE
+ * @see android.telephony.euicc.EuiccManager
* @see #INPUT_METHOD_SERVICE
* @see android.view.inputmethod.InputMethodManager
* @see #UI_MODE_SERVICE
diff --git a/core/java/android/database/IContentObserver.aidl b/core/java/android/database/IContentObserver.aidl
index 22dc9fed59c4..623556695341 100644
--- a/core/java/android/database/IContentObserver.aidl
+++ b/core/java/android/database/IContentObserver.aidl
@@ -29,5 +29,6 @@ interface IContentObserver
* observed. selfUpdate is true if the update was caused by a call to
* commit on the cursor that is being observed.
*/
+ @UnsupportedAppUsage
oneway void onChange(boolean selfUpdate, in Uri uri, int userId);
}
diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
index cc8c182b867e..68857da940d5 100644
--- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
+++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
@@ -2337,6 +2337,12 @@ public class CameraDeviceImpl extends CameraDevice
final CaptureCallbackHolder holder =
CameraDeviceImpl.this.mCaptureCallbackMap.get(requestId);
+ if (holder == null) {
+ Log.e(TAG, String.format("Receive capture error on unknown request ID %d",
+ requestId));
+ return;
+ }
+
final CaptureRequest request = holder.getRequest(subsequenceId);
Runnable failureDispatch = null;
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index 61648dc7f1d8..5f662f914919 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -52,6 +52,7 @@ interface IConnectivityManager
@UnsupportedAppUsage
NetworkInfo getActiveNetworkInfo();
NetworkInfo getActiveNetworkInfoForUid(int uid, boolean ignoreBlocked);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
NetworkInfo getNetworkInfo(int networkType);
NetworkInfo getNetworkInfoForUid(in Network network, int uid, boolean ignoreBlocked);
@UnsupportedAppUsage
@@ -112,6 +113,7 @@ interface IConnectivityManager
int setUsbTethering(boolean enable, String callerPkg);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void reportInetCondition(int networkType, int percentage);
void reportNetworkConnectivity(in Network network, boolean hasConnectivity);
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index caa6a43e521c..a399e8362874 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -64,6 +64,10 @@ import java.util.Map;
* @hide
*/
public abstract class BatteryStats implements Parcelable {
+
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public BatteryStats() {}
+
private static final String TAG = "BatteryStats";
private static final boolean LOCAL_LOGV = false;
@@ -407,6 +411,9 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Counter {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Counter() {}
+
/**
* Returns the count associated with this Counter for the
* selected type of statistics.
@@ -516,6 +523,9 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Timer {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Timer() {}
+
/**
* Returns the count associated with this Timer for the
* selected type of statistics.
@@ -671,6 +681,9 @@ public abstract class BatteryStats implements Parcelable {
* The statistics associated with a particular wake lock.
*/
public static abstract class Wakelock {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Wakelock() {}
+
@UnsupportedAppUsage
public abstract Timer getWakeTime(int type);
}
@@ -948,6 +961,10 @@ public abstract class BatteryStats implements Parcelable {
public abstract void getDeferredJobsLineLocked(StringBuilder sb, int which);
public static abstract class Sensor {
+
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Sensor() {}
+
/*
* FIXME: it's not correct to use this magic value because it
* could clash with a sensor handle (which are defined by
@@ -978,6 +995,9 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Proc {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Proc() {}
+
public static class ExcessivePower {
public static final int TYPE_WAKE = 1;
public static final int TYPE_CPU = 2;
@@ -1053,6 +1073,9 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Pkg {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Pkg() {}
+
/**
* Returns information about all wakeup alarms that have been triggered for this
* package. The mapping keys are tag names for the alarms, the counter contains
@@ -1558,6 +1581,7 @@ public abstract class BatteryStats implements Parcelable {
* Battery history record.
*/
public static final class HistoryItem {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public HistoryItem next;
// The time of this event in milliseconds, as per SystemClock.elapsedRealtime().
@@ -1875,6 +1899,7 @@ public abstract class BatteryStats implements Parcelable {
numReadInts += (src.dataPosition()-start)/4;
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public void clear() {
time = 0;
cmd = CMD_NULL;
@@ -1895,12 +1920,14 @@ public abstract class BatteryStats implements Parcelable {
eventTag = null;
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public void setTo(HistoryItem o) {
time = o.time;
cmd = o.cmd;
setToCommon(o);
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public void setTo(long time, byte cmd, HistoryItem o) {
this.time = time;
this.cmd = cmd;
@@ -1956,6 +1983,7 @@ public abstract class BatteryStats implements Parcelable {
&& currentTime == o.currentTime;
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public boolean same(HistoryItem o) {
if (!sameNonEvent(o) || eventCode != o.eventCode) {
return false;
@@ -2338,6 +2366,7 @@ public abstract class BatteryStats implements Parcelable {
*
* {@hide}
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public abstract long getMobileRadioActiveTime(long elapsedRealtimeUs, int which);
/**
@@ -2698,6 +2727,7 @@ public abstract class BatteryStats implements Parcelable {
public static final int NETWORK_WIFI_BG_TX_DATA = 9;
public static final int NUM_NETWORK_ACTIVITY_TYPES = NETWORK_WIFI_BG_TX_DATA + 1;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public abstract long getNetworkActivityBytes(int type, int which);
public abstract long getNetworkActivityPackets(int type, int which);
diff --git a/core/java/android/os/CancellationSignal.java b/core/java/android/os/CancellationSignal.java
index e8053d5d275d..99fb9982e706 100644
--- a/core/java/android/os/CancellationSignal.java
+++ b/core/java/android/os/CancellationSignal.java
@@ -18,13 +18,19 @@ package android.os;
import android.os.ICancellationSignal;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* Provides the ability to cancel an operation in progress.
*/
public final class CancellationSignal {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private boolean mIsCanceled;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private OnCancelListener mOnCancelListener;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private ICancellationSignal mRemote;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private boolean mCancelInProgress;
/**
@@ -152,6 +158,7 @@ public final class CancellationSignal {
}
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private void waitForCancelFinishedLocked() {
while (mCancelInProgress) {
try {
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index e1d605e1c99d..185693e8e6e0 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -47,6 +47,7 @@ interface IPowerManager
void wakeUp(long time, int reason, String details, String opPackageName);
@UnsupportedAppUsage
void goToSleep(long time, int reason, int flags);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void nap(long time);
@UnsupportedAppUsage
boolean isInteractive();
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index dbe3c93738b8..e1b55422274a 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -3148,6 +3148,7 @@ public final class Parcel {
// Cache of previously looked up CREATOR.createFromParcel() methods for
// particular classes. Keys are the names of the classes, values are
// Method objects.
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static final HashMap<ClassLoader,HashMap<String,Parcelable.Creator<?>>>
mCreators = new HashMap<>();
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 535d887de9ae..7ea26210dc0c 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -824,6 +824,7 @@ public final class PowerManager {
final Context mContext;
@UnsupportedAppUsage
final IPowerManager mService;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
final Handler mHandler;
IThermalService mThermalService;
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index b535e8d0601c..30e59590022c 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -999,6 +999,7 @@ public class Process {
* your own log, or the Android Illuminati will find you some night and
* beat you up.
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public static final native void sendSignalQuiet(int pid, int signal);
/** @hide */
diff --git a/core/java/android/os/Registrant.java b/core/java/android/os/Registrant.java
index 8fb123aa3da4..572b975fbafd 100644
--- a/core/java/android/os/Registrant.java
+++ b/core/java/android/os/Registrant.java
@@ -114,6 +114,7 @@ public class Registrant
}
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public Handler
getHandler()
{
diff --git a/core/java/android/os/RegistrantList.java b/core/java/android/os/RegistrantList.java
index 6e562ffc88ea..e9bc6371f043 100644
--- a/core/java/android/os/RegistrantList.java
+++ b/core/java/android/os/RegistrantList.java
@@ -70,6 +70,7 @@ public class RegistrantList
return registrants.size();
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public synchronized Object
get(int index)
{
diff --git a/core/java/android/os/RemoteCallback.java b/core/java/android/os/RemoteCallback.java
index 047ba1d20056..da58d0fac160 100644
--- a/core/java/android/os/RemoteCallback.java
+++ b/core/java/android/os/RemoteCallback.java
@@ -21,6 +21,8 @@ import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.TestApi;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* @hide
*/
@@ -33,6 +35,7 @@ public final class RemoteCallback implements Parcelable {
}
private final OnResultListener mListener;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private final Handler mHandler;
private final IRemoteCallback mCallback;
diff --git a/core/java/android/os/RemoteCallbackList.java b/core/java/android/os/RemoteCallbackList.java
index b377e8dbe14f..6165146ece0a 100644
--- a/core/java/android/os/RemoteCallbackList.java
+++ b/core/java/android/os/RemoteCallbackList.java
@@ -123,6 +123,7 @@ public class RemoteCallbackList<E extends IInterface> {
IBinder binder = callback.asBinder();
try {
Callback cb = new Callback(callback, cookie);
+ unregister(callback);
binder.linkToDeath(cb, 0);
mCallbacks.put(binder, cb);
return true;
diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java
index a7edb5eb9d8b..cdae72ebd313 100644
--- a/core/java/android/os/SystemProperties.java
+++ b/core/java/android/os/SystemProperties.java
@@ -88,12 +88,17 @@ public class SystemProperties {
@UnsupportedAppUsage
private static native String native_get(String key);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native String native_get(String key, String def);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native int native_get_int(String key, int def);
@UnsupportedAppUsage
private static native long native_get_long(String key, long def);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native boolean native_get_boolean(String key, boolean def);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native void native_set(String key, String def);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native void native_add_change_callback();
private static native void native_report_sysprop_change();
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index d70ba9921bfd..4e17f7e92013 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -354,6 +354,7 @@ public final class UserHandle implements Parcelable {
* components -- user, app, isolated, etc.
* @hide
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public static void formatUid(PrintWriter pw, int uid) {
if (uid < Process.FIRST_APPLICATION_UID) {
pw.print(uid);
diff --git a/core/java/android/os/WorkSource.java b/core/java/android/os/WorkSource.java
index 0b4a56121038..114de2378a1f 100644
--- a/core/java/android/os/WorkSource.java
+++ b/core/java/android/os/WorkSource.java
@@ -39,14 +39,17 @@ public class WorkSource implements Parcelable {
* The WorkSource object itself is not thread safe, but we need to
* hold sTmpWorkSource lock while working with these statics.
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
static final WorkSource sTmpWorkSource = new WorkSource(0);
/**
* For returning newbie work from a modification operation.
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
static WorkSource sNewbWork;
/**
* For returning gone work form a modification operation.
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
static WorkSource sGoneWork;
/**
@@ -619,6 +622,7 @@ public class WorkSource implements Parcelable {
return changed;
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private boolean updateLocked(WorkSource other, boolean set, boolean returnNewbs) {
if (mNames == null && other.mNames == null) {
return updateUidsLocked(other, set, returnNewbs);
diff --git a/core/java/android/service/carrier/ICarrierMessagingService.aidl b/core/java/android/service/carrier/ICarrierMessagingService.aidl
index 2d96c3da6487..c4dfb57bb6a0 100644
--- a/core/java/android/service/carrier/ICarrierMessagingService.aidl
+++ b/core/java/android/service/carrier/ICarrierMessagingService.aidl
@@ -36,6 +36,7 @@ oneway interface ICarrierMessagingService {
* @param subId SMS subscription ID of the SIM
* @param callback the callback to notify upon completion
*/
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void filterSms(
in MessagePdu pdu, String format, int destPort, int subId,
in ICarrierMessagingCallback callback);
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index b347a78a8780..bb9867a298c3 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -151,6 +151,7 @@ interface IWindowManager
float getCurrentAnimatorScale();
// For testing
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void setInTouchMode(boolean showFocus);
// For StrictMode flashing a red border on violations from the UI
@@ -158,6 +159,7 @@ interface IWindowManager
// Manager uses that to determine whether or not the red border should
// actually be shown. (it will be ignored that pid doesn't have windows
// on screen)
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void showStrictModeViolation(boolean on);
// Proxy to set the system property for whether the flashing
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index a46580dcc539..18d4d691f726 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -464,7 +464,9 @@ public abstract class WebSettings {
* Note that the feature will continue to be supported on older versions of
* Android as before.
*
- * This function does not have any effect.
+ * @deprecated In Android O and afterwards, this function does not have
+ * any effect, the form data will be saved to platform's autofill service
+ * if applicable.
*/
@Deprecated
public abstract void setSaveFormData(boolean save);
diff --git a/core/java/android/widget/StackView.java b/core/java/android/widget/StackView.java
index 5091eea1898d..ad3563316854 100644
--- a/core/java/android/widget/StackView.java
+++ b/core/java/android/widget/StackView.java
@@ -42,6 +42,8 @@ import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.LinearInterpolator;
import android.widget.RemoteViews.RemoteView;
+import com.android.internal.R;
+
import java.lang.ref.WeakReference;
@RemoteView
@@ -1241,14 +1243,40 @@ public class StackView extends AdapterViewAnimator {
info.setScrollable(getChildCount() > 1);
if (isEnabled()) {
if (getDisplayedChild() < getChildCount() - 1) {
- info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
+ info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
+ if (mStackMode == ITEMS_SLIDE_UP) {
+ info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_DOWN);
+ } else {
+ info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_UP);
+ }
}
if (getDisplayedChild() > 0) {
- info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
+ info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
+ if (mStackMode == ITEMS_SLIDE_UP) {
+ info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_UP);
+ } else {
+ info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_DOWN);
+ }
}
}
}
+ private boolean goForward() {
+ if (getDisplayedChild() < getChildCount() - 1) {
+ showNext();
+ return true;
+ }
+ return false;
+ }
+
+ private boolean goBackward() {
+ if (getDisplayedChild() > 0) {
+ showPrevious();
+ return true;
+ }
+ return false;
+ }
+
/** @hide */
@Override
public boolean performAccessibilityActionInternal(int action, Bundle arguments) {
@@ -1260,17 +1288,25 @@ public class StackView extends AdapterViewAnimator {
}
switch (action) {
case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
- if (getDisplayedChild() < getChildCount() - 1) {
- showNext();
- return true;
- }
- } return false;
+ return goForward();
+ }
case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
- if (getDisplayedChild() > 0) {
- showPrevious();
- return true;
+ return goBackward();
+ }
+ case R.id.accessibilityActionPageUp: {
+ if (mStackMode == ITEMS_SLIDE_UP) {
+ return goBackward();
+ } else {
+ return goForward();
+ }
+ }
+ case R.id.accessibilityActionPageDown: {
+ if (mStackMode == ITEMS_SLIDE_UP) {
+ return goForward();
+ } else {
+ return goBackward();
}
- } return false;
+ }
}
return false;
}
diff --git a/core/java/com/android/internal/preference/YesNoPreference.java b/core/java/com/android/internal/preference/YesNoPreference.java
index 7abf416bf0af..46d14a16de1e 100644
--- a/core/java/com/android/internal/preference/YesNoPreference.java
+++ b/core/java/com/android/internal/preference/YesNoPreference.java
@@ -16,6 +16,7 @@
package com.android.internal.preference;
+import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Parcel;
@@ -40,6 +41,7 @@ public class YesNoPreference extends DialogPreference {
this(context, attrs, defStyleAttr, 0);
}
+ @UnsupportedAppUsage
public YesNoPreference(Context context, AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.yesNoPreferenceStyle);
}
diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java
index dfd6f95c00af..cc468f41a7f3 100644
--- a/core/java/com/android/internal/view/BaseIWindow.java
+++ b/core/java/com/android/internal/view/BaseIWindow.java
@@ -33,7 +33,13 @@ import android.view.PointerIcon;
import com.android.internal.os.IResultReceiver;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
public class BaseIWindow extends IWindow.Stub {
+
+ @UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.P)
+ public BaseIWindow() {}
+
private IWindowSession mSession;
public int mSeq;
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index 73a7289c55b7..844a89862d5a 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -288,6 +288,8 @@ cc_library_shared {
],
include_dirs: [
"external/vulkan-headers/include",
+ "frameworks/native/libs/nativebase/include",
+ "frameworks/native/libs/nativewindow/include"
],
shared_libs: [
"libicui18n",
@@ -297,6 +299,7 @@ cc_library_shared {
"libandroidfw",
"libcompiler_rt",
"libutils",
+ "libhostgraphics",
],
},
linux_glibc: {
diff --git a/core/tests/overlaytests/device/Android.bp b/core/tests/overlaytests/device/Android.bp
new file mode 100644
index 000000000000..12a2b0815050
--- /dev/null
+++ b/core/tests/overlaytests/device/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test {
+ name: "OverlayDeviceTests",
+ srcs: ["src/**/*.java"],
+ platform_apis: true,
+ static_libs: ["androidx.test.rules"],
+ test_suites: ["device-tests"],
+ data: [
+ ":OverlayDeviceTests_AppOverlayOne",
+ ":OverlayDeviceTests_AppOverlayTwo",
+ ":OverlayDeviceTests_FrameworkOverlay",
+ ],
+}
diff --git a/core/tests/overlaytests/device/Android.mk b/core/tests/overlaytests/device/Android.mk
deleted file mode 100644
index c6d2a51b5224..000000000000
--- a/core/tests/overlaytests/device/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,src)
-LOCAL_MODULE_TAGS := tests
-LOCAL_PACKAGE_NAME := OverlayDeviceTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-LOCAL_COMPATIBILITY_SUITE := device-tests
-LOCAL_REQUIRED_MODULES := \
- OverlayDeviceTests_AppOverlayOne \
- OverlayDeviceTests_AppOverlayTwo \
- OverlayDeviceTests_FrameworkOverlay
-include $(BUILD_PACKAGE)
-
-# Include to build test-apps.
-include $(call all-makefiles-under,$(LOCAL_PATH))
-
diff --git a/core/tests/overlaytests/device/test-apps/Android.mk b/core/tests/overlaytests/device/test-apps/Android.mk
deleted file mode 100644
index 9af9f444ca59..000000000000
--- a/core/tests/overlaytests/device/test-apps/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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.
-
-include $(call all-subdir-makefiles)
diff --git a/core/tests/overlaytests/device/test-apps/AppOverlayOne/Android.bp b/core/tests/overlaytests/device/test-apps/AppOverlayOne/Android.bp
new file mode 100644
index 000000000000..da3aa007135a
--- /dev/null
+++ b/core/tests/overlaytests/device/test-apps/AppOverlayOne/Android.bp
@@ -0,0 +1,20 @@
+// 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.
+
+android_test {
+ name: "OverlayDeviceTests_AppOverlayOne",
+ sdk_version: "current",
+
+ aaptflags: ["--no-resource-removal"],
+}
diff --git a/core/tests/overlaytests/device/test-apps/AppOverlayOne/Android.mk b/core/tests/overlaytests/device/test-apps/AppOverlayOne/Android.mk
deleted file mode 100644
index fa15241b9cc5..000000000000
--- a/core/tests/overlaytests/device/test-apps/AppOverlayOne/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := tests
-LOCAL_PACKAGE_NAME := OverlayDeviceTests_AppOverlayOne
-LOCAL_SDK_VERSION := current
-LOCAL_COMPATIBILITY_SUITE := device-tests
-LOCAL_USE_AAPT2 := true
-LOCAL_AAPT_FLAGS := --no-resource-removal
-include $(BUILD_PACKAGE)
diff --git a/core/tests/overlaytests/device/test-apps/AppOverlayTwo/Android.bp b/core/tests/overlaytests/device/test-apps/AppOverlayTwo/Android.bp
new file mode 100644
index 000000000000..215b66da36dc
--- /dev/null
+++ b/core/tests/overlaytests/device/test-apps/AppOverlayTwo/Android.bp
@@ -0,0 +1,20 @@
+// 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.
+
+android_test {
+ name: "OverlayDeviceTests_AppOverlayTwo",
+ sdk_version: "current",
+
+ aaptflags: ["--no-resource-removal"],
+}
diff --git a/core/tests/overlaytests/device/test-apps/AppOverlayTwo/Android.mk b/core/tests/overlaytests/device/test-apps/AppOverlayTwo/Android.mk
deleted file mode 100644
index ada9b3cb625d..000000000000
--- a/core/tests/overlaytests/device/test-apps/AppOverlayTwo/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := tests
-LOCAL_PACKAGE_NAME := OverlayDeviceTests_AppOverlayTwo
-LOCAL_SDK_VERSION := current
-LOCAL_COMPATIBILITY_SUITE := device-tests
-LOCAL_USE_AAPT2 := true
-LOCAL_AAPT_FLAGS := --no-resource-removal
-include $(BUILD_PACKAGE)
diff --git a/core/tests/overlaytests/device/test-apps/FrameworkOverlay/Android.bp b/core/tests/overlaytests/device/test-apps/FrameworkOverlay/Android.bp
new file mode 100644
index 000000000000..50dbc6f054d3
--- /dev/null
+++ b/core/tests/overlaytests/device/test-apps/FrameworkOverlay/Android.bp
@@ -0,0 +1,21 @@
+// 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.
+
+android_test {
+ name: "OverlayDeviceTests_FrameworkOverlay",
+ sdk_version: "current",
+ certificate: "platform",
+
+ aaptflags: ["--no-resource-removal"],
+}
diff --git a/core/tests/overlaytests/device/test-apps/FrameworkOverlay/Android.mk b/core/tests/overlaytests/device/test-apps/FrameworkOverlay/Android.mk
deleted file mode 100644
index e4819e138eba..000000000000
--- a/core/tests/overlaytests/device/test-apps/FrameworkOverlay/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := tests
-LOCAL_PACKAGE_NAME := OverlayDeviceTests_FrameworkOverlay
-LOCAL_SDK_VERSION := current
-LOCAL_COMPATIBILITY_SUITE := device-tests
-LOCAL_CERTIFICATE := platform
-LOCAL_USE_AAPT2 := true
-LOCAL_AAPT_FLAGS := --no-resource-removal
-include $(BUILD_PACKAGE)
diff --git a/graphics/java/android/graphics/RectF.java b/graphics/java/android/graphics/RectF.java
index 3361fa21e44b..1d294d51a235 100644
--- a/graphics/java/android/graphics/RectF.java
+++ b/graphics/java/android/graphics/RectF.java
@@ -27,7 +27,7 @@ import java.io.PrintWriter;
/**
* RectF holds four float coordinates for a rectangle. The rectangle is
- * represented by the coordinates of its 4 edges (left, top, right bottom).
+ * represented by the coordinates of its 4 edges (left, top, right, bottom).
* These fields can be accessed directly. Use width() and height() to retrieve
* the rectangle's width and height. Note: most methods do not check to see that
* the coordinates are sorted correctly (i.e. left <= right and top <= bottom).
diff --git a/libs/hostgraphics/Android.bp b/libs/hostgraphics/Android.bp
new file mode 100644
index 000000000000..aedb7522ab08
--- /dev/null
+++ b/libs/hostgraphics/Android.bp
@@ -0,0 +1,24 @@
+cc_library_host_static {
+ name: "libhostgraphics",
+
+ srcs: [
+ ":libui_host_common",
+ ],
+
+ include_dirs: [
+ // Here we override all the headers automatically included with frameworks/native/include.
+ // When frameworks/native/include will be removed from the list of automatic includes.
+ // We will have to copy necessary headers with a pre-build step (generated headers).
+ ".",
+ "frameworks/native/libs/nativebase/include",
+ "frameworks/native/libs/nativewindow/include",
+ "frameworks/native/libs/arect/include",
+ ],
+ export_include_dirs: ["."],
+
+ target: {
+ windows: {
+ enabled: true,
+ }
+ },
+} \ No newline at end of file
diff --git a/libs/hostgraphics/gui/IGraphicBufferProducer.h b/libs/hostgraphics/gui/IGraphicBufferProducer.h
new file mode 100644
index 000000000000..00422136ff76
--- /dev/null
+++ b/libs/hostgraphics/gui/IGraphicBufferProducer.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 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 ANDROID_GUI_IGRAPHICBUFFERPRODUCER_H
+#define ANDROID_GUI_IGRAPHICBUFFERPRODUCER_H
+
+#include <utils/RefBase.h>
+
+namespace android {
+
+class IGraphicBufferProducer : virtual public RefBase {
+public:
+ enum class DisconnectMode {
+ // Disconnect only the specified API.
+ Api,
+ // Disconnect any API originally connected from the process calling disconnect.
+ AllLocal
+ };
+};
+
+} // namespace android
+
+#endif // ANDROID_GUI_IGRAPHICBUFFERPRODUCER_H
diff --git a/libs/hostgraphics/gui/Surface.h b/libs/hostgraphics/gui/Surface.h
new file mode 100644
index 000000000000..de1ba00211d3
--- /dev/null
+++ b/libs/hostgraphics/gui/Surface.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2019 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 ANDROID_GUI_SURFACE_H
+#define ANDROID_GUI_SURFACE_H
+
+#include <gui/IGraphicBufferProducer.h>
+#include <ui/ANativeObjectBase.h>
+#include <utils/RefBase.h>
+#include <system/window.h>
+
+namespace android {
+
+class Surface : public ANativeObjectBase<ANativeWindow, Surface, RefBase> {
+public:
+ explicit Surface(const sp<IGraphicBufferProducer>& bufferProducer,
+ bool controlledByApp = false) {
+ ANativeWindow::perform = hook_perform;
+ }
+ static bool isValid(const sp<Surface>& surface) { return surface != nullptr; }
+ void allocateBuffers() {}
+
+ uint64_t getNextFrameNumber() const { return 0; }
+
+ int setScalingMode(int mode) { return 0; }
+
+ virtual int disconnect(int api,
+ IGraphicBufferProducer::DisconnectMode mode =
+ IGraphicBufferProducer::DisconnectMode::Api) {
+ return 0;
+ }
+
+ virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds) {
+ // TODO: implement this
+ return 0;
+ }
+ virtual int unlockAndPost() { return 0; }
+ virtual int query(int what, int* value) const { return 0; }
+
+protected:
+ virtual ~Surface() {}
+
+ static int hook_perform(ANativeWindow* window, int operation, ...) { return 0; }
+
+private:
+ // can't be copied
+ Surface& operator=(const Surface& rhs);
+ Surface(const Surface& rhs);
+};
+
+} // namespace android
+
+#endif // ANDROID_GUI_SURFACE_H
diff --git a/libs/hwui/tests/scripts/skp-capture.sh b/libs/hwui/tests/scripts/skp-capture.sh
index aad31fcc8eb9..4b46fbf86818 100755
--- a/libs/hwui/tests/scripts/skp-capture.sh
+++ b/libs/hwui/tests/scripts/skp-capture.sh
@@ -29,10 +29,14 @@ fi
phase1_timeout_seconds=60
phase2_timeout_seconds=300
package="$1"
-filename="$(date '+%H%M%S').skp"
+extension="skp"
+if (( "$2" > 1 )); then # 2nd arg is number of frames
+ extension="mskp" # use different extension for multi frame files.
+fi
+filename="$(date '+%H%M%S').${extension}"
remote_path="/data/data/${package}/cache/${filename}"
local_path_prefix="$(date '+%Y-%m-%d_%H%M%S')_${package}"
-local_path="${local_path_prefix}.skp"
+local_path="${local_path_prefix}.${extension}"
enable_capture_key='debug.hwui.capture_skp_enabled'
enable_capture_value=$(adb shell "getprop '${enable_capture_key}'")
diff --git a/location/java/com/android/internal/location/ILocationProvider.aidl b/location/java/com/android/internal/location/ILocationProvider.aidl
index a5716304f0d8..8ae972bde4f9 100644
--- a/location/java/com/android/internal/location/ILocationProvider.aidl
+++ b/location/java/com/android/internal/location/ILocationProvider.aidl
@@ -29,10 +29,13 @@ import com.android.internal.location.ProviderRequest;
*/
interface ILocationProvider {
+ @UnsupportedAppUsage
oneway void setLocationProviderManager(in ILocationProviderManager manager);
+ @UnsupportedAppUsage
oneway void setRequest(in ProviderRequest request, in WorkSource ws);
+ @UnsupportedAppUsage
oneway void sendExtraCommand(String command, in Bundle extras);
// --- deprecated and will be removed the future ---
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index a7b44443fc9c..2727880685c5 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -366,8 +366,10 @@ public class BugreportProgressService extends Service {
checkProgressUpdated(mInfo, (int) progress);
}
- // TODO(b/127431371): Add error code handling for bugreport API errors.
- // Logging errors and removing progress notification for now.
+ /**
+ * Logs errors and stops the service on which this bugreport was running.
+ * Also stops progress notification (if any).
+ */
@Override
public void onError(@BugreportErrorCode int errorCode) {
trackInfoWithId();
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
index 328116dc3c1b..13fc702aa0a0 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
@@ -236,7 +236,8 @@ public class ActivityManagerWrapper {
@Override
public void onAnimationCanceled(boolean deferredWithScreenshot) {
- animationHandler.onAnimationCanceled(deferredWithScreenshot);
+ animationHandler.onAnimationCanceled(
+ deferredWithScreenshot ? new ThumbnailData() : null);
}
};
}
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationListener.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationListener.java
index 5850fda617fc..579858a4f9b4 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationListener.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationListener.java
@@ -18,6 +18,8 @@ package com.android.systemui.shared.system;
import android.graphics.Rect;
+import com.android.systemui.shared.recents.model.ThumbnailData;
+
public interface RecentsAnimationListener {
/**
@@ -29,5 +31,5 @@ public interface RecentsAnimationListener {
/**
* Called when the animation into Recents was canceled. This call is made on the binder thread.
*/
- void onAnimationCanceled(boolean deferredWithScreenshot);
+ void onAnimationCanceled(ThumbnailData thumbnailData);
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 4e7b15715243..76bed2326091 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -182,6 +182,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
public static final int BIOMETRIC_HELP_FACE_NOT_RECOGNIZED = -2;
private static final int DEFAULT_CHARGING_VOLTAGE_MICRO_VOLT = 5000000;
+ /**
+ * If no cancel signal has been received after this amount of time, set the biometric running
+ * state to stopped to allow Keyguard to retry authentication.
+ */
+ private static final int DEFAULT_CANCEL_SIGNAL_TIMEOUT = 3000;
private static final ComponentName FALLBACK_HOME_COMPONENT = new ComponentName(
"com.android.settings", "com.android.settings.FallbackHome");
@@ -264,11 +269,20 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
*/
private static final int BIOMETRIC_CONTINUE_DELAY_MS = 500;
- // If FP daemon dies, keyguard should retry after a short delay
+ // If the HAL dies or is unable to authenticate, keyguard should retry after a short delay
private int mHardwareFingerprintUnavailableRetryCount = 0;
private int mHardwareFaceUnavailableRetryCount = 0;
- private static final int HW_UNAVAILABLE_TIMEOUT = 3000; // ms
- private static final int HW_UNAVAILABLE_RETRY_MAX = 3;
+ private static final int HAL_ERROR_RETRY_TIMEOUT = 500; // ms
+ private static final int HAL_ERROR_RETRY_MAX = 10;
+
+ private final Runnable mCancelNotReceived = new Runnable() {
+ @Override
+ public void run() {
+ Log.w(TAG, "Cancel not received, transitioning to STOPPED");
+ mFingerprintRunningState = mFaceRunningState = BIOMETRIC_STATE_STOPPED;
+ updateBiometricListeningState();
+ }
+ };
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@Override
@@ -662,6 +676,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
};
private void handleFingerprintError(int msgId, String errString) {
+ if (msgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED && mHandler.hasCallbacks(
+ mCancelNotReceived)) {
+ mHandler.removeCallbacks(mCancelNotReceived);
+ }
+
if (msgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED
&& mFingerprintRunningState == BIOMETRIC_STATE_CANCELLING_RESTARTING) {
setFingerprintRunningState(BIOMETRIC_STATE_STOPPED);
@@ -671,10 +690,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
}
if (msgId == FingerprintManager.FINGERPRINT_ERROR_HW_UNAVAILABLE) {
- if (mHardwareFingerprintUnavailableRetryCount < HW_UNAVAILABLE_RETRY_MAX) {
+ if (mHardwareFingerprintUnavailableRetryCount < HAL_ERROR_RETRY_MAX) {
mHardwareFingerprintUnavailableRetryCount++;
mHandler.removeCallbacks(mRetryFingerprintAuthentication);
- mHandler.postDelayed(mRetryFingerprintAuthentication, HW_UNAVAILABLE_TIMEOUT);
+ mHandler.postDelayed(mRetryFingerprintAuthentication, HAL_ERROR_RETRY_TIMEOUT);
}
}
@@ -822,6 +841,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private void handleFaceError(int msgId, String errString) {
if (DEBUG_FACE) Log.d(TAG, "Face error received: " + errString);
+ if (msgId == FaceManager.FACE_ERROR_CANCELED && mHandler.hasCallbacks(mCancelNotReceived)) {
+ mHandler.removeCallbacks(mCancelNotReceived);
+ }
+
if (msgId == FaceManager.FACE_ERROR_CANCELED
&& mFaceRunningState == BIOMETRIC_STATE_CANCELLING_RESTARTING) {
setFaceRunningState(BIOMETRIC_STATE_STOPPED);
@@ -830,11 +853,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
setFaceRunningState(BIOMETRIC_STATE_STOPPED);
}
- if (msgId == FaceManager.FACE_ERROR_HW_UNAVAILABLE) {
- if (mHardwareFaceUnavailableRetryCount < HW_UNAVAILABLE_RETRY_MAX) {
+ if (msgId == FaceManager.FACE_ERROR_HW_UNAVAILABLE
+ || msgId == FaceManager.FACE_ERROR_UNABLE_TO_PROCESS) {
+ if (mHardwareFaceUnavailableRetryCount < HAL_ERROR_RETRY_MAX) {
mHardwareFaceUnavailableRetryCount++;
mHandler.removeCallbacks(mRetryFaceAuthentication);
- mHandler.postDelayed(mRetryFaceAuthentication, HW_UNAVAILABLE_TIMEOUT);
+ mHandler.postDelayed(mRetryFaceAuthentication, HAL_ERROR_RETRY_TIMEOUT);
}
}
@@ -1802,6 +1826,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
if (mFingerprintCancelSignal != null) {
mFingerprintCancelSignal.cancel();
mFingerprintCancelSignal = null;
+ if (!mHandler.hasCallbacks(mCancelNotReceived)) {
+ mHandler.postDelayed(mCancelNotReceived, DEFAULT_CANCEL_SIGNAL_TIMEOUT);
+ }
}
setFingerprintRunningState(BIOMETRIC_STATE_CANCELLING);
}
@@ -1816,6 +1843,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
if (mFaceCancelSignal != null) {
mFaceCancelSignal.cancel();
mFaceCancelSignal = null;
+ if (!mHandler.hasCallbacks(mCancelNotReceived)) {
+ mHandler.postDelayed(mCancelNotReceived, DEFAULT_CANCEL_SIGNAL_TIMEOUT);
+ }
}
setFaceRunningState(BIOMETRIC_STATE_CANCELLING);
}
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java
index 75956545432e..0cee030015a2 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java
@@ -74,6 +74,7 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac
private boolean mHandlesShowing = false;
private long mHandlesLastHiddenAt;
+ private long mShowAndGoEndsAt;
/**
* This should always be initialized as {@link AssistHandleBehavior#OFF} to ensure proper
* behavior lifecycle.
@@ -144,7 +145,9 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac
private void showAndGoInternal() {
maybeShowHandles(/* ignoreThreshold = */ false);
- mHandler.postDelayed(mHideHandles, getShowAndGoDuration());
+ long showAndGoDuration = getShowAndGoDuration();
+ mShowAndGoEndsAt = SystemClock.elapsedRealtime() + showAndGoDuration;
+ mHandler.postDelayed(mHideHandles, showAndGoDuration);
}
@Override // AssistHandleCallbacks
@@ -162,6 +165,10 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac
mHandler.post(() -> maybeShowHandles(/* ignoreThreshold = */ true));
}
+ public long getShowAndGoRemainingTimeMs() {
+ return Long.max(mShowAndGoEndsAt - SystemClock.elapsedRealtime(), 0);
+ }
+
boolean areHandlesShowing() {
return mHandlesShowing;
}
@@ -271,6 +278,7 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac
private void clearPendingCommands() {
mHandler.removeCallbacks(mHideHandles);
mHandler.removeCallbacks(mShowAndGo);
+ mShowAndGoEndsAt = 0;
}
@VisibleForTesting
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 97b6e7c58440..0b00b919f4f2 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -440,6 +440,10 @@ public class AssistManager implements ConfigurationChangedReceiver {
mAssistUtils.onLockscreenShown();
}
+ public long getAssistHandleShowAndGoRemainingDurationMs() {
+ return mHandleController.getShowAndGoRemainingTimeMs();
+ }
+
/** Returns the logging flags for the given Assistant invocation type. */
public int toLoggingSubType(int invocationType) {
return toLoggingSubType(invocationType, mPhoneStateMonitor.getPhoneState());
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java b/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java
index 9bca3c7382ca..c09e28426072 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java
@@ -261,6 +261,12 @@ public class DozeLog {
+ state + " blocked=" + blocked);
}
+ public static void tracePulseDropped(Context context, String why) {
+ if (!ENABLED) return;
+ init(context);
+ log("pulseDropped why=" + why);
+ }
+
public static void tracePulseTouchDisabledByProx(Context context, boolean disabled) {
if (!ENABLED) return;
init(context);
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
index 2ca85c074a89..310f04abc36c 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
@@ -113,11 +113,13 @@ public class DozeTriggers implements DozeMachine.Part {
if (!sWakeDisplaySensorState) {
Log.d(TAG, "Wake display false. Pulse denied.");
runIfNotNull(onPulseSuppressedListener);
+ DozeLog.tracePulseDropped(mContext, "wakeDisplaySensor");
return;
}
mNotificationPulseTime = SystemClock.elapsedRealtime();
if (!mConfig.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) {
runIfNotNull(onPulseSuppressedListener);
+ DozeLog.tracePulseDropped(mContext, "pulseOnNotificationsDisabled");
return;
}
requestPulse(DozeLog.PULSE_REASON_NOTIFICATION, false /* performedProxCheck */,
@@ -376,6 +378,7 @@ public class DozeTriggers implements DozeMachine.Part {
proximityCheckThenCall((result) -> {
if (result == ProximityCheck.RESULT_NEAR) {
// in pocket, abort pulse
+ DozeLog.tracePulseDropped(mContext, "inPocket");
mPulsePending = false;
runIfNotNull(onPulseSuppressedListener);
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
index d93982889655..5adee40613e6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
@@ -92,7 +92,7 @@ public class DragDownHelper implements Gefingerpoken {
mInitialTouchY = y;
mInitialTouchX = x;
mDragDownCallback.onTouchSlopExceeded();
- return true;
+ return mStartingChild != null || mDragDownCallback.isDragDownAnywhereEnabled();
}
break;
}
@@ -162,7 +162,11 @@ public class DragDownHelper implements Gefingerpoken {
if (mStartingChild == null) {
mStartingChild = findView(x, y);
if (mStartingChild != null) {
- mCallback.setUserLockedChild(mStartingChild, true);
+ if (mDragDownCallback.isDragDownEnabledForView(mStartingChild)) {
+ mCallback.setUserLockedChild(mStartingChild, true);
+ } else {
+ mStartingChild = null;
+ }
}
}
}
@@ -237,6 +241,10 @@ public class DragDownHelper implements Gefingerpoken {
return mDraggingDown;
}
+ public boolean isDragDownEnabled() {
+ return mDragDownCallback.isDragDownEnabledForView(null);
+ }
+
public interface DragDownCallback {
/**
@@ -253,5 +261,16 @@ public class DragDownHelper implements Gefingerpoken {
void onTouchSlopExceeded();
void setEmptyDragAmount(float amount);
boolean isFalsingCheckNeeded();
+
+ /**
+ * Is dragging down enabled on a given view
+ * @param view The view to check or {@code null} to check if it's enabled at all
+ */
+ boolean isDragDownEnabledForView(ExpandableView view);
+
+ /**
+ * @return if drag down is enabled anywhere, not just on selected views.
+ */
+ boolean isDragDownAnywhereEnabled();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java
index f34b912a255c..3cb2a2aaeec7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java
@@ -63,11 +63,6 @@ public interface NotificationPresenter extends ExpandableNotificationRow.OnExpan
int getMaxNotificationsWhileLocked(boolean recompute);
/**
- * True if the presenter is currently locked.
- */
- boolean isPresenterLocked();
-
- /**
* Called when the row states are updated by {@link NotificationViewHierarchyManager}.
*/
void onUpdateRowStates();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java
index 16bd884fcc58..d9328fa3affd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java
@@ -20,8 +20,12 @@ import android.content.Context;
import android.util.ArraySet;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
+import com.android.systemui.statusbar.StatusBarState;
+import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.phone.UnlockMethodCache;
+import com.android.systemui.statusbar.policy.KeyguardMonitor;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -34,22 +38,33 @@ public class DynamicPrivacyController implements UnlockMethodCache.OnUnlockMetho
private final UnlockMethodCache mUnlockMethodCache;
private final NotificationLockscreenUserManager mLockscreenUserManager;
+ private final StatusBarStateController mStateController;
+ private final KeyguardMonitor mKeyguardMonitor;
private ArraySet<Listener> mListeners = new ArraySet<>();
private boolean mLastDynamicUnlocked;
private boolean mCacheInvalid;
+ private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@Inject
DynamicPrivacyController(Context context,
- NotificationLockscreenUserManager notificationLockscreenUserManager) {
- this(notificationLockscreenUserManager, UnlockMethodCache.getInstance(context));
+ KeyguardMonitor keyguardMonitor,
+ NotificationLockscreenUserManager notificationLockscreenUserManager,
+ StatusBarStateController stateController) {
+ this(notificationLockscreenUserManager, keyguardMonitor,
+ UnlockMethodCache.getInstance(context),
+ stateController);
}
@VisibleForTesting
DynamicPrivacyController(NotificationLockscreenUserManager notificationLockscreenUserManager,
- UnlockMethodCache unlockMethodCache) {
+ KeyguardMonitor keyguardMonitor,
+ UnlockMethodCache unlockMethodCache,
+ StatusBarStateController stateController) {
mLockscreenUserManager = notificationLockscreenUserManager;
+ mStateController = stateController;
mUnlockMethodCache = unlockMethodCache;
+ mKeyguardMonitor = keyguardMonitor;
mUnlockMethodCache.addListener(this);
mLastDynamicUnlocked = isDynamicallyUnlocked();
}
@@ -77,13 +92,39 @@ public class DynamicPrivacyController implements UnlockMethodCache.OnUnlockMetho
}
public boolean isDynamicallyUnlocked() {
- return mUnlockMethodCache.canSkipBouncer() && isDynamicPrivacyEnabled();
+ return (mUnlockMethodCache.canSkipBouncer() || mKeyguardMonitor.isKeyguardGoingAway()
+ || mKeyguardMonitor.isKeyguardFadingAway())
+ && isDynamicPrivacyEnabled();
}
public void addListener(Listener listener) {
mListeners.add(listener);
}
+ /**
+ * Is the notification shade currently in a locked down mode where it's fully showing but the
+ * contents aren't revealed yet?
+ */
+ public boolean isInLockedDownShade() {
+ if (!mStatusBarKeyguardViewManager.isShowing()
+ || !mStatusBarKeyguardViewManager.isSecure()) {
+ return false;
+ }
+ int state = mStateController.getState();
+ if (state != StatusBarState.SHADE && state != StatusBarState.SHADE_LOCKED) {
+ return false;
+ }
+ if (!isDynamicPrivacyEnabled() || isDynamicallyUnlocked()) {
+ return false;
+ }
+ return true;
+ }
+
+ public void setStatusBarKeyguardViewManager(
+ StatusBarKeyguardViewManager statusBarKeyguardViewManager) {
+ mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
+ }
+
public interface Listener {
void onDynamicPrivacyChanged();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java
index 5bab0ef39326..4fc646119261 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java
@@ -23,7 +23,6 @@ import android.app.NotificationManager;
import android.content.Context;
import android.database.ContentObserver;
import android.hardware.display.AmbientDisplayConfiguration;
-import android.os.Bundle;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -32,7 +31,6 @@ import android.provider.Settings;
import android.service.dreams.DreamService;
import android.service.dreams.IDreamManager;
import android.service.notification.StatusBarNotification;
-import android.text.TextUtils;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
@@ -51,6 +49,7 @@ public class NotificationInterruptionStateProvider {
private static final String TAG = "InterruptionStateProvider";
private static final boolean DEBUG = false;
+ private static final boolean DEBUG_HEADS_UP = true;
private static final boolean ENABLE_HEADS_UP = true;
private static final String SETTING_HEADS_UP_TICKER = "ticker_gets_heads_up";
@@ -199,7 +198,7 @@ public class NotificationInterruptionStateProvider {
boolean inShade = mStatusBarStateController.getState() == SHADE;
if (entry.isBubble() && inShade) {
- if (DEBUG) {
+ if (DEBUG_HEADS_UP) {
Log.d(TAG, "No heads up: in unlocked shade where notification is shown as a "
+ "bubble: " + sbn.getKey());
}
@@ -207,7 +206,7 @@ public class NotificationInterruptionStateProvider {
}
if (!canAlertCommon(entry)) {
- if (DEBUG) {
+ if (DEBUG_HEADS_UP) {
Log.d(TAG, "No heads up: notification shouldn't alert: " + sbn.getKey());
}
return false;
@@ -218,7 +217,7 @@ public class NotificationInterruptionStateProvider {
}
if (entry.importance < NotificationManager.IMPORTANCE_HIGH) {
- if (DEBUG) {
+ if (DEBUG_HEADS_UP) {
Log.d(TAG, "No heads up: unimportant notification: " + sbn.getKey());
}
return false;
@@ -233,13 +232,16 @@ public class NotificationInterruptionStateProvider {
boolean inUse = mPowerManager.isScreenOn() && !isDreaming;
if (!inUse) {
- if (DEBUG) {
+ if (DEBUG_HEADS_UP) {
Log.d(TAG, "No heads up: not in use: " + sbn.getKey());
}
return false;
}
if (!mHeadsUpSuppressor.canHeadsUp(entry, sbn)) {
+ if (DEBUG_HEADS_UP) {
+ Log.d(TAG, "No heads up: aborted by suppressor: " + sbn.getKey());
+ }
return false;
}
@@ -257,28 +259,28 @@ public class NotificationInterruptionStateProvider {
StatusBarNotification sbn = entry.notification;
if (!mAmbientDisplayConfiguration.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) {
- if (DEBUG) {
+ if (DEBUG_HEADS_UP) {
Log.d(TAG, "No pulsing: disabled by setting: " + sbn.getKey());
}
return false;
}
if (!canAlertCommon(entry)) {
- if (DEBUG) {
+ if (DEBUG_HEADS_UP) {
Log.d(TAG, "No pulsing: notification shouldn't alert: " + sbn.getKey());
}
return false;
}
if (entry.shouldSuppressAmbient()) {
- if (DEBUG) {
+ if (DEBUG_HEADS_UP) {
Log.d(TAG, "No pulsing: ambient effect suppressed: " + sbn.getKey());
}
return false;
}
if (entry.importance < NotificationManager.IMPORTANCE_DEFAULT) {
- if (DEBUG) {
+ if (DEBUG_HEADS_UP) {
Log.d(TAG, "No pulsing: not important enough: " + sbn.getKey());
}
return false;
@@ -300,7 +302,7 @@ public class NotificationInterruptionStateProvider {
StatusBarNotification sbn = entry.notification;
if (mNotificationFilter.shouldFilterOut(entry)) {
- if (DEBUG) {
+ if (DEBUG || DEBUG_HEADS_UP) {
Log.d(TAG, "No alerting: filtered notification: " + sbn.getKey());
}
return false;
@@ -308,7 +310,7 @@ public class NotificationInterruptionStateProvider {
// Don't alert notifications that are suppressed due to group alert behavior
if (sbn.isGroup() && sbn.getNotification().suppressAlertingDueToGrouping()) {
- if (DEBUG) {
+ if (DEBUG || DEBUG_HEADS_UP) {
Log.d(TAG, "No alerting: suppressed due to group alert behavior");
}
return false;
@@ -330,28 +332,28 @@ public class NotificationInterruptionStateProvider {
StatusBarNotification sbn = entry.notification;
if (!mUseHeadsUp || mPresenter.isDeviceInVrMode()) {
- if (DEBUG) {
+ if (DEBUG_HEADS_UP) {
Log.d(TAG, "No heads up: no huns or vr mode");
}
return false;
}
if (entry.shouldSuppressPeek()) {
- if (DEBUG) {
+ if (DEBUG_HEADS_UP) {
Log.d(TAG, "No heads up: suppressed by DND: " + sbn.getKey());
}
return false;
}
if (isSnoozedPackage(sbn)) {
- if (DEBUG) {
+ if (DEBUG_HEADS_UP) {
Log.d(TAG, "No heads up: snoozed package: " + sbn.getKey());
}
return false;
}
if (entry.hasJustLaunchedFullScreenIntent()) {
- if (DEBUG) {
+ if (DEBUG_HEADS_UP) {
Log.d(TAG, "No heads up: recent fullscreen: " + sbn.getKey());
}
return false;
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 1a418665dd2e..6a611a623c69 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
@@ -179,6 +179,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
*/
private static final int DISTANCE_BETWEEN_ADJACENT_SECTIONS_PX = 1;
private final KeyguardBypassController mKeyguardBypassController;
+ private final DynamicPrivacyController mDynamicPrivacyController;
+ private final SysuiStatusBarStateController mStatusbarStateController;
private ExpandHelper mExpandHelper;
private final NotificationSwipeHelper mSwipeHelper;
@@ -605,6 +607,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
}
});
dynamicPrivacyController.addListener(this);
+ mDynamicPrivacyController = dynamicPrivacyController;
+ mStatusbarStateController = (SysuiStatusBarStateController) statusBarStateController;
}
private void updateDismissRtlSetting(boolean dismissRtl) {
@@ -695,6 +699,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
*/
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public boolean hasActiveClearableNotifications(@SelectedRows int selection) {
+ if (mDynamicPrivacyController.isInLockedDownShade()) {
+ return false;
+ }
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
@@ -5699,7 +5706,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
mAnimateBottomOnLayout = true;
}
// Let's update the footer once the notifications have been updated (in the next frame)
- post(this::updateFooter);
+ post(() -> {
+ updateFooter();
+ updateSectionBoundaries();
+ });
}
public void setOnPulseHeightChangedListener(Runnable listener) {
@@ -6355,6 +6365,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
}
return true;
+ } else if (mDynamicPrivacyController.isInLockedDownShade()) {
+ mStatusbarStateController.setLeaveOpenOnKeyguardHide(true);
+ mStatusBar.dismissKeyguardThenExecute(() -> false /* dismissAction */,
+ null /* cancelRunnable */, false /* afterKeyguardGone */);
+ return true;
} else {
// abort gesture.
return false;
@@ -6388,6 +6403,30 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
public boolean isFalsingCheckNeeded() {
return mStatusBarState == StatusBarState.KEYGUARD;
}
+
+ @Override
+ public boolean isDragDownEnabledForView(ExpandableView view) {
+ if (isDragDownAnywhereEnabled()) {
+ return true;
+ }
+ if (mDynamicPrivacyController.isInLockedDownShade()) {
+ if (view == null) {
+ // Dragging down is allowed in general
+ return true;
+ }
+ if (view instanceof ExpandableNotificationRow) {
+ // Only drag down on sensitive views, otherwise the ExpandHelper will take this
+ return ((ExpandableNotificationRow) view).getEntry().isSensitive();
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isDragDownAnywhereEnabled() {
+ return mStatusbarStateController.getState() == StatusBarState.KEYGUARD
+ && !mKeyguardBypassController.getBypassEnabled();
+ }
};
public DragDownCallback getDragDownCallback() { return mDragDownCallback; }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java
index d22ad71594b9..fce1dcc998fe 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java
@@ -14,8 +14,6 @@
package com.android.systemui.statusbar.phone;
-import static com.android.systemui.Interpolators.ALPHA_IN;
-import static com.android.systemui.Interpolators.ALPHA_OUT;
import static com.android.systemui.Interpolators.LINEAR;
import android.animation.Animator;
@@ -24,6 +22,8 @@ import android.animation.ValueAnimator;
import android.view.View;
import android.view.View.AccessibilityDelegate;
+import com.android.systemui.Dependency;
+import com.android.systemui.assist.AssistManager;
import com.android.systemui.statusbar.policy.KeyButtonDrawable;
import java.util.ArrayList;
@@ -33,12 +33,13 @@ import java.util.ArrayList;
* multiples of the same nav bar icon appearing.
*/
public class ButtonDispatcher {
- private final static int FADE_DURATION_IN = 150;
- private final static int FADE_DURATION_OUT = 1000;
+ private static final int FADE_DURATION_IN = 150;
+ private static final int FADE_DURATION_OUT = 250;
private final ArrayList<View> mViews = new ArrayList<>();
private final int mId;
+ private final AssistManager mAssistManager;
private View.OnClickListener mClickListener;
private View.OnTouchListener mTouchListener;
@@ -56,7 +57,10 @@ public class ButtonDispatcher {
private AccessibilityDelegate mAccessibilityDelegate;
private final ValueAnimator.AnimatorUpdateListener mAlphaListener = animation ->
- setAlpha((float) animation.getAnimatedValue());
+ setAlpha(
+ (float) animation.getAnimatedValue(),
+ false /* animate */,
+ false /* cancelAnimator */);
private final AnimatorListenerAdapter mFadeListener = new AnimatorListenerAdapter() {
@Override
@@ -68,6 +72,7 @@ public class ButtonDispatcher {
public ButtonDispatcher(int id) {
mId = id;
+ mAssistManager = Dependency.get(AssistManager.class);
}
void clear() {
@@ -168,16 +173,30 @@ public class ButtonDispatcher {
}
public void setAlpha(float alpha, boolean animate) {
- setAlpha(alpha, animate, (getAlpha() < alpha) ? FADE_DURATION_IN : FADE_DURATION_OUT);
+ setAlpha(alpha, animate, true /* cancelAnimator */);
}
public void setAlpha(float alpha, boolean animate, long duration) {
+ setAlpha(alpha, animate, duration, true /* cancelAnimator */);
+ }
+
+ public void setAlpha(float alpha, boolean animate, boolean cancelAnimator) {
+ setAlpha(
+ alpha,
+ animate,
+ (getAlpha() < alpha) ? FADE_DURATION_IN : FADE_DURATION_OUT,
+ cancelAnimator);
+ }
+
+ public void setAlpha(float alpha, boolean animate, long duration, boolean cancelAnimator) {
+ if (mFadeAnimator != null && (cancelAnimator || animate)) {
+ mFadeAnimator.cancel();
+ }
if (animate) {
- if (mFadeAnimator != null) {
- mFadeAnimator.cancel();
- }
setVisibility(View.VISIBLE);
mFadeAnimator = ValueAnimator.ofFloat(getAlpha(), alpha);
+ mFadeAnimator.setStartDelay(
+ mAssistManager.getAssistHandleShowAndGoRemainingDurationMs());
mFadeAnimator.setDuration(duration);
mFadeAnimator.setInterpolator(LINEAR);
mFadeAnimator.addListener(mFadeListener);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java
index c0a1b123fe77..1d4d0bd17f01 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java
@@ -103,10 +103,11 @@ public class MultiUserSwitch extends FrameLayout implements View.OnClickListener
final boolean userSwitcherEnabled = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.USER_SWITCHER_ENABLED, 0) != 0;
- if (!UserManager.supportsMultipleUsers()
- || mUserManager.hasUserRestriction(UserManager.DISALLOW_USER_SWITCH)
+ // TODO(b/138661450) Move IPC calls to background
+ if (!userSwitcherEnabled
+ || !UserManager.supportsMultipleUsers()
|| UserManager.isDeviceInDemoMode(mContext)
- || !userSwitcherEnabled) {
+ || mUserManager.hasUserRestriction(UserManager.DISALLOW_USER_SWITCH)) {
return false;
}
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 17a3a9f79338..4f9df438f08c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -193,6 +193,7 @@ import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.notification.ActivityLaunchAnimator;
import com.android.systemui.statusbar.notification.BypassHeadsUpNotifier;
+import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationActivityStarter;
import com.android.systemui.statusbar.notification.NotificationAlertingManager;
import com.android.systemui.statusbar.notification.NotificationClicker;
@@ -375,6 +376,8 @@ public class StatusBar extends SystemUI implements DemoMode,
@Inject
protected HeadsUpManagerPhone mHeadsUpManager;
@Inject
+ DynamicPrivacyController mDynamicPrivacyController;
+ @Inject
BypassHeadsUpNotifier mBypassHeadsUpNotifier;
@Nullable
@Inject
@@ -591,7 +594,7 @@ public class StatusBar extends SystemUI implements DemoMode,
private boolean mVibrateOnOpening;
private VibratorHelper mVibratorHelper;
private ActivityLaunchAnimator mActivityLaunchAnimator;
- protected NotificationPresenter mPresenter;
+ protected StatusBarNotificationPresenter mPresenter;
private NotificationActivityStarter mNotificationActivityStarter;
private boolean mPulsing;
protected BubbleController mBubbleController;
@@ -1066,7 +1069,7 @@ public class StatusBar extends SystemUI implements DemoMode,
mPresenter = new StatusBarNotificationPresenter(mContext, mNotificationPanel,
mHeadsUpManager, mStatusBarWindow, mStackScroller, mDozeScrimController,
- mScrimController, mActivityLaunchAnimator, mStatusBarKeyguardViewManager,
+ mScrimController, mActivityLaunchAnimator, mDynamicPrivacyController,
mNotificationAlertingManager, rowBinder);
mNotificationListController =
@@ -1243,6 +1246,7 @@ public class StatusBar extends SystemUI implements DemoMode,
.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mRemoteInputManager.getController().addCallback(mStatusBarKeyguardViewManager);
+ mDynamicPrivacyController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mKeyguardViewMediatorCallback = keyguardViewMediator.getViewMediatorCallback();
mLightBarController.setBiometricUnlockController(mBiometricUnlockController);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
index a87dca45bf75..a870590c08ac 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
@@ -59,6 +59,7 @@ import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.AboveShelfObserver;
import com.android.systemui.statusbar.notification.ActivityLaunchAnimator;
+import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationAlertingManager;
import com.android.systemui.statusbar.notification.NotificationEntryListener;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
@@ -117,9 +118,9 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
private final AccessibilityManager mAccessibilityManager;
private final KeyguardManager mKeyguardManager;
private final ActivityLaunchAnimator mActivityLaunchAnimator;
- private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
private final int mMaxAllowedKeyguardNotifications;
private final IStatusBarService mBarService;
+ private final DynamicPrivacyController mDynamicPrivacyController;
private boolean mReinflateNotificationsOnUserSwitched;
private boolean mDispatchUiModeChangeOnUserSwitched;
private final UnlockMethodCache mUnlockMethodCache;
@@ -136,16 +137,16 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
DozeScrimController dozeScrimController,
ScrimController scrimController,
ActivityLaunchAnimator activityLaunchAnimator,
- StatusBarKeyguardViewManager statusBarKeyguardViewManager,
+ DynamicPrivacyController dynamicPrivacyController,
NotificationAlertingManager notificationAlertingManager,
NotificationRowBinderImpl notificationRowBinder) {
mContext = context;
mNotificationPanel = panel;
mHeadsUpManager = headsUp;
+ mDynamicPrivacyController = dynamicPrivacyController;
mCommandQueue = getComponent(context, CommandQueue.class);
mAboveShelfObserver = new AboveShelfObserver(stackScroller);
mActivityLaunchAnimator = activityLaunchAnimator;
- mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
mAboveShelfObserver.setListener(statusBarWindow.findViewById(
R.id.notification_container_parent));
mAccessibilityManager = context.getSystemService(AccessibilityManager.class);
@@ -454,8 +455,15 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
@Override
public void onExpandClicked(NotificationEntry clickedEntry, boolean nowExpanded) {
mHeadsUpManager.setExpanded(clickedEntry, nowExpanded);
- if (mStatusBarStateController.getState() == StatusBarState.KEYGUARD && nowExpanded) {
- mShadeController.goToLockedShade(clickedEntry.getRow());
+ if (nowExpanded) {
+ if (mStatusBarStateController.getState() == StatusBarState.KEYGUARD) {
+ mShadeController.goToLockedShade(clickedEntry.getRow());
+ } else if (clickedEntry.isSensitive()
+ && mDynamicPrivacyController.isInLockedDownShade()) {
+ mStatusBarStateController.setLeaveOpenOnKeyguardHide(true);
+ mActivityStarter.dismissKeyguardThenExecute(() -> false /* dismissAction */
+ , null /* cancelRunnable */, false /* afterKeyguardGone */);
+ }
}
}
@@ -464,12 +472,6 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
return mVrMode;
}
- @Override
- public boolean isPresenterLocked() {
- return mStatusBarKeyguardViewManager.isShowing()
- && mStatusBarKeyguardViewManager.isSecure();
- }
-
private void onLockedNotificationImportanceChange(OnDismissAction dismissAction) {
mStatusBarStateController.setLeaveOpenOnKeyguardHide(true);
mActivityStarter.dismissKeyguardThenExecute(dismissAction, null,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index f1049f005dea..6789930ab76e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -66,6 +66,7 @@ import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.DragDownHelper;
import com.android.systemui.statusbar.StatusBarState;
+import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.phone.ScrimController.ScrimVisibility;
import com.android.systemui.tuner.TunerService;
@@ -416,9 +417,8 @@ public class StatusBarWindowView extends FrameLayout {
}
boolean intercept = false;
if (mNotificationPanel.isFullyExpanded()
- && mStatusBarStateController.getState() == StatusBarState.KEYGUARD
+ && mDragDownHelper.isDragDownEnabled()
&& !mService.isBouncerShowing()
- && !mBypassController.getBypassEnabled()
&& !mService.isDozing()) {
intercept = mDragDownHelper.onInterceptTouchEvent(ev);
}
@@ -441,9 +441,7 @@ public class StatusBarWindowView extends FrameLayout {
if (mService.isDozing()) {
handled = !mService.isPulsing();
}
- if ((mStatusBarStateController.getState() == StatusBarState.KEYGUARD && !handled
- && !mBypassController.getBypassEnabled())
- || mDragDownHelper.isDraggingDown()) {
+ if ((mDragDownHelper.isDragDownEnabled() && !handled) || mDragDownHelper.isDraggingDown()) {
// we still want to finish our drag down gesture when locking the screen
handled = mDragDownHelper.onTouchEvent(ev);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java
index 6ca5d2c7f687..d804b6f5c5ee 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java
@@ -29,9 +29,12 @@ import android.testing.TestableLooper;
import android.testing.TestableLooper.RunWithLooper;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationViewHierarchyManager;
+import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.phone.UnlockMethodCache;
+import com.android.systemui.statusbar.policy.KeyguardMonitor;
import org.junit.Assert;
import org.junit.Before;
@@ -51,12 +54,17 @@ public class DynamicPrivacyControllerTest extends SysuiTestCase {
= mock(NotificationLockscreenUserManager.class);
private DynamicPrivacyController.Listener mListener
= mock(DynamicPrivacyController.Listener.class);
+ private KeyguardMonitor mKeyguardMonitor = mock(KeyguardMonitor.class);
@Before
public void setUp() throws Exception {
when(mCache.canSkipBouncer()).thenReturn(false);
+ when(mKeyguardMonitor.isShowing()).thenReturn(true);
mDynamicPrivacyController = new DynamicPrivacyController(
- mLockScreenUserManager, mCache);
+ mLockScreenUserManager, mKeyguardMonitor, mCache,
+ mock(StatusBarStateController.class));
+ mDynamicPrivacyController.setStatusBarKeyguardViewManager(
+ mock(StatusBarKeyguardViewManager.class));
mDynamicPrivacyController.addListener(mListener);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
index c1911eef6671..9a7a27d10365 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
@@ -62,6 +62,7 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.RemoteInputController;
import com.android.systemui.statusbar.StatusBarState;
+import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.NotificationData;
@@ -105,7 +106,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
@Rule public MockitoRule mockito = MockitoJUnit.rule();
@Mock private StatusBar mBar;
- @Mock private StatusBarStateController mBarState;
+ @Mock private SysuiStatusBarStateController mBarState;
@Mock private HeadsUpManagerPhone mHeadsUpManager;
@Mock private NotificationBlockingHelperManager mBlockingHelperManager;
@Mock private NotificationGroupManager mGroupManager;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
index e811e1d955ee..186a8c7dcee1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
@@ -40,6 +40,7 @@ import com.android.internal.logging.testing.FakeMetricsLogger;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.notification.ActivityLaunchAnimator;
+import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationAlertingManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationRowBinderImpl;
@@ -75,7 +76,7 @@ public class StatusBarNotificationPresenterTest extends SysuiTestCase {
mock(NotificationPanelView.class), mock(HeadsUpManagerPhone.class),
statusBarWindowView, mock(NotificationListContainerViewGroup.class),
mock(DozeScrimController.class), mock(ScrimController.class),
- mock(ActivityLaunchAnimator.class), mock(StatusBarKeyguardViewManager.class),
+ mock(ActivityLaunchAnimator.class), mock(DynamicPrivacyController.class),
mock(NotificationAlertingManager.class),
mock(NotificationRowBinderImpl.class));
}
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 cffd57b35f04..fa235bd46d7e 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
@@ -157,7 +157,7 @@ public class StatusBarTest extends SysuiTestCase {
@Mock private RemoteInputController mRemoteInputController;
@Mock private StatusBarStateControllerImpl mStatusBarStateController;
@Mock private DeviceProvisionedController mDeviceProvisionedController;
- @Mock private NotificationPresenter mNotificationPresenter;
+ @Mock private StatusBarNotificationPresenter mNotificationPresenter;
@Mock
private NotificationEntryListener mEntryListener;
@Mock
@@ -780,7 +780,7 @@ public class StatusBarTest extends SysuiTestCase {
NotificationShelf notificationShelf,
NotificationLockscreenUserManager notificationLockscreenUserManager,
CommandQueue commandQueue,
- NotificationPresenter notificationPresenter,
+ StatusBarNotificationPresenter notificationPresenter,
BubbleController bubbleController,
NavigationBarController navBarController,
AutoHideController autoHideController,
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java
index 5111bec4913b..18b6f90f921f 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java
@@ -29,6 +29,7 @@ import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.accessibility.AccessibilityEvent;
+import com.android.server.accessibility.gestures.TouchExplorer;
import com.android.server.LocalServices;
import com.android.server.policy.WindowManagerPolicy;
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 5ba777c8aef0..b5b3cd2fe530 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -816,7 +816,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
}
- boolean onGesture(AccessibilityGestureInfo gestureInfo) {
+ public boolean onGesture(AccessibilityGestureInfo gestureInfo) {
synchronized (mLock) {
boolean handled = notifyGestureLocked(gestureInfo, false);
if (!handled) {
@@ -905,15 +905,15 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
return getInteractionBridge().performActionOnAccessibilityFocusedItemNotLocked(action);
}
- int getActiveWindowId() {
+ public int getActiveWindowId() {
return mA11yWindowManager.getActiveWindowId(mCurrentUserId);
}
- void onTouchInteractionStart() {
+ public void onTouchInteractionStart() {
mA11yWindowManager.onTouchInteractionStart();
}
- void onTouchInteractionEnd() {
+ public void onTouchInteractionEnd() {
mA11yWindowManager.onTouchInteractionEnd();
}
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityServiceConnection.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityServiceConnection.java
index 961168a46c7d..02f7821bd0d5 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityServiceConnection.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityServiceConnection.java
@@ -361,7 +361,7 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
mSystemSupport.getMotionEventInjectorForDisplayLocked(displayId);
if (motionEventInjector != null && isTouchableDisplay) {
motionEventInjector.injectEvents(
- gestureSteps.getList(), mServiceInterface, sequence);
+ gestureSteps.getList(), mServiceInterface, sequence, displayId);
} else {
try {
mServiceInterface.onPerformGestureResult(sequence, false);
diff --git a/services/accessibility/java/com/android/server/accessibility/BaseEventStreamTransformation.java b/services/accessibility/java/com/android/server/accessibility/BaseEventStreamTransformation.java
index ce54586c52ae..16457216801b 100644
--- a/services/accessibility/java/com/android/server/accessibility/BaseEventStreamTransformation.java
+++ b/services/accessibility/java/com/android/server/accessibility/BaseEventStreamTransformation.java
@@ -16,7 +16,7 @@
package com.android.server.accessibility;
-abstract class BaseEventStreamTransformation implements EventStreamTransformation {
+public abstract class BaseEventStreamTransformation implements EventStreamTransformation {
private EventStreamTransformation mNext;
@Override
diff --git a/services/accessibility/java/com/android/server/accessibility/EventStreamTransformation.java b/services/accessibility/java/com/android/server/accessibility/EventStreamTransformation.java
index 7982996e7a4a..61aff9a360ba 100644
--- a/services/accessibility/java/com/android/server/accessibility/EventStreamTransformation.java
+++ b/services/accessibility/java/com/android/server/accessibility/EventStreamTransformation.java
@@ -54,7 +54,7 @@ import android.view.accessibility.AccessibilityEvent;
* For example, if it received a down motion event followed by a cancel motion
* event, it should not handle subsequent move and up events until it gets a down.
*/
-interface EventStreamTransformation {
+public interface EventStreamTransformation {
/**
* Receives a motion event. Passed are the event transformed by previous
diff --git a/services/accessibility/java/com/android/server/accessibility/MagnificationGestureHandler.java b/services/accessibility/java/com/android/server/accessibility/MagnificationGestureHandler.java
index 1d58e90bbb38..06ca054db14a 100644
--- a/services/accessibility/java/com/android/server/accessibility/MagnificationGestureHandler.java
+++ b/services/accessibility/java/com/android/server/accessibility/MagnificationGestureHandler.java
@@ -24,7 +24,7 @@ import static android.view.MotionEvent.ACTION_POINTER_DOWN;
import static android.view.MotionEvent.ACTION_POINTER_UP;
import static android.view.MotionEvent.ACTION_UP;
-import static com.android.server.accessibility.GestureUtils.distance;
+import static com.android.server.accessibility.gestures.GestureUtils.distance;
import static java.lang.Math.abs;
import static java.util.Arrays.asList;
@@ -54,6 +54,7 @@ import android.view.ScaleGestureDetector.OnScaleGestureListener;
import android.view.ViewConfiguration;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.server.accessibility.gestures.GestureUtils;
import java.util.ArrayDeque;
import java.util.Queue;
diff --git a/services/accessibility/java/com/android/server/accessibility/MotionEventInjector.java b/services/accessibility/java/com/android/server/accessibility/MotionEventInjector.java
index 7b6a12822faa..3310cb4e3e79 100644
--- a/services/accessibility/java/com/android/server/accessibility/MotionEventInjector.java
+++ b/services/accessibility/java/com/android/server/accessibility/MotionEventInjector.java
@@ -101,11 +101,12 @@ public class MotionEventInjector extends BaseEventStreamTransformation implement
* either complete or cancelled.
*/
public void injectEvents(List<GestureStep> gestureSteps,
- IAccessibilityServiceClient serviceInterface, int sequence) {
+ IAccessibilityServiceClient serviceInterface, int sequence, int displayId) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = gestureSteps;
args.arg2 = serviceInterface;
args.argi1 = sequence;
+ args.argi2 = displayId;
mHandler.sendMessage(mHandler.obtainMessage(MESSAGE_INJECT_EVENTS, args));
}
@@ -146,7 +147,7 @@ public class MotionEventInjector extends BaseEventStreamTransformation implement
if (message.what == MESSAGE_INJECT_EVENTS) {
SomeArgs args = (SomeArgs) message.obj;
injectEventsMainThread((List<GestureStep>) args.arg1,
- (IAccessibilityServiceClient) args.arg2, args.argi1);
+ (IAccessibilityServiceClient) args.arg2, args.argi1, args.argi2);
args.recycle();
return true;
}
@@ -165,7 +166,7 @@ public class MotionEventInjector extends BaseEventStreamTransformation implement
}
private void injectEventsMainThread(List<GestureStep> gestureSteps,
- IAccessibilityServiceClient serviceInterface, int sequence) {
+ IAccessibilityServiceClient serviceInterface, int sequence, int displayId) {
if (mIsDestroyed) {
try {
serviceInterface.onPerformGestureResult(sequence, false);
@@ -209,6 +210,7 @@ public class MotionEventInjector extends BaseEventStreamTransformation implement
for (int i = 0; i < events.size(); i++) {
MotionEvent event = events.get(i);
+ event.setDisplayId(displayId);
int isEndOfSequence = (i == events.size() - 1) ? 1 : 0;
Message message = mHandler.obtainMessage(
MESSAGE_SEND_MOTION_EVENT, isEndOfSequence, 0, event);
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityGestureDetector.java b/services/accessibility/java/com/android/server/accessibility/gestures/AccessibilityGestureDetector.java
index b4ac92f0cf55..9101a01bc8fe 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityGestureDetector.java
+++ b/services/accessibility/java/com/android/server/accessibility/gestures/AccessibilityGestureDetector.java
@@ -14,7 +14,7 @@
** limitations under the License.
*/
-package com.android.server.accessibility;
+package com.android.server.accessibility.gestures;
import android.accessibilityservice.AccessibilityGestureInfo;
import android.accessibilityservice.AccessibilityService;
diff --git a/services/accessibility/java/com/android/server/accessibility/GestureUtils.java b/services/accessibility/java/com/android/server/accessibility/gestures/GestureUtils.java
index d5b53bc686da..0f5dd08e02b4 100644
--- a/services/accessibility/java/com/android/server/accessibility/GestureUtils.java
+++ b/services/accessibility/java/com/android/server/accessibility/gestures/GestureUtils.java
@@ -1,4 +1,4 @@
-package com.android.server.accessibility;
+package com.android.server.accessibility.gestures;
import android.util.MathUtils;
import android.view.MotionEvent;
@@ -6,7 +6,7 @@ import android.view.MotionEvent;
/**
* Some helper functions for gesture detection.
*/
-final class GestureUtils {
+public final class GestureUtils {
private GestureUtils() {
/* cannot be instantiated */
diff --git a/services/accessibility/java/com/android/server/accessibility/TouchExplorer.java b/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java
index 380e853820ff..10c32ee87c13 100644
--- a/services/accessibility/java/com/android/server/accessibility/TouchExplorer.java
+++ b/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java
@@ -14,11 +14,11 @@
** limitations under the License.
*/
-package com.android.server.accessibility;
+package com.android.server.accessibility.gestures;
import static android.view.MotionEvent.INVALID_POINTER_ID;
-import static com.android.server.accessibility.TouchState.ALL_POINTER_ID_BITS;
+import static com.android.server.accessibility.gestures.TouchState.ALL_POINTER_ID_BITS;
import android.accessibilityservice.AccessibilityGestureInfo;
import android.content.Context;
@@ -34,6 +34,8 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
+import com.android.server.accessibility.AccessibilityManagerService;
+import com.android.server.accessibility.BaseEventStreamTransformation;
import com.android.server.policy.WindowManagerPolicy;
import java.util.ArrayList;
@@ -58,7 +60,7 @@ import java.util.List;
*
* @hide
*/
-class TouchExplorer extends BaseEventStreamTransformation
+public class TouchExplorer extends BaseEventStreamTransformation
implements AccessibilityGestureDetector.Listener {
private static final boolean DEBUG = false;
diff --git a/services/accessibility/java/com/android/server/accessibility/TouchState.java b/services/accessibility/java/com/android/server/accessibility/gestures/TouchState.java
index 7569b05abaac..820c1a794635 100644
--- a/services/accessibility/java/com/android/server/accessibility/TouchState.java
+++ b/services/accessibility/java/com/android/server/accessibility/gestures/TouchState.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server.accessibility;
+package com.android.server.accessibility.gestures;
import static android.view.MotionEvent.INVALID_POINTER_ID;
diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
index cb6cf74d4f52..6010b1dc88c4 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
@@ -15,9 +15,6 @@
*/
package com.android.server.audio;
-import static com.android.server.audio.AudioService.CONNECTION_STATE_CONNECTED;
-import static com.android.server.audio.AudioService.CONNECTION_STATE_DISCONNECTED;
-
import android.annotation.NonNull;
import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothDevice;
@@ -95,13 +92,28 @@ import java.io.PrintWriter;
/*package*/ AudioDeviceBroker(@NonNull Context context, @NonNull AudioService service) {
mContext = context;
mAudioService = service;
- setupMessaging(context);
mBtHelper = new BtHelper(this);
mDeviceInventory = new AudioDeviceInventory(this);
+ init();
+ }
+
+ /** for test purposes only, inject AudioDeviceInventory */
+ AudioDeviceBroker(@NonNull Context context, @NonNull AudioService service,
+ @NonNull AudioDeviceInventory mockDeviceInventory) {
+ mContext = context;
+ mAudioService = service;
+ mBtHelper = new BtHelper(this);
+ mDeviceInventory = mockDeviceInventory;
+
+ init();
+ }
+
+ private void init() {
+ setupMessaging(mContext);
+
mForcedUseForComm = AudioSystem.FORCE_NONE;
mForcedUseForCommExt = mForcedUseForComm;
-
}
/*package*/ Context getContext() {
@@ -232,17 +244,42 @@ import java.io.PrintWriter;
mSupprNoisy = suppressNoisyIntent;
mVolume = vol;
}
+
+ // redefine equality op so we can match messages intended for this device
+ @Override
+ public boolean equals(Object o) {
+ return mDevice.equals(o);
+ }
}
+
/*package*/ void postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
@NonNull BluetoothDevice device, @AudioService.BtProfileConnectionState int state,
int profile, boolean suppressNoisyIntent, int a2dpVolume) {
final BtDeviceConnectionInfo info = new BtDeviceConnectionInfo(device, state, profile,
suppressNoisyIntent, a2dpVolume);
- // TODO add a check to try to remove unprocessed messages for the same device (the old
- // check didn't work), and make sure it doesn't conflict with config change message
- sendLMsgNoDelay(MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT, SENDMSG_QUEUE, info);
+ // when receiving a request to change the connection state of a device, this last request
+ // is the source of truth, so cancel all previous requests
+ removeAllA2dpConnectionEvents(device);
+
+ sendLMsgNoDelay(
+ state == BluetoothProfile.STATE_CONNECTED
+ ? MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_CONNECTION
+ : MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_DISCONNECTION,
+ SENDMSG_QUEUE, info);
+ }
+
+ /** remove all previously scheduled connection and disconnection events for the given device */
+ private void removeAllA2dpConnectionEvents(@NonNull BluetoothDevice device) {
+ mBrokerHandler.removeMessages(MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_DISCONNECTION,
+ device);
+ mBrokerHandler.removeMessages(MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_CONNECTION,
+ device);
+ mBrokerHandler.removeMessages(MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_CONNECTED,
+ device);
+ mBrokerHandler.removeMessages(MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_DISCONNECTED,
+ device);
}
private static final class HearingAidDeviceConnectionInfo {
@@ -430,13 +467,16 @@ import java.io.PrintWriter;
sendMsgNoDelay(MSG_BROADCAST_AUDIO_BECOMING_NOISY, SENDMSG_REPLACE);
}
- /*package*/ void postA2dpSinkConnection(int state,
+ /*package*/ void postA2dpSinkConnection(@AudioService.BtProfileConnectionState int state,
@NonNull BtHelper.BluetoothA2dpDeviceInfo btDeviceInfo, int delay) {
- sendILMsg(MSG_IL_SET_A2DP_SINK_CONNECTION_STATE, SENDMSG_QUEUE,
+ sendILMsg(state == BluetoothA2dp.STATE_CONNECTED
+ ? MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_CONNECTED
+ : MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_DISCONNECTED,
+ SENDMSG_QUEUE,
state, btDeviceInfo, delay);
}
- /*package*/ void postA2dpSourceConnection(int state,
+ /*package*/ void postA2dpSourceConnection(@AudioService.BtProfileConnectionState int state,
@NonNull BtHelper.BluetoothA2dpDeviceInfo btDeviceInfo, int delay) {
sendILMsg(MSG_IL_SET_A2DP_SOURCE_CONNECTION_STATE, SENDMSG_QUEUE,
state, btDeviceInfo, delay);
@@ -522,25 +562,6 @@ import java.io.PrintWriter;
}
}
- @GuardedBy("mDeviceStateLock")
- /*package*/ void handleSetA2dpSinkConnectionState(@BluetoothProfile.BtProfileState int state,
- @NonNull BtHelper.BluetoothA2dpDeviceInfo btDeviceInfo) {
- final int intState = (state == BluetoothA2dp.STATE_CONNECTED)
- ? CONNECTION_STATE_CONNECTED : CONNECTION_STATE_DISCONNECTED;
- final int delay = mDeviceInventory.checkSendBecomingNoisyIntent(
- AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, intState,
- AudioSystem.DEVICE_NONE);
- final String addr = btDeviceInfo == null ? "null" : btDeviceInfo.getBtDevice().getAddress();
-
- if (AudioService.DEBUG_DEVICES) {
- Log.d(TAG, "handleSetA2dpSinkConnectionState btDevice= " + btDeviceInfo
- + " state= " + state
- + " is dock: " + btDeviceInfo.getBtDevice().isBluetoothDock());
- }
- sendILMsg(MSG_IL_SET_A2DP_SINK_CONNECTION_STATE, SENDMSG_QUEUE,
- state, btDeviceInfo, delay);
- }
-
/*package*/ void postSetA2dpSourceConnectionState(@BluetoothProfile.BtProfileState int state,
@NonNull BtHelper.BluetoothA2dpDeviceInfo btDeviceInfo) {
final int intState = (state == BluetoothA2dp.STATE_CONNECTED) ? 1 : 0;
@@ -575,8 +596,10 @@ import java.io.PrintWriter;
// must be called synchronized on mConnectedDevices
/*package*/ boolean hasScheduledA2dpSinkConnectionState(BluetoothDevice btDevice) {
- return mBrokerHandler.hasMessages(MSG_IL_SET_A2DP_SINK_CONNECTION_STATE,
- new BtHelper.BluetoothA2dpDeviceInfo(btDevice));
+ return (mBrokerHandler.hasMessages(MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_CONNECTED,
+ new BtHelper.BluetoothA2dpDeviceInfo(btDevice))
+ || mBrokerHandler.hasMessages(MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_DISCONNECTED,
+ new BtHelper.BluetoothA2dpDeviceInfo(btDevice)));
}
/*package*/ void setA2dpDockTimeout(String address, int a2dpCodec, int delayMs) {
@@ -711,7 +734,8 @@ import java.io.PrintWriter;
mDeviceInventory.onReportNewRoutes();
}
break;
- case MSG_IL_SET_A2DP_SINK_CONNECTION_STATE:
+ case MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_CONNECTED:
+ case MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_DISCONNECTED:
synchronized (mDeviceStateLock) {
mDeviceInventory.onSetA2dpSinkConnectionState(
(BtHelper.BluetoothA2dpDeviceInfo) msg.obj, msg.arg1);
@@ -836,7 +860,8 @@ import java.io.PrintWriter;
}
}
break;
- case MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT: {
+ case MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_CONNECTION:
+ case MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_DISCONNECTION: {
final BtDeviceConnectionInfo info = (BtDeviceConnectionInfo) msg.obj;
AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
"setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent "
@@ -887,7 +912,7 @@ import java.io.PrintWriter;
private static final int MSG_I_BROADCAST_BT_CONNECTION_STATE = 3;
private static final int MSG_IIL_SET_FORCE_USE = 4;
private static final int MSG_IIL_SET_FORCE_BT_A2DP_USE = 5;
- private static final int MSG_IL_SET_A2DP_SINK_CONNECTION_STATE = 6;
+ private static final int MSG_TOGGLE_HDMI = 6;
private static final int MSG_IL_SET_A2DP_SOURCE_CONNECTION_STATE = 7;
private static final int MSG_IL_SET_HEARING_AID_CONNECTION_STATE = 8;
private static final int MSG_BT_HEADSET_CNCT_FAILED = 9;
@@ -898,7 +923,6 @@ import java.io.PrintWriter;
private static final int MSG_II_SET_HEARING_AID_VOLUME = 14;
private static final int MSG_I_SET_AVRCP_ABSOLUTE_VOLUME = 15;
private static final int MSG_I_DISCONNECT_BT_SCO = 16;
- private static final int MSG_TOGGLE_HDMI = 17;
private static final int MSG_L_A2DP_ACTIVE_DEVICE_CHANGE = 18;
private static final int MSG_DISCONNECT_A2DP = 19;
private static final int MSG_DISCONNECT_A2DP_SINK = 20;
@@ -908,25 +932,30 @@ import java.io.PrintWriter;
private static final int MSG_L_BT_SERVICE_CONNECTED_PROFILE_A2DP_SINK = 24;
private static final int MSG_L_BT_SERVICE_CONNECTED_PROFILE_HEARING_AID = 25;
private static final int MSG_L_BT_SERVICE_CONNECTED_PROFILE_HEADSET = 26;
+ private static final int MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_CONNECTED = 27;
+ private static final int MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_DISCONNECTED = 28;
// process external command to (dis)connect an A2DP device
- private static final int MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT = 27;
+ private static final int MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_CONNECTION = 29;
+ private static final int MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_DISCONNECTION = 30;
// process external command to (dis)connect a hearing aid device
- private static final int MSG_L_HEARING_AID_DEVICE_CONNECTION_CHANGE_EXT = 28;
+ private static final int MSG_L_HEARING_AID_DEVICE_CONNECTION_CHANGE_EXT = 31;
// a ScoClient died in BtHelper
- private static final int MSG_L_SCOCLIENT_DIED = 29;
+ private static final int MSG_L_SCOCLIENT_DIED = 32;
private static boolean isMessageHandledUnderWakelock(int msgId) {
switch(msgId) {
case MSG_L_SET_WIRED_DEVICE_CONNECTION_STATE:
- case MSG_IL_SET_A2DP_SINK_CONNECTION_STATE:
+ case MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_CONNECTED:
+ case MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_DISCONNECTED:
case MSG_IL_SET_A2DP_SOURCE_CONNECTION_STATE:
case MSG_IL_SET_HEARING_AID_CONNECTION_STATE:
case MSG_IL_BTA2DP_DOCK_TIMEOUT:
case MSG_L_A2DP_DEVICE_CONFIG_CHANGE:
case MSG_TOGGLE_HDMI:
case MSG_L_A2DP_ACTIVE_DEVICE_CHANGE:
- case MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT:
+ case MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_CONNECTION:
+ case MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_DISCONNECTION:
case MSG_L_HEARING_AID_DEVICE_CONNECTION_CHANGE_EXT:
return true;
default:
@@ -1007,7 +1036,8 @@ import java.io.PrintWriter;
switch (msg) {
case MSG_IL_SET_A2DP_SOURCE_CONNECTION_STATE:
- case MSG_IL_SET_A2DP_SINK_CONNECTION_STATE:
+ case MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_CONNECTED:
+ case MSG_IL_SET_A2DP_SINK_CONNECTION_STATE_DISCONNECTED:
case MSG_IL_SET_HEARING_AID_CONNECTION_STATE:
case MSG_L_SET_WIRED_DEVICE_CONNECTION_STATE:
case MSG_IL_BTA2DP_DOCK_TIMEOUT:
diff --git a/services/core/java/com/android/server/audio/AudioDeviceInventory.java b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
index a9a8ef2f7e12..90973a888a9d 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceInventory.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
@@ -41,14 +41,16 @@ import android.util.Log;
import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.annotations.VisibleForTesting;
import java.util.ArrayList;
/**
* Class to manage the inventory of all connected devices.
* This class is thread-safe.
+ * (non final for mocking/spying)
*/
-public final class AudioDeviceInventory {
+public class AudioDeviceInventory {
private static final String TAG = "AS.AudioDeviceInventory";
@@ -56,11 +58,7 @@ public final class AudioDeviceInventory {
// Key for map created from DeviceInfo.makeDeviceListKey()
private final ArrayMap<String, DeviceInfo> mConnectedDevices = new ArrayMap<>();
- private final @NonNull AudioDeviceBroker mDeviceBroker;
-
- AudioDeviceInventory(@NonNull AudioDeviceBroker broker) {
- mDeviceBroker = broker;
- }
+ private @NonNull AudioDeviceBroker mDeviceBroker;
// cache of the address of the last dock the device was connected to
private String mDockAddress;
@@ -70,6 +68,20 @@ public final class AudioDeviceInventory {
final RemoteCallbackList<IAudioRoutesObserver> mRoutesObservers =
new RemoteCallbackList<IAudioRoutesObserver>();
+ /*package*/ AudioDeviceInventory(@NonNull AudioDeviceBroker broker) {
+ mDeviceBroker = broker;
+ }
+
+ //-----------------------------------------------------------
+ /** for mocking only */
+ /*package*/ AudioDeviceInventory() {
+ mDeviceBroker = null;
+ }
+
+ /*package*/ void setDeviceBroker(@NonNull AudioDeviceBroker broker) {
+ mDeviceBroker = broker;
+ }
+
//------------------------------------------------------------
/**
* Class to store info about connected devices.
@@ -146,8 +158,10 @@ public final class AudioDeviceInventory {
}
}
+ // only public for mocking/spying
@GuardedBy("AudioDeviceBroker.mDeviceStateLock")
- /*package*/ void onSetA2dpSinkConnectionState(@NonNull BtHelper.BluetoothA2dpDeviceInfo btInfo,
+ @VisibleForTesting
+ public void onSetA2dpSinkConnectionState(@NonNull BtHelper.BluetoothA2dpDeviceInfo btInfo,
@AudioService.BtProfileConnectionState int state) {
final BluetoothDevice btDevice = btInfo.getBtDevice();
int a2dpVolume = btInfo.getVolume();
@@ -159,30 +173,40 @@ public final class AudioDeviceInventory {
if (!BluetoothAdapter.checkBluetoothAddress(address)) {
address = "";
}
+
+ final int a2dpCodec = btInfo.getCodec();
+
AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(
"A2DP sink connected: device addr=" + address + " state=" + state
+ + " codec=" + a2dpCodec
+ " vol=" + a2dpVolume));
- final int a2dpCodec = btInfo.getCodec();
-
synchronized (mConnectedDevices) {
final String key = DeviceInfo.makeDeviceListKey(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
btDevice.getAddress());
final DeviceInfo di = mConnectedDevices.get(key);
boolean isConnected = di != null;
- if (isConnected && state != BluetoothProfile.STATE_CONNECTED) {
- if (btDevice.isBluetoothDock()) {
- if (state == BluetoothProfile.STATE_DISCONNECTED) {
- // introduction of a delay for transient disconnections of docks when
- // power is rapidly turned off/on, this message will be canceled if
- // we reconnect the dock under a preset delay
- makeA2dpDeviceUnavailableLater(address,
- AudioDeviceBroker.BTA2DP_DOCK_TIMEOUT_MS);
- // the next time isConnected is evaluated, it will be false for the dock
+ if (isConnected) {
+ if (state == BluetoothProfile.STATE_CONNECTED) {
+ // device is already connected, but we are receiving a connection again,
+ // it could be for a codec change
+ if (a2dpCodec != di.mDeviceCodecFormat) {
+ mDeviceBroker.postBluetoothA2dpDeviceConfigChange(btDevice);
}
} else {
- makeA2dpDeviceUnavailableNow(address, di.mDeviceCodecFormat);
+ if (btDevice.isBluetoothDock()) {
+ if (state == BluetoothProfile.STATE_DISCONNECTED) {
+ // introduction of a delay for transient disconnections of docks when
+ // power is rapidly turned off/on, this message will be canceled if
+ // we reconnect the dock under a preset delay
+ makeA2dpDeviceUnavailableLater(address,
+ AudioDeviceBroker.BTA2DP_DOCK_TIMEOUT_MS);
+ // the next time isConnected is evaluated, it will be false for the dock
+ }
+ } else {
+ makeA2dpDeviceUnavailableNow(address, di.mDeviceCodecFormat);
+ }
}
} else if (!isConnected && state == BluetoothProfile.STATE_CONNECTED) {
if (btDevice.isBluetoothDock()) {
@@ -282,11 +306,9 @@ public final class AudioDeviceInventory {
+ " event=" + BtHelper.a2dpDeviceEventToString(event)));
synchronized (mConnectedDevices) {
- //TODO original CL is not consistent between BluetoothDevice and BluetoothA2dpDeviceInfo
- // for this type of message
if (mDeviceBroker.hasScheduledA2dpSinkConnectionState(btDevice)) {
AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(
- "A2dp config change ignored"));
+ "A2dp config change ignored (scheduled connection change)"));
return;
}
final String key = DeviceInfo.makeDeviceListKey(
@@ -534,8 +556,10 @@ public final class AudioDeviceInventory {
return mCurAudioRoutes;
}
+ // only public for mocking/spying
@GuardedBy("AudioDeviceBroker.mDeviceStateLock")
- /*package*/ void setBluetoothA2dpDeviceConnectionState(
+ @VisibleForTesting
+ public void setBluetoothA2dpDeviceConnectionState(
@NonNull BluetoothDevice device, @AudioService.BtProfileConnectionState int state,
int profile, boolean suppressNoisyIntent, int musicDevice, int a2dpVolume) {
int delay;
@@ -544,9 +568,12 @@ public final class AudioDeviceInventory {
}
synchronized (mConnectedDevices) {
if (profile == BluetoothProfile.A2DP && !suppressNoisyIntent) {
- int intState = (state == BluetoothA2dp.STATE_CONNECTED) ? 1 : 0;
+ @AudioService.ConnectionState int asState =
+ (state == BluetoothA2dp.STATE_CONNECTED)
+ ? AudioService.CONNECTION_STATE_CONNECTED
+ : AudioService.CONNECTION_STATE_DISCONNECTED;
delay = checkSendBecomingNoisyIntentInt(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
- intState, musicDevice);
+ asState, musicDevice);
} else {
delay = 0;
}
@@ -785,7 +812,7 @@ public final class AudioDeviceInventory {
return 0;
}
mDeviceBroker.postBroadcastBecomingNoisy();
- delay = 1000;
+ delay = AudioService.BECOMING_NOISY_DELAY_MS;
}
return delay;
@@ -943,4 +970,21 @@ public final class AudioDeviceInventory {
intent.putExtra(AudioManager.EXTRA_MAX_CHANNEL_COUNT, maxChannels);
}
}
+
+ //----------------------------------------------------------
+ // For tests only
+
+ /**
+ * Check if device is in the list of connected devices
+ * @param device
+ * @return true if connected
+ */
+ @VisibleForTesting
+ public boolean isA2dpDeviceConnected(@NonNull BluetoothDevice device) {
+ final String key = DeviceInfo.makeDeviceListKey(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
+ device.getAddress());
+ synchronized (mConnectedDevices) {
+ return (mConnectedDevices.get(key) != null);
+ }
+ }
}
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 7458bee793db..5bc2261878b6 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -128,6 +128,7 @@ import android.view.accessibility.AccessibilityManager;
import android.widget.Toast;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.Preconditions;
import com.android.server.EventLogTags;
@@ -190,6 +191,13 @@ public class AudioService extends IAudioService.Stub
private static final int UNMUTE_STREAM_DELAY = 350;
/**
+ * Delay before disconnecting a device that would cause BECOMING_NOISY intent to be sent,
+ * to give a chance to applications to pause.
+ */
+ @VisibleForTesting
+ public static final int BECOMING_NOISY_DELAY_MS = 1000;
+
+ /**
* Only used in the result from {@link #checkForRingerModeChange(int, int, int)}
*/
private static final int FLAG_ADJUST_VOLUME = 1;
@@ -3950,7 +3958,9 @@ public class AudioService extends IAudioService.Stub
|| adjust == AudioManager.ADJUST_TOGGLE_MUTE;
}
- /*package*/ boolean isInCommunication() {
+ /** only public for mocking/spying, do not call outside of AudioService */
+ @VisibleForTesting
+ public boolean isInCommunication() {
boolean IsInCall = false;
TelecomManager telecomManager =
@@ -4119,7 +4129,9 @@ public class AudioService extends IAudioService.Stub
return false;
}
- /*package*/ int getDeviceForStream(int stream) {
+ /** only public for mocking/spying, do not call outside of AudioService */
+ @VisibleForTesting
+ public int getDeviceForStream(int stream) {
int device = getDevicesForStream(stream);
if ((device & (device - 1)) != 0) {
// Multiple device selection is either:
@@ -4164,7 +4176,9 @@ public class AudioService extends IAudioService.Stub
}
}
- /*package*/ void postObserveDevicesForAllStreams() {
+ /** only public for mocking/spying, do not call outside of AudioService */
+ @VisibleForTesting
+ public void postObserveDevicesForAllStreams() {
sendMsg(mAudioHandler,
MSG_OBSERVE_DEVICES_FOR_ALL_STREAMS,
SENDMSG_QUEUE, 0 /*arg1*/, 0 /*arg2*/, null /*obj*/,
@@ -4275,7 +4289,9 @@ public class AudioService extends IAudioService.Stub
AudioSystem.DEVICE_OUT_ALL_USB |
AudioSystem.DEVICE_OUT_HDMI;
- /*package*/ void postAccessoryPlugMediaUnmute(int newDevice) {
+ /** only public for mocking/spying, do not call outside of AudioService */
+ @VisibleForTesting
+ public void postAccessoryPlugMediaUnmute(int newDevice) {
sendMsg(mAudioHandler, MSG_ACCESSORY_PLUG_MEDIA_UNMUTE, SENDMSG_QUEUE,
newDevice, 0, null, 0);
}
@@ -4825,7 +4841,9 @@ public class AudioService extends IAudioService.Stub
}
}
- /*package*/ void postSetVolumeIndexOnDevice(int streamType, int vssVolIndex, int device,
+ /** only public for mocking/spying, do not call outside of AudioService */
+ @VisibleForTesting
+ public void postSetVolumeIndexOnDevice(int streamType, int vssVolIndex, int device,
String caller) {
sendMsg(mAudioHandler,
MSG_SET_DEVICE_STREAM_VOLUME,
@@ -5183,7 +5201,9 @@ public class AudioService extends IAudioService.Stub
* @return true if there is currently a registered dynamic mixing policy that affects media
* and is not a render + loopback policy
*/
- /*package*/ boolean hasMediaDynamicPolicy() {
+ // only public for mocking/spying
+ @VisibleForTesting
+ public boolean hasMediaDynamicPolicy() {
synchronized (mAudioPolicies) {
if (mAudioPolicies.isEmpty()) {
return false;
@@ -5516,7 +5536,9 @@ public class AudioService extends IAudioService.Stub
return mMediaFocusControl.getFocusRampTimeMs(focusGain, attr);
}
- /*package*/ boolean hasAudioFocusUsers() {
+ /** only public for mocking/spying, do not call outside of AudioService */
+ @VisibleForTesting
+ public boolean hasAudioFocusUsers() {
return mMediaFocusControl.hasAudioFocusUsers();
}
diff --git a/services/core/java/com/android/server/audio/BtHelper.java b/services/core/java/com/android/server/audio/BtHelper.java
index 1a63f8f51ee3..9f1a6bd15ac3 100644
--- a/services/core/java/com/android/server/audio/BtHelper.java
+++ b/services/core/java/com/android/server/audio/BtHelper.java
@@ -139,6 +139,12 @@ public class BtHelper {
public int getCodec() {
return mCodec;
}
+
+ // redefine equality op so we can match messages intended for this device
+ @Override
+ public boolean equals(Object o) {
+ return mBtDevice.equals(o);
+ }
}
// A2DP device events
@@ -441,9 +447,9 @@ public class BtHelper {
return;
}
final BluetoothDevice btDevice = deviceList.get(0);
- final @BluetoothProfile.BtProfileState int state = mA2dp.getConnectionState(btDevice);
- mDeviceBroker.handleSetA2dpSinkConnectionState(
- state, new BluetoothA2dpDeviceInfo(btDevice));
+ // the device is guaranteed CONNECTED
+ mDeviceBroker.postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(btDevice,
+ BluetoothA2dp.STATE_CONNECTED, BluetoothProfile.A2DP_SINK, true, -1);
}
/*package*/ synchronized void onA2dpSinkProfileConnected(BluetoothProfile profile) {
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java
index 4957eed21c70..73d160d8c444 100644
--- a/services/core/java/com/android/server/connectivity/Tethering.java
+++ b/services/core/java/com/android/server/connectivity/Tethering.java
@@ -772,7 +772,6 @@ public class Tethering extends BaseNetworkObserver {
case WifiManager.WIFI_AP_STATE_FAILED:
default:
disableWifiIpServingLocked(ifname, curState);
- mEntitlementMgr.stopProvisioningIfNeeded(TETHERING_WIFI);
break;
}
}
diff --git a/services/core/java/com/android/server/pm/BackgroundDexOptService.java b/services/core/java/com/android/server/pm/BackgroundDexOptService.java
index 984f22f01465..c7124314cae0 100644
--- a/services/core/java/com/android/server/pm/BackgroundDexOptService.java
+++ b/services/core/java/com/android/server/pm/BackgroundDexOptService.java
@@ -281,20 +281,7 @@ public class BackgroundDexOptService extends JobService {
mAbortIdleOptimization.set(false);
long lowStorageThreshold = getLowStorageThreshold(context);
- // Optimize primary apks.
- int result = optimizePackages(pm, pkgs, lowStorageThreshold,
- /*isForPrimaryDex=*/ true);
- if (result == OPTIMIZE_ABORT_BY_JOB_SCHEDULER) {
- return result;
- }
- if (supportSecondaryDex()) {
- result = reconcileSecondaryDexFiles(pm.getDexManager());
- if (result == OPTIMIZE_ABORT_BY_JOB_SCHEDULER) {
- return result;
- }
- result = optimizePackages(pm, pkgs, lowStorageThreshold,
- /*isForPrimaryDex=*/ false);
- }
+ int result = idleOptimizePackages(pm, pkgs, lowStorageThreshold);
return result;
}
@@ -342,11 +329,20 @@ public class BackgroundDexOptService extends JobService {
return 0;
}
- private int optimizePackages(PackageManagerService pm, ArraySet<String> pkgs,
- long lowStorageThreshold, boolean isForPrimaryDex) {
+ private int idleOptimizePackages(PackageManagerService pm, ArraySet<String> pkgs,
+ long lowStorageThreshold) {
ArraySet<String> updatedPackages = new ArraySet<>();
try {
+ final boolean supportSecondaryDex = supportSecondaryDex();
+
+ if (supportSecondaryDex) {
+ int result = reconcileSecondaryDexFiles(pm.getDexManager());
+ if (result == OPTIMIZE_ABORT_BY_JOB_SCHEDULER) {
+ return result;
+ }
+ }
+
// Only downgrade apps when space is low on device.
// Threshold is selected above the lowStorageThreshold so that we can pro-actively clean
// up disk before user hits the actual lowStorageThreshold.
@@ -359,43 +355,61 @@ public class BackgroundDexOptService extends JobService {
pm.getUnusedPackages(mDowngradeUnusedAppsThresholdInMillis);
Log.d(TAG, "Unsused Packages " + String.join(",", unusedPackages));
- for (String pkg : unusedPackages) {
- int abortCode = abortIdleOptimizations(/*lowStorageThreshold*/ -1);
- if (abortCode != OPTIMIZE_CONTINUE) {
- // Should be aborted by the scheduler.
- return abortCode;
- }
- if (downgradePackage(pm, pkg, isForPrimaryDex)) {
- updatedPackages.add(pkg);
+ if (!unusedPackages.isEmpty()) {
+ for (String pkg : unusedPackages) {
+ int abortCode = abortIdleOptimizations(/*lowStorageThreshold*/ -1);
+ if (abortCode != OPTIMIZE_CONTINUE) {
+ // Should be aborted by the scheduler.
+ return abortCode;
+ }
+ if (downgradePackage(pm, pkg, /*isForPrimaryDex*/ true)) {
+ updatedPackages.add(pkg);
+ }
+ if (supportSecondaryDex) {
+ downgradePackage(pm, pkg, /*isForPrimaryDex*/ false);
+ }
}
- }
- if (!unusedPackages.isEmpty()) {
pkgs = new ArraySet<>(pkgs);
pkgs.removeAll(unusedPackages);
}
}
- for (String pkg : pkgs) {
- int abortCode = abortIdleOptimizations(lowStorageThreshold);
- if (abortCode != OPTIMIZE_CONTINUE) {
- // Either aborted by the scheduler or no space left.
- return abortCode;
- }
+ int primaryResult = optimizePackages(pm, pkgs, lowStorageThreshold,
+ /*isForPrimaryDex*/ true, updatedPackages);
+ if (primaryResult != OPTIMIZE_PROCESSED) {
+ return primaryResult;
+ }
- boolean dexOptPerformed = optimizePackage(pm, pkg, isForPrimaryDex);
- if (dexOptPerformed) {
- updatedPackages.add(pkg);
- }
+ if (!supportSecondaryDex) {
+ return OPTIMIZE_PROCESSED;
}
- return OPTIMIZE_PROCESSED;
+ int secondaryResult = optimizePackages(pm, pkgs, lowStorageThreshold,
+ /*isForPrimaryDex*/ false, updatedPackages);
+ return secondaryResult;
} finally {
// Always let the pinner service know about changes.
notifyPinService(updatedPackages);
}
}
+ private int optimizePackages(PackageManagerService pm, ArraySet<String> pkgs,
+ long lowStorageThreshold, boolean isForPrimaryDex, ArraySet<String> updatedPackages) {
+ for (String pkg : pkgs) {
+ int abortCode = abortIdleOptimizations(lowStorageThreshold);
+ if (abortCode != OPTIMIZE_CONTINUE) {
+ // Either aborted by the scheduler or no space left.
+ return abortCode;
+ }
+
+ boolean dexOptPerformed = optimizePackage(pm, pkg, isForPrimaryDex);
+ if (dexOptPerformed) {
+ updatedPackages.add(pkg);
+ }
+ }
+ return OPTIMIZE_PROCESSED;
+ }
/**
* Try to downgrade the package to a smaller compilation filter.
diff --git a/services/core/java/com/android/server/pm/ProtectedPackages.java b/services/core/java/com/android/server/pm/ProtectedPackages.java
index a374e1484b28..231168e9c660 100644
--- a/services/core/java/com/android/server/pm/ProtectedPackages.java
+++ b/services/core/java/com/android/server/pm/ProtectedPackages.java
@@ -92,6 +92,9 @@ public class ProtectedPackages {
if (mDeviceOwnerUserId == userId) {
return mDeviceOwnerPackage;
}
+ if (mProfileOwnerPackages == null) {
+ return null;
+ }
return mProfileOwnerPackages.get(userId);
}
diff --git a/services/core/java/com/android/server/role/RoleManagerService.java b/services/core/java/com/android/server/role/RoleManagerService.java
index 1948b202fd63..bf8c042835dd 100644
--- a/services/core/java/com/android/server/role/RoleManagerService.java
+++ b/services/core/java/com/android/server/role/RoleManagerService.java
@@ -264,9 +264,10 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
//TODO gradually add more role migrations statements here for remaining roles
// Make sure to implement LegacyRoleResolutionPolicy#getRoleHolders
// for a given role before adding a migration statement for it here
- maybeMigrateRole(RoleManager.ROLE_SMS, userId);
maybeMigrateRole(RoleManager.ROLE_ASSISTANT, userId);
+ maybeMigrateRole(RoleManager.ROLE_BROWSER, userId);
maybeMigrateRole(RoleManager.ROLE_DIALER, userId);
+ maybeMigrateRole(RoleManager.ROLE_SMS, userId);
maybeMigrateRole(RoleManager.ROLE_EMERGENCY, userId);
// Some package state has changed, so grant default roles again.
diff --git a/services/core/java/com/android/server/wm/DragState.java b/services/core/java/com/android/server/wm/DragState.java
index 553b0ffa6999..c8f7af5b10c8 100644
--- a/services/core/java/com/android/server/wm/DragState.java
+++ b/services/core/java/com/android/server/wm/DragState.java
@@ -147,12 +147,6 @@ class DragState {
return mIsClosing;
}
- private void hideInputSurface() {
- if (mInputSurface != null) {
- mTransaction.hide(mInputSurface).apply();
- }
- }
-
private void showInputSurface() {
if (mInputSurface == null) {
mInputSurface = mService.makeSurfaceBuilder(
@@ -198,8 +192,6 @@ class DragState {
mInputInterceptor = null;
}
- hideInputSurface();
-
// Send drag end broadcast if drag start has been sent.
if (mDragInProgress) {
final int myPid = Process.myPid();
@@ -239,6 +231,10 @@ class DragState {
}
// Clear the internal variables.
+ if (mInputSurface != null) {
+ mTransaction.remove(mInputSurface).apply();
+ mInputSurface = null;
+ }
if (mSurfaceControl != null) {
mTransaction.reparent(mSurfaceControl, null).apply();
mSurfaceControl = null;
diff --git a/services/core/java/com/android/server/wm/SurfaceAnimationRunner.java b/services/core/java/com/android/server/wm/SurfaceAnimationRunner.java
index cb504607420c..85176bee67df 100644
--- a/services/core/java/com/android/server/wm/SurfaceAnimationRunner.java
+++ b/services/core/java/com/android/server/wm/SurfaceAnimationRunner.java
@@ -193,7 +193,9 @@ class SurfaceAnimationRunner {
public void onAnimationStart(Animator animation) {
synchronized (mCancelLock) {
if (!a.mCancelled) {
- mFrameTransaction.show(a.mLeash);
+ // TODO: change this back to use show instead of alpha when b/138459974 is
+ // fixed.
+ mFrameTransaction.setAlpha(a.mLeash, 1);
}
}
}
diff --git a/services/core/java/com/android/server/wm/SurfaceAnimator.java b/services/core/java/com/android/server/wm/SurfaceAnimator.java
index 3d9dfeb4ecec..cd211a28a908 100644
--- a/services/core/java/com/android/server/wm/SurfaceAnimator.java
+++ b/services/core/java/com/android/server/wm/SurfaceAnimator.java
@@ -324,9 +324,9 @@ class SurfaceAnimator {
.setName(surface + " - animation-leash");
final SurfaceControl leash = builder.build();
t.setWindowCrop(leash, width, height);
- if (!hidden) {
- t.show(leash);
- }
+ t.show(leash);
+ // TODO: change this back to use show instead of alpha when b/138459974 is fixed.
+ t.setAlpha(leash, hidden ? 0 : 1);
t.reparent(surface, leash);
return leash;
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 421fd28cb2ed..8fb23a41d16a 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -2006,6 +2006,7 @@ public class WindowManagerService extends IWindowManager.Stub
int attrChanges = 0;
int flagChanges = 0;
+ int privateFlagChanges = 0;
if (attrs != null) {
displayPolicy.adjustWindowParamsLw(win, attrs, pid, uid);
// if they don't have the permission, mask out the status bar bits
@@ -2034,6 +2035,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
flagChanges = win.mAttrs.flags ^ attrs.flags;
+ privateFlagChanges = win.mAttrs.privateFlags ^ attrs.privateFlags;
attrChanges = win.mAttrs.copyFrom(attrs);
if ((attrChanges & (WindowManager.LayoutParams.LAYOUT_CHANGED
| WindowManager.LayoutParams.SYSTEM_UI_VISIBILITY_CHANGED)) != 0) {
@@ -2050,7 +2052,7 @@ public class WindowManagerService extends IWindowManager.Stub
win.getDisplayContent().getDisplayId());
}
- if ((flagChanges & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS) != 0) {
+ if ((privateFlagChanges & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS) != 0) {
updateNonSystemOverlayWindowsVisibilityIfNeeded(
win, win.mWinAnimator.getShown());
}
@@ -7543,7 +7545,7 @@ public class WindowManagerService extends IWindowManager.Stub
return;
}
final boolean systemAlertWindowsHidden = !mHidingNonSystemOverlayWindows.isEmpty();
- if (surfaceShown) {
+ if (surfaceShown && win.hideNonSystemOverlayWindowsWhenVisible()) {
if (!mHidingNonSystemOverlayWindows.contains(win)) {
mHidingNonSystemOverlayWindows.add(win);
}
diff --git a/services/tests/servicestests/AndroidManifest.xml b/services/tests/servicestests/AndroidManifest.xml
index 01f2f6b26415..c1bbb307c9f5 100644
--- a/services/tests/servicestests/AndroidManifest.xml
+++ b/services/tests/servicestests/AndroidManifest.xml
@@ -69,6 +69,7 @@
<uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
<uses-permission android:name="android.permission.WRITE_DEVICE_CONFIG" />
<uses-permission android:name="android.permission.HARDWARE_TEST"/>
+ <uses-permission android:name="android.permission.BLUETOOTH"/>
<!-- Uses API introduced in O (26) -->
<uses-sdk android:minSdkVersion="1"
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityInputFilterTest.java b/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityInputFilterTest.java
index 782dc3e2ad45..193f540246e6 100644
--- a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityInputFilterTest.java
+++ b/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityInputFilterTest.java
@@ -47,6 +47,8 @@ import android.view.MotionEvent;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
+import com.android.server.accessibility.gestures.TouchExplorer;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityServiceConnectionTest.java b/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityServiceConnectionTest.java
index 2f9f9bbecbdf..6be5a3785865 100644
--- a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityServiceConnectionTest.java
+++ b/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityServiceConnectionTest.java
@@ -192,7 +192,8 @@ public class AccessibilityServiceConnectionTest {
when(parceledListSlice.getList()).thenReturn(gestureSteps);
mConnection.dispatchGesture(0, parceledListSlice, Display.DEFAULT_DISPLAY);
- verify(mMockMotionEventInjector).injectEvents(gestureSteps, mMockServiceClient, 0);
+ verify(mMockMotionEventInjector).injectEvents(gestureSteps, mMockServiceClient, 0,
+ Display.DEFAULT_DISPLAY);
}
@Test
@@ -209,7 +210,8 @@ public class AccessibilityServiceConnectionTest {
when(parceledListSlice.getList()).thenReturn(gestureSteps);
mConnection.dispatchGesture(0, parceledListSlice, Display.DEFAULT_DISPLAY);
- verify(mMockMotionEventInjector, never()).injectEvents(gestureSteps, mMockServiceClient, 0);
+ verify(mMockMotionEventInjector, never()).injectEvents(gestureSteps, mMockServiceClient, 0,
+ Display.DEFAULT_DISPLAY);
verify(mMockServiceClient).onPerformGestureResult(0, false);
}
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/MotionEventInjectorTest.java b/services/tests/servicestests/src/com/android/server/accessibility/MotionEventInjectorTest.java
index 2977414fb302..f1142fd2f8f9 100644
--- a/services/tests/servicestests/src/com/android/server/accessibility/MotionEventInjectorTest.java
+++ b/services/tests/servicestests/src/com/android/server/accessibility/MotionEventInjectorTest.java
@@ -47,6 +47,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
import android.util.Log;
+import android.view.Display;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -709,7 +710,8 @@ public class MotionEventInjectorTest {
private void injectEventsSync(List<GestureStep> gestureSteps,
IAccessibilityServiceClient serviceInterface, int sequence) {
- mMotionEventInjector.injectEvents(gestureSteps, serviceInterface, sequence);
+ mMotionEventInjector.injectEvents(gestureSteps, serviceInterface, sequence,
+ Display.DEFAULT_DISPLAY);
// Dispatch the message sent by the injector. Our simple handler doesn't guarantee stuff
// happens in order.
mMessageCapturingHandler.sendLastMessage();
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityGestureDetectorTest.java b/services/tests/servicestests/src/com/android/server/accessibility/gestures/AccessibilityGestureDetectorTest.java
index cdcc338b3928..2585a2832094 100644
--- a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityGestureDetectorTest.java
+++ b/services/tests/servicestests/src/com/android/server/accessibility/gestures/AccessibilityGestureDetectorTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server.accessibility;
+package com.android.server.accessibility.gestures;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.mock;
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/TouchExplorerTest.java b/services/tests/servicestests/src/com/android/server/accessibility/gestures/TouchExplorerTest.java
index 2645461b5912..274ca368baa1 100644
--- a/services/tests/servicestests/src/com/android/server/accessibility/TouchExplorerTest.java
+++ b/services/tests/servicestests/src/com/android/server/accessibility/gestures/TouchExplorerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server.accessibility;
+package com.android.server.accessibility.gestures;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -31,6 +31,9 @@ import android.view.MotionEvent;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
+import com.android.server.accessibility.AccessibilityManagerService;
+import com.android.server.accessibility.EventStreamTransformation;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/services/tests/servicestests/src/com/android/server/audio/AudioDeviceBrokerTest.java b/services/tests/servicestests/src/com/android/server/audio/AudioDeviceBrokerTest.java
new file mode 100644
index 000000000000..5c2ad94720f0
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/audio/AudioDeviceBrokerTest.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2019 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.audio;
+
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothProfile;
+import android.content.Context;
+import android.media.AudioManager;
+import android.media.AudioSystem;
+import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatchers;
+import org.mockito.Mock;
+import org.mockito.Spy;
+
+@MediumTest
+@RunWith(AndroidJUnit4.class)
+public class AudioDeviceBrokerTest {
+
+ private static final String TAG = "AudioDeviceBrokerTest";
+ private static final int MAX_MESSAGE_HANDLING_DELAY_MS = 100;
+
+ private Context mContext;
+ // the actual class under test
+ private AudioDeviceBroker mAudioDeviceBroker;
+
+ @Mock private AudioService mMockAudioService;
+ @Spy private AudioDeviceInventory mSpyDevInventory;
+
+ private BluetoothDevice mFakeBtDevice;
+
+ @Before
+ public void setUp() throws Exception {
+ mContext = InstrumentationRegistry.getTargetContext();
+
+ mMockAudioService = mock(AudioService.class);
+ mSpyDevInventory = spy(new AudioDeviceInventory());
+ mAudioDeviceBroker = new AudioDeviceBroker(mContext, mMockAudioService, mSpyDevInventory);
+ mSpyDevInventory.setDeviceBroker(mAudioDeviceBroker);
+
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ mFakeBtDevice = adapter.getRemoteDevice("00:01:02:03:04:05");
+ Assert.assertNotNull("invalid null BT device", mFakeBtDevice);
+ }
+
+ @After
+ public void tearDown() throws Exception { }
+
+ @Test
+ public void testSetUpAndTearDown() { }
+
+ /**
+ * Verify call to postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent() for connection
+ * calls into AudioDeviceInventory with the right params
+ * @throws Exception
+ */
+ @Test
+ public void testPostA2dpDeviceConnectionChange() throws Exception {
+ Log.i(TAG, "testPostA2dpDeviceConnectionChange");
+ Assert.assertNotNull("invalid null BT device", mFakeBtDevice);
+
+ mAudioDeviceBroker.postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(mFakeBtDevice,
+ BluetoothProfile.STATE_CONNECTED, BluetoothProfile.A2DP, true, 1);
+ Thread.sleep(MAX_MESSAGE_HANDLING_DELAY_MS);
+ verify(mSpyDevInventory, times(1)).setBluetoothA2dpDeviceConnectionState(
+ any(BluetoothDevice.class),
+ ArgumentMatchers.eq(BluetoothProfile.STATE_CONNECTED) /*state*/,
+ ArgumentMatchers.eq(BluetoothProfile.A2DP) /*profile*/,
+ ArgumentMatchers.eq(true) /*suppressNoisyIntent*/, anyInt() /*musicDevice*/,
+ ArgumentMatchers.eq(1) /*a2dpVolume*/
+ );
+ }
+
+ /**
+ * Verify call to postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent() for
+ * connection > pause > disconnection > connection
+ * keeps the device connected
+ * @throws Exception
+ */
+ @Test
+ public void testA2dpDeviceConnectionDisconnectionConnectionChange() throws Exception {
+ Log.i(TAG, "testA2dpDeviceConnectionDisconnectionConnectionChange");
+
+ doTestConnectionDisconnectionReconnection(0);
+ }
+
+ /**
+ * Verify device disconnection and reconnection within the BECOMING_NOISY window
+ * @throws Exception
+ */
+ @Test
+ public void testA2dpDeviceReconnectionWithinBecomingNoisyDelay() throws Exception {
+ Log.i(TAG, "testA2dpDeviceReconnectionWithinBecomingNoisyDelay");
+
+ doTestConnectionDisconnectionReconnection(AudioService.BECOMING_NOISY_DELAY_MS / 2);
+ }
+
+ private void doTestConnectionDisconnectionReconnection(int delayAfterDisconnection)
+ throws Exception {
+ when(mMockAudioService.getDeviceForStream(AudioManager.STREAM_MUSIC))
+ .thenReturn(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
+ when(mMockAudioService.isInCommunication()).thenReturn(false);
+ when(mMockAudioService.hasMediaDynamicPolicy()).thenReturn(false);
+ when(mMockAudioService.hasAudioFocusUsers()).thenReturn(false);
+
+ // first connection
+ mAudioDeviceBroker.postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(mFakeBtDevice,
+ BluetoothProfile.STATE_CONNECTED, BluetoothProfile.A2DP, true, 1);
+ Thread.sleep(MAX_MESSAGE_HANDLING_DELAY_MS);
+
+ // disconnection
+ mAudioDeviceBroker.postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(mFakeBtDevice,
+ BluetoothProfile.STATE_DISCONNECTED, BluetoothProfile.A2DP, false, -1);
+ if (delayAfterDisconnection > 0) {
+ Thread.sleep(delayAfterDisconnection);
+ }
+
+ // reconnection
+ mAudioDeviceBroker.postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(mFakeBtDevice,
+ BluetoothProfile.STATE_CONNECTED, BluetoothProfile.A2DP, true, 2);
+ Thread.sleep(AudioService.BECOMING_NOISY_DELAY_MS + MAX_MESSAGE_HANDLING_DELAY_MS);
+
+ // Verify disconnection has been cancelled and we're seeing two connections attempts,
+ // with the device connected at the end of the test
+ verify(mSpyDevInventory, times(2)).onSetA2dpSinkConnectionState(
+ any(BtHelper.BluetoothA2dpDeviceInfo.class),
+ ArgumentMatchers.eq(BluetoothProfile.STATE_CONNECTED));
+ Assert.assertTrue("Mock device not connected",
+ mSpyDevInventory.isA2dpDeviceConnected(mFakeBtDevice));
+ }
+}
diff --git a/startop/view_compiler/dex_layout_compiler.cc b/startop/view_compiler/dex_layout_compiler.cc
index c68793d10399..8febfb71ecd1 100644
--- a/startop/view_compiler/dex_layout_compiler.cc
+++ b/startop/view_compiler/dex_layout_compiler.cc
@@ -23,25 +23,6 @@ namespace startop {
using android::base::StringPrintf;
-void LayoutValidationVisitor::VisitStartTag(const std::u16string& name) {
- if (0 == name.compare(u"merge")) {
- message_ = "Merge tags are not supported";
- can_compile_ = false;
- }
- if (0 == name.compare(u"include")) {
- message_ = "Include tags are not supported";
- can_compile_ = false;
- }
- if (0 == name.compare(u"view")) {
- message_ = "View tags are not supported";
- can_compile_ = false;
- }
- if (0 == name.compare(u"fragment")) {
- message_ = "Fragment tags are not supported";
- can_compile_ = false;
- }
-}
-
DexViewBuilder::DexViewBuilder(dex::MethodBuilder* method)
: method_{method},
context_{dex::Value::Parameter(0)},
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index cd79f37bb2ce..4151ba522b9c 100755
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -2328,6 +2328,13 @@ public class CarrierConfigManager {
public static final String KEY_RTT_DOWNGRADE_SUPPORTED_BOOL = "rtt_downgrade_supported_bool";
/**
+ * Indicates if the TTY HCO and VCO options should be hidden in the accessibility menu
+ * if the device is capable of RTT.
+ * @hide
+ */
+ public static final String KEY_HIDE_TTY_HCO_VCO_WITH_RTT_BOOL = "hide_tty_hco_vco_with_rtt";
+
+ /**
* The flag to disable the popup dialog which warns the user of data charges.
* @hide
*/
@@ -2407,6 +2414,14 @@ public class CarrierConfigManager {
public static final String KEY_CHECK_PRICING_WITH_CARRIER_FOR_DATA_ROAMING_BOOL =
"check_pricing_with_carrier_data_roaming_bool";
+ /**
+ * Determines whether we should show a notification when the phone established a data
+ * connection in roaming network, to warn users about possible roaming charges.
+ * @hide
+ */
+ public static final String KEY_SHOW_DATA_CONNECTED_ROAMING_NOTIFICATION_BOOL =
+ "show_data_connected_roaming_notification";
+
/**
* A list of 4 LTE RSRP thresholds above which a signal level is considered POOR,
* MODERATE, GOOD, or EXCELLENT, to be used in SignalStrength reporting.
@@ -3406,6 +3421,7 @@ public class CarrierConfigManager {
sDefaults.putBoolean(KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL, false);
sDefaults.putBoolean(KEY_RTT_SUPPORTED_BOOL, false);
sDefaults.putBoolean(KEY_TTY_SUPPORTED_BOOL, true);
+ sDefaults.putBoolean(KEY_HIDE_TTY_HCO_VCO_WITH_RTT_BOOL, false);
sDefaults.putBoolean(KEY_DISABLE_CHARGE_INDICATION_BOOL, false);
sDefaults.putBoolean(KEY_SUPPORT_NO_REPLY_TIMER_FOR_CFNRY_BOOL, true);
sDefaults.putStringArray(KEY_FEATURE_ACCESS_CODES_STRING_ARRAY, null);
@@ -3424,6 +3440,7 @@ public class CarrierConfigManager {
sDefaults.putString(KEY_CARRIER_SETTINGS_ACTIVITY_COMPONENT_NAME_STRING, "");
sDefaults.putBoolean(KEY_CARRIER_CONFIG_APPLIED_BOOL, false);
sDefaults.putBoolean(KEY_CHECK_PRICING_WITH_CARRIER_FOR_DATA_ROAMING_BOOL, false);
+ sDefaults.putBoolean(KEY_SHOW_DATA_CONNECTED_ROAMING_NOTIFICATION_BOOL, false);
sDefaults.putIntArray(KEY_LTE_RSRP_THRESHOLDS_INT_ARRAY,
new int[] {
-128, /* SIGNAL_STRENGTH_POOR */
diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java
index cdf4c935f84b..aa7e21a82500 100644
--- a/telephony/java/android/telephony/DisconnectCause.java
+++ b/telephony/java/android/telephony/DisconnectCause.java
@@ -340,6 +340,19 @@ public final class DisconnectCause {
*/
public static final int MEDIA_TIMEOUT = 77;
+ /**
+ * Indicates that an emergency call cannot be placed over WFC because the service is not
+ * available in the current location.
+ * @hide
+ */
+ public static final int EMERGENCY_CALL_OVER_WFC_NOT_AVAILABLE = 78;
+
+ /**
+ * Indicates that WiFi calling service is not available in the current location.
+ * @hide
+ */
+ public static final int WFC_SERVICE_NOT_AVAILABLE_IN_THIS_LOCATION = 79;
+
//*********************************************************************************************
// When adding a disconnect type:
// 1) Update toString() with the newly added disconnect type.
@@ -510,6 +523,10 @@ public final class DisconnectCause {
return "OTASP_PROVISIONING_IN_PROCESS";
case MEDIA_TIMEOUT:
return "MEDIA_TIMEOUT";
+ case EMERGENCY_CALL_OVER_WFC_NOT_AVAILABLE:
+ return "EMERGENCY_CALL_OVER_WFC_NOT_AVAILABLE";
+ case WFC_SERVICE_NOT_AVAILABLE_IN_THIS_LOCATION:
+ return "WFC_SERVICE_NOT_AVAILABLE_IN_THIS_LOCATION";
default:
return "INVALID: " + cause;
}
diff --git a/telephony/java/android/telephony/ims/ImsReasonInfo.java b/telephony/java/android/telephony/ims/ImsReasonInfo.java
index a478606da22a..20aba4d97849 100644
--- a/telephony/java/android/telephony/ims/ImsReasonInfo.java
+++ b/telephony/java/android/telephony/ims/ImsReasonInfo.java
@@ -871,6 +871,19 @@ public final class ImsReasonInfo implements Parcelable {
*/
public static final int CODE_REJECT_ONGOING_CS_CALL = 1621;
+ /**
+ * An attempt was made to place an emergency call over WFC when emergency services is not
+ * currently available in the current location.
+ * @hide
+ */
+ public static final int CODE_EMERGENCY_CALL_OVER_WFC_NOT_AVAILABLE = 1622;
+
+ /**
+ * Indicates that WiFi calling service is not available in the current location.
+ * @hide
+ */
+ public static final int CODE_WFC_SERVICE_NOT_AVAILABLE_IN_THIS_LOCATION = 1623;
+
/*
* OEM specific error codes. To be used by OEMs when they don't want to reveal error code which
* would be replaced by ERROR_UNSPECIFIED.
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index dcfd193185cf..a65acac737d9 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -319,6 +319,7 @@ interface ITelephony {
/**
* Replaced by getDataActivityForSubId.
*/
+ @UnsupportedAppUsage(maxTargetSdk = 28)
int getDataActivity();
/**
@@ -336,6 +337,7 @@ interface ITelephony {
/**
* Replaced by getDataStateForSubId.
*/
+ @UnsupportedAppUsage(maxTargetSdk = 28)
int getDataState();
/**
diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
index dc026d48c6cf..98fee83d83a9 100644
--- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
@@ -49,8 +49,10 @@ interface ITelephonyRegistry {
void notifySignalStrengthForPhoneId(in int phoneId, in int subId,
in SignalStrength signalStrength);
void notifyMessageWaitingChangedForPhoneId(in int phoneId, in int subId, in boolean mwi);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void notifyCallForwardingChanged(boolean cfi);
void notifyCallForwardingChangedForSubscriber(in int subId, boolean cfi);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void notifyDataActivity(int state);
void notifyDataActivityForSubscriber(in int subId, int state);
void notifyDataConnection(int state, boolean isDataConnectivityPossible,
@@ -63,8 +65,10 @@ interface ITelephonyRegistry {
@UnsupportedAppUsage
void notifyDataConnectionFailed(String apnType);
void notifyDataConnectionFailedForSubscriber(int phoneId, int subId, String apnType);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void notifyCellLocation(in Bundle cellLocation);
void notifyCellLocationForSubscriber(in int subId, in Bundle cellLocation);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void notifyOtaspChanged(in int subId, in int otaspMode);
@UnsupportedAppUsage
void notifyCellInfo(in List<CellInfo> cellInfo);