Merge "Add inactivity timer to turn off keyboard backlight"
diff --git a/core/api/current.txt b/core/api/current.txt
index 9a6e76b..141725d 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -40519,7 +40519,9 @@
method public android.os.IBinder onBind(android.content.Intent);
method @NonNull public java.util.Set<java.lang.String> onGetSupportedVoiceActions(@NonNull java.util.Set<java.lang.String>);
method public void onLaunchVoiceAssistFromKeyguard();
+ method public void onPrepareToShowSession(@NonNull android.os.Bundle, int);
method public void onReady();
+ method public void onShowSessionFailed();
method public void onShutdown();
method public void setDisabledShowContext(int);
method public final void setUiHints(@NonNull android.os.Bundle);
@@ -50560,6 +50562,7 @@
field public static final int AXIS_GENERIC_7 = 38; // 0x26
field public static final int AXIS_GENERIC_8 = 39; // 0x27
field public static final int AXIS_GENERIC_9 = 40; // 0x28
+ field public static final int AXIS_GESTURE_PINCH_SCALE_FACTOR = 52; // 0x34
field public static final int AXIS_GESTURE_SCROLL_X_DISTANCE = 50; // 0x32
field public static final int AXIS_GESTURE_SCROLL_Y_DISTANCE = 51; // 0x33
field public static final int AXIS_GESTURE_X_OFFSET = 48; // 0x30
@@ -50600,6 +50603,7 @@
field public static final int CLASSIFICATION_AMBIGUOUS_GESTURE = 1; // 0x1
field public static final int CLASSIFICATION_DEEP_PRESS = 2; // 0x2
field public static final int CLASSIFICATION_NONE = 0; // 0x0
+ field public static final int CLASSIFICATION_PINCH = 5; // 0x5
field public static final int CLASSIFICATION_TWO_FINGER_SWIPE = 3; // 0x3
field @NonNull public static final android.os.Parcelable.Creator<android.view.MotionEvent> CREATOR;
field public static final int EDGE_BOTTOM = 2; // 0x2
diff --git a/core/java/android/app/admin/EnterprisePlatformSecurity_OWNERS b/core/java/android/app/admin/EnterprisePlatformSecurity_OWNERS
index 0ec8253..270cb18 100644
--- a/core/java/android/app/admin/EnterprisePlatformSecurity_OWNERS
+++ b/core/java/android/app/admin/EnterprisePlatformSecurity_OWNERS
@@ -1,5 +1,4 @@
rubinxu@google.com
-acjohnston@google.com
pgrafov@google.com
ayushsha@google.com
alexkershaw@google.com #{LAST_RESORT_SUGGESTION}
\ No newline at end of file
diff --git a/core/java/android/app/admin/EnterprisePlatform_OWNERS b/core/java/android/app/admin/EnterprisePlatform_OWNERS
index fb00fe5..6ce25cc 100644
--- a/core/java/android/app/admin/EnterprisePlatform_OWNERS
+++ b/core/java/android/app/admin/EnterprisePlatform_OWNERS
@@ -1,2 +1,5 @@
+# Assign bugs to android-enterprise-triage@google.com
file:WorkDeviceExperience_OWNERS
+file:Provisioning_OWNERS
+file:WorkProfile_OWNERS
file:EnterprisePlatformSecurity_OWNERS
\ No newline at end of file
diff --git a/core/java/android/app/admin/Provisioning_OWNERS b/core/java/android/app/admin/Provisioning_OWNERS
new file mode 100644
index 0000000..c59a9dc
--- /dev/null
+++ b/core/java/android/app/admin/Provisioning_OWNERS
@@ -0,0 +1,5 @@
+# Assign bugs to android-enterprise-triage@google.com
+petuska@google.com
+nupursn@google.com
+shreyacsingh@google.com
+alexkershaw@google.com #{LAST_RESORT_SUGGESTION}
\ No newline at end of file
diff --git a/core/java/android/app/admin/WorkDeviceExperience_OWNERS b/core/java/android/app/admin/WorkDeviceExperience_OWNERS
index 82afddd..2033343 100644
--- a/core/java/android/app/admin/WorkDeviceExperience_OWNERS
+++ b/core/java/android/app/admin/WorkDeviceExperience_OWNERS
@@ -1,5 +1,7 @@
+# Assign bugs to android-enterprise-triage@google.com
work-device-experience+reviews@google.com
-scottjonathan@google.com
-kholoudm@google.com
-eliselliott@google.com
+scottjonathan@google.com #{LAST_RESORT_SUGGESTION}
+eliselliott@google.com #{LAST_RESORT_SUGGESTION}
+kholoudm@google.com #{LAST_RESORT_SUGGESTION}
+acjohnston@google.com #{LAST_RESORT_SUGGESTION}
alexkershaw@google.com #{LAST_RESORT_SUGGESTION}
diff --git a/core/java/android/app/admin/WorkProfile_OWNERS b/core/java/android/app/admin/WorkProfile_OWNERS
new file mode 100644
index 0000000..260b672
--- /dev/null
+++ b/core/java/android/app/admin/WorkProfile_OWNERS
@@ -0,0 +1,5 @@
+# Assign bugs to android-enterprise-triage@google.com
+liahav@google.com
+olit@google.com
+scottjonathan@google.com #{LAST_RESORT_SUGGESTION}
+alexkershaw@google.com #{LAST_RESORT_SUGGESTION}
\ No newline at end of file
diff --git a/core/java/android/service/voice/IVoiceInteractionService.aidl b/core/java/android/service/voice/IVoiceInteractionService.aidl
index 24819a6..efae5c1 100644
--- a/core/java/android/service/voice/IVoiceInteractionService.aidl
+++ b/core/java/android/service/voice/IVoiceInteractionService.aidl
@@ -16,6 +16,8 @@
package android.service.voice;
+import android.os.Bundle;
+
import com.android.internal.app.IVoiceActionCheckCallback;
/**
@@ -28,4 +30,6 @@
void launchVoiceAssistFromKeyguard();
void getActiveServiceSupportedActions(in List<String> voiceActions,
in IVoiceActionCheckCallback callback);
+ void prepareToShowSession(in Bundle args, int flags);
+ void showSessionFailed();
}
diff --git a/core/java/android/service/voice/VoiceInteractionService.java b/core/java/android/service/voice/VoiceInteractionService.java
index 9e1518d..d49b5a5 100644
--- a/core/java/android/service/voice/VoiceInteractionService.java
+++ b/core/java/android/service/voice/VoiceInteractionService.java
@@ -160,6 +160,20 @@
voiceActions,
callback));
}
+
+ @Override
+ public void prepareToShowSession(Bundle args, int flags) {
+ Handler.getMain().executeOrSendMessage(PooledLambda.obtainMessage(
+ VoiceInteractionService::onPrepareToShowSession,
+ VoiceInteractionService.this, args, flags));
+ }
+
+ @Override
+ public void showSessionFailed() {
+ Handler.getMain().executeOrSendMessage(PooledLambda.obtainMessage(
+ VoiceInteractionService::onShowSessionFailed,
+ VoiceInteractionService.this));
+ }
};
IVoiceInteractionManagerService mSystemService;
@@ -184,6 +198,31 @@
}
/**
+ * Notify the interactor when the system prepares to show session. The system is going to
+ * bind the session service.
+ *
+ * @param args The arguments that were supplied to {@link #showSession(Bundle, int)}.
+ * @param flags The show flags originally provided to {@link #showSession(Bundle, int)}.
+ * @see #showSession(Bundle, int)
+ * @see #onShowSessionFailed()
+ * @see VoiceInteractionSession#onShow(Bundle, int)
+ * @see VoiceInteractionSession#show(Bundle, int)
+ */
+ public void onPrepareToShowSession(@NonNull Bundle args, int flags) {
+ }
+
+ /**
+ * Called when the show session failed. E.g. When the system bound the session service failed.
+ *
+ * @see #showSession(Bundle, int)
+ * @see #onPrepareToShowSession(Bundle, int)
+ * @see VoiceInteractionSession#onShow(Bundle, int)
+ * @see VoiceInteractionSession#show(Bundle, int)
+ */
+ public void onShowSessionFailed() {
+ }
+
+ /**
* Check whether the given service component is the currently active
* VoiceInteractionService.
*/
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index b91019c..84bbdd1 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -1283,6 +1283,8 @@
* swipe gesture starts at X = 500 then moves to X = 400, this axis would have a value of
* -0.1.
* </ul>
+ * These values are relative to the state from the last event, not accumulated, so developers
+ * should make sure to process this axis value for all batched historical events.
*/
public static final int AXIS_GESTURE_X_OFFSET = 48;
@@ -1300,6 +1302,8 @@
* <li>For a touch pad, reports the distance that should be scrolled in the X axis as a result
* of the user's two-finger scroll gesture, in display pixels.
* </ul>
+ * These values are relative to the state from the last event, not accumulated, so developers
+ * should make sure to process this axis value for all batched historical events.
*/
public static final int AXIS_GESTURE_SCROLL_X_DISTANCE = 50;
@@ -1310,6 +1314,19 @@
*/
public static final int AXIS_GESTURE_SCROLL_Y_DISTANCE = 51;
+ /**
+ * Axis constant: pinch scale factor of a motion event.
+ * <p>
+ * <ul>
+ * <li>For a touch pad, reports the change in distance between the fingers when the user is
+ * making a pinch gesture, as a proportion of the previous distance. For example, if the fingers
+ * were 50 units apart and are now 52 units apart, the scale factor would be 1.04.
+ * </ul>
+ * These values are relative to the state from the last event, not accumulated, so developers
+ * should make sure to process this axis value for all batched historical events.
+ */
+ public static final int AXIS_GESTURE_PINCH_SCALE_FACTOR = 52;
+
// NOTE: If you add a new axis here you must also add it to:
// frameworks/native/include/android/input.h
// frameworks/native/libs/input/InputEventLabels.cpp
@@ -1369,6 +1386,7 @@
names.append(AXIS_GESTURE_Y_OFFSET, "AXIS_GESTURE_Y_OFFSET");
names.append(AXIS_GESTURE_SCROLL_X_DISTANCE, "AXIS_GESTURE_SCROLL_X_DISTANCE");
names.append(AXIS_GESTURE_SCROLL_Y_DISTANCE, "AXIS_GESTURE_SCROLL_Y_DISTANCE");
+ names.append(AXIS_GESTURE_PINCH_SCALE_FACTOR, "AXIS_GESTURE_PINCH_SCALE_FACTOR");
}
/**
@@ -1522,11 +1540,22 @@
*/
public static final int CLASSIFICATION_MULTI_FINGER_SWIPE = 4;
+ /**
+ * Classification constant: touchpad pinch.
+ *
+ * The current event stream represents the user pinching with two fingers on a touchpad. The
+ * gesture is centered around the current cursor position.
+ *
+ * @see #getClassification
+ */
+ public static final int CLASSIFICATION_PINCH = 5;
+
/** @hide */
@Retention(SOURCE)
@IntDef(prefix = { "CLASSIFICATION" }, value = {
CLASSIFICATION_NONE, CLASSIFICATION_AMBIGUOUS_GESTURE, CLASSIFICATION_DEEP_PRESS,
- CLASSIFICATION_TWO_FINGER_SWIPE, CLASSIFICATION_MULTI_FINGER_SWIPE})
+ CLASSIFICATION_TWO_FINGER_SWIPE, CLASSIFICATION_MULTI_FINGER_SWIPE,
+ CLASSIFICATION_PINCH})
public @interface Classification {};
/**
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 2114ce7..74e521a 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -8823,6 +8823,10 @@
mAdded = false;
AnimationHandler.removeRequestor(this);
}
+ if (mActiveSurfaceSyncGroup != null) {
+ mActiveSurfaceSyncGroup.markSyncReady();
+ mActiveSurfaceSyncGroup = null;
+ }
WindowManagerGlobal.getInstance().doRemoveView(this);
}
diff --git a/core/java/com/android/server/backup/AccountManagerBackupHelper.java b/core/java/com/android/server/backup/AccountManagerBackupHelper.java
index f76dd09..5677699 100644
--- a/core/java/com/android/server/backup/AccountManagerBackupHelper.java
+++ b/core/java/com/android/server/backup/AccountManagerBackupHelper.java
@@ -18,8 +18,8 @@
import android.accounts.AccountManagerInternal;
import android.app.backup.BlobBackupHelper;
-import android.os.UserHandle;
import android.util.Slog;
+
import com.android.server.LocalServices;
/**
@@ -35,8 +35,11 @@
// key under which the account access grant state blob is committed to backup
private static final String KEY_ACCOUNT_ACCESS_GRANTS = "account_access_grants";
- public AccountManagerBackupHelper() {
+ private final int mUserId;
+
+ public AccountManagerBackupHelper(int userId) {
super(STATE_VERSION, KEY_ACCOUNT_ACCESS_GRANTS);
+ mUserId = userId;
}
@Override
@@ -48,7 +51,7 @@
try {
switch (key) {
case KEY_ACCOUNT_ACCESS_GRANTS: {
- return am.backupAccountAccessPermissions(UserHandle.USER_SYSTEM);
+ return am.backupAccountAccessPermissions(mUserId);
}
default: {
@@ -71,7 +74,7 @@
try {
switch (key) {
case KEY_ACCOUNT_ACCESS_GRANTS: {
- am.restoreAccountAccessPermissions(payload, UserHandle.USER_SYSTEM);
+ am.restoreAccountAccessPermissions(payload, mUserId);
} break;
default: {
diff --git a/native/android/input.cpp b/native/android/input.cpp
index 5e5ebed..f1c3088 100644
--- a/native/android/input.cpp
+++ b/native/android/input.cpp
@@ -299,6 +299,8 @@
return AMOTION_EVENT_CLASSIFICATION_TWO_FINGER_SWIPE;
case android::MotionClassification::MULTI_FINGER_SWIPE:
return AMOTION_EVENT_CLASSIFICATION_MULTI_FINGER_SWIPE;
+ case android::MotionClassification::PINCH:
+ return AMOTION_EVENT_CLASSIFICATION_PINCH;
}
}
diff --git a/services/backup/java/com/android/server/backup/TransportManager.java b/services/backup/java/com/android/server/backup/TransportManager.java
index a4ea698..05327dc 100644
--- a/services/backup/java/com/android/server/backup/TransportManager.java
+++ b/services/backup/java/com/android/server/backup/TransportManager.java
@@ -156,14 +156,16 @@
} catch (IllegalArgumentException ex) {
// packageName doesn't exist: likely due to a race with it being uninstalled.
if (MORE_DEBUG) {
- Slog.d(TAG, "Package " + packageName + " was changed, but no longer exists.");
+ Slog.d(TAG, addUserIdToLogMessage(mUserId, "Package " + packageName
+ + " was changed, but no longer exists."));
}
return;
}
switch (enabled) {
case COMPONENT_ENABLED_STATE_ENABLED: {
if (MORE_DEBUG) {
- Slog.d(TAG, "Package " + packageName + " was enabled.");
+ Slog.d(TAG, addUserIdToLogMessage(mUserId, "Package " + packageName
+ + " was enabled."));
}
onPackageEnabled(packageName);
return;
@@ -173,28 +175,31 @@
// Unless explicitly specified in manifest, the default enabled state
// is 'enabled'. Here, we assume that default state always means enabled.
if (MORE_DEBUG) {
- Slog.d(TAG, "Package " + packageName
- + " was put in default enabled state.");
+ Slog.d(TAG, addUserIdToLogMessage(mUserId, "Package " + packageName
+ + " was put in default enabled state."));
}
onPackageEnabled(packageName);
return;
}
case COMPONENT_ENABLED_STATE_DISABLED: {
if (MORE_DEBUG) {
- Slog.d(TAG, "Package " + packageName + " was disabled.");
+ Slog.d(TAG, addUserIdToLogMessage(mUserId, "Package " + packageName
+ + " was disabled."));
}
onPackageDisabled(packageName);
return;
}
case COMPONENT_ENABLED_STATE_DISABLED_USER: {
if (MORE_DEBUG) {
- Slog.d(TAG, "Package " + packageName + " was disabled by user.");
+ Slog.d(TAG, addUserIdToLogMessage(mUserId, "Package " + packageName
+ + " was disabled by user."));
}
onPackageDisabled(packageName);
return;
}
default: {
- Slog.w(TAG, "Package " + packageName + " enabled setting: " + enabled);
+ Slog.w(TAG, addUserIdToLogMessage(mUserId, "Package " + packageName
+ + " enabled setting: " + enabled));
return;
}
}
@@ -405,7 +410,8 @@
TransportDescription description =
mRegisteredTransportsDescriptionMap.get(transportComponent);
if (description == null) {
- Slog.e(TAG, "Transport " + name + " not registered tried to change description");
+ Slog.e(TAG, addUserIdToLogMessage(mUserId, "Transport " + name
+ + " not registered tried to change description"));
return;
}
description.name = name;
@@ -413,7 +419,8 @@
description.currentDestinationString = currentDestinationString;
description.dataManagementIntent = dataManagementIntent;
description.dataManagementLabel = dataManagementLabel;
- Slog.d(TAG, "Transport " + name + " updated its attributes");
+ Slog.d(TAG, addUserIdToLogMessage(mUserId, "Transport " + name
+ + " updated its attributes"));
}
}
@@ -493,7 +500,8 @@
try {
return getTransportClientOrThrow(transportName, caller);
} catch (TransportNotRegisteredException e) {
- Slog.w(TAG, "Transport " + transportName + " not registered");
+ Slog.w(TAG, addUserIdToLogMessage(mUserId, "Transport " + transportName
+ + " not registered"));
return null;
}
}
@@ -620,7 +628,7 @@
selectTransport(getTransportName(transportComponent));
return BackupManager.SUCCESS;
} catch (TransportNotRegisteredException e) {
- Slog.wtf(TAG, "Transport got unregistered");
+ Slog.wtf(TAG, addUserIdToLogMessage(mUserId, "Transport got unregistered"));
return BackupManager.ERROR_TRANSPORT_UNAVAILABLE;
}
}
@@ -637,7 +645,8 @@
try {
mPackageManager.getPackageInfoAsUser(packageName, 0, mUserId);
} catch (PackageManager.NameNotFoundException e) {
- Slog.e(TAG, "Trying to register transports from package not found " + packageName);
+ Slog.e(TAG, addUserIdToLogMessage(mUserId,
+ "Trying to register transports from package not found " + packageName));
return;
}
@@ -668,7 +677,8 @@
if (!mTransportWhitelist.contains(transport)) {
Slog.w(
TAG,
- "BackupTransport " + transport.flattenToShortString() + " not whitelisted.");
+ addUserIdToLogMessage(mUserId, "BackupTransport "
+ + transport.flattenToShortString() + " not whitelisted."));
return false;
}
try {
@@ -676,11 +686,12 @@
mPackageManager.getPackageInfoAsUser(transport.getPackageName(), 0, mUserId);
if ((packInfo.applicationInfo.privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED)
== 0) {
- Slog.w(TAG, "Transport package " + transport.getPackageName() + " not privileged");
+ Slog.w(TAG, addUserIdToLogMessage(mUserId, "Transport package "
+ + transport.getPackageName() + " not privileged"));
return false;
}
} catch (PackageManager.NameNotFoundException e) {
- Slog.w(TAG, "Package not found.", e);
+ Slog.w(TAG, addUserIdToLogMessage(mUserId, "Package not found."), e);
return false;
}
return true;
@@ -716,7 +727,8 @@
try {
transport = transportConnection.connectOrThrow(callerLogString);
} catch (TransportNotAvailableException e) {
- Slog.e(TAG, "Couldn't connect to transport " + transportString + " for registration");
+ Slog.e(TAG, addUserIdToLogMessage(mUserId, "Couldn't connect to transport "
+ + transportString + " for registration"));
mTransportConnectionManager.disposeOfTransportClient(transportConnection,
callerLogString);
return BackupManager.ERROR_TRANSPORT_UNAVAILABLE;
@@ -728,11 +740,13 @@
String transportDirName = transport.transportDirName();
registerTransport(transportComponent, transport);
// If registerTransport() hasn't thrown...
- Slog.d(TAG, "Transport " + transportString + " registered");
+ Slog.d(TAG, addUserIdToLogMessage(mUserId, "Transport " + transportString
+ + " registered"));
mOnTransportRegisteredListener.onTransportRegistered(transportName, transportDirName);
result = BackupManager.SUCCESS;
} catch (RemoteException e) {
- Slog.e(TAG, "Transport " + transportString + " died while registering");
+ Slog.e(TAG, addUserIdToLogMessage(mUserId, "Transport " + transportString
+ + " died while registering"));
result = BackupManager.ERROR_TRANSPORT_UNAVAILABLE;
}
@@ -798,4 +812,8 @@
this.dataManagementLabel = dataManagementLabel;
}
}
+
+ private static String addUserIdToLogMessage(int userId, String message) {
+ return "[UserID:" + userId + "] " + message;
+ }
}
diff --git a/services/core/java/com/android/server/backup/SystemBackupAgent.java b/services/core/java/com/android/server/backup/SystemBackupAgent.java
index 1b20e43..59d8afa 100644
--- a/services/core/java/com/android/server/backup/SystemBackupAgent.java
+++ b/services/core/java/com/android/server/backup/SystemBackupAgent.java
@@ -84,7 +84,8 @@
private static final String WALLPAPER_IMAGE_KEY = WallpaperBackupHelper.WALLPAPER_IMAGE_KEY;
private static final Set<String> sEligibleForMultiUser = Sets.newArraySet(
- PERMISSION_HELPER, NOTIFICATION_HELPER, SYNC_SETTINGS_HELPER, APP_LOCALES_HELPER);
+ PERMISSION_HELPER, NOTIFICATION_HELPER, SYNC_SETTINGS_HELPER, APP_LOCALES_HELPER,
+ ACCOUNT_MANAGER_HELPER);
private int mUserId = UserHandle.USER_SYSTEM;
@@ -100,7 +101,7 @@
addHelper(PERMISSION_HELPER, new PermissionBackupHelper(mUserId));
addHelper(USAGE_STATS_HELPER, new UsageStatsBackupHelper(this));
addHelper(SHORTCUT_MANAGER_HELPER, new ShortcutBackupHelper());
- addHelper(ACCOUNT_MANAGER_HELPER, new AccountManagerBackupHelper());
+ addHelper(ACCOUNT_MANAGER_HELPER, new AccountManagerBackupHelper(mUserId));
addHelper(SLICES_HELPER, new SliceBackupHelper(this));
addHelper(PEOPLE_HELPER, new PeopleBackupHelper(mUserId));
addHelper(APP_LOCALES_HELPER, new AppSpecificLocalesBackupHelper(mUserId));
diff --git a/services/core/java/com/android/server/media/BluetoothRouteProvider.java b/services/core/java/com/android/server/media/BluetoothRouteProvider.java
index c90554d..8182fe9 100644
--- a/services/core/java/com/android/server/media/BluetoothRouteProvider.java
+++ b/services/core/java/com/android/server/media/BluetoothRouteProvider.java
@@ -70,11 +70,13 @@
private final BluetoothAdapter mBluetoothAdapter;
private final BluetoothRoutesUpdatedListener mListener;
private final AudioManager mAudioManager;
- private final Map<String, BluetoothEventReceiver> mEventReceiverMap = new HashMap<>();
- private final IntentFilter mIntentFilter = new IntentFilter();
- private final BroadcastReceiver mBroadcastReceiver = new BluetoothBroadcastReceiver();
private final BluetoothProfileListener mProfileListener = new BluetoothProfileListener();
+ private final AdapterStateChangedReceiver mAdapterStateChangedReceiver =
+ new AdapterStateChangedReceiver();
+ private final DeviceStateChangedReceiver mDeviceStateChangedReceiver =
+ new DeviceStateChangedReceiver();
+
private BluetoothA2dp mA2dpProfile;
private BluetoothHearingAid mHearingAidProfile;
private BluetoothLeAudio mLeAudioProfile;
@@ -105,32 +107,45 @@
buildBluetoothRoutes();
}
+ /**
+ * Registers listener to bluetooth status changes as the provided user.
+ *
+ * The registered receiver listens to {@link BluetoothA2dp#ACTION_ACTIVE_DEVICE_CHANGED} and
+ * {@link BluetoothA2dp#ACTION_CONNECTION_STATE_CHANGED } events for {@link BluetoothProfile#A2DP},
+ * {@link BluetoothProfile#HEARING_AID}, and {@link BluetoothProfile#LE_AUDIO} bluetooth profiles.
+ *
+ * @param user {@code UserHandle} as which receiver is registered
+ */
void start(UserHandle user) {
mBluetoothAdapter.getProfileProxy(mContext, mProfileListener, BluetoothProfile.A2DP);
mBluetoothAdapter.getProfileProxy(mContext, mProfileListener, BluetoothProfile.HEARING_AID);
mBluetoothAdapter.getProfileProxy(mContext, mProfileListener, BluetoothProfile.LE_AUDIO);
- // Bluetooth on/off broadcasts
- addEventReceiver(BluetoothAdapter.ACTION_STATE_CHANGED, new AdapterStateChangedReceiver());
+ IntentFilter adapterStateChangedIntentFilter = new IntentFilter();
- DeviceStateChangedReceiver deviceStateChangedReceiver = new DeviceStateChangedReceiver();
- addEventReceiver(BluetoothA2dp.ACTION_ACTIVE_DEVICE_CHANGED, deviceStateChangedReceiver);
- addEventReceiver(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED, deviceStateChangedReceiver);
- addEventReceiver(BluetoothHearingAid.ACTION_ACTIVE_DEVICE_CHANGED,
- deviceStateChangedReceiver);
- addEventReceiver(BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED,
- deviceStateChangedReceiver);
- addEventReceiver(BluetoothLeAudio.ACTION_LE_AUDIO_CONNECTION_STATE_CHANGED,
- deviceStateChangedReceiver);
- addEventReceiver(BluetoothLeAudio.ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED,
- deviceStateChangedReceiver);
+ adapterStateChangedIntentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
+ mContext.registerReceiverAsUser(mAdapterStateChangedReceiver, user,
+ adapterStateChangedIntentFilter, null, null);
- mContext.registerReceiverAsUser(mBroadcastReceiver, user,
- mIntentFilter, null, null);
+ IntentFilter deviceStateChangedIntentFilter = new IntentFilter();
+
+ deviceStateChangedIntentFilter.addAction(BluetoothA2dp.ACTION_ACTIVE_DEVICE_CHANGED);
+ deviceStateChangedIntentFilter.addAction(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED);
+ deviceStateChangedIntentFilter.addAction(BluetoothHearingAid.ACTION_ACTIVE_DEVICE_CHANGED);
+ deviceStateChangedIntentFilter.addAction(
+ BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED);
+ deviceStateChangedIntentFilter.addAction(
+ BluetoothLeAudio.ACTION_LE_AUDIO_CONNECTION_STATE_CHANGED);
+ deviceStateChangedIntentFilter.addAction(
+ BluetoothLeAudio.ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED);
+
+ mContext.registerReceiverAsUser(mDeviceStateChangedReceiver, user,
+ deviceStateChangedIntentFilter, null, null);
}
void stop() {
- mContext.unregisterReceiver(mBroadcastReceiver);
+ mContext.unregisterReceiver(mAdapterStateChangedReceiver);
+ mContext.unregisterReceiver(mDeviceStateChangedReceiver);
}
/**
@@ -167,11 +182,6 @@
}
}
- private void addEventReceiver(String action, BluetoothEventReceiver eventReceiver) {
- mEventReceiverMap.put(action, eventReceiver);
- mIntentFilter.addAction(action);
- }
-
private void buildBluetoothRoutes() {
mBluetoothRoutes.clear();
Set<BluetoothDevice> bondedDevices = mBluetoothAdapter.getBondedDevices();
@@ -495,26 +505,9 @@
}
}
- private class BluetoothBroadcastReceiver extends BroadcastReceiver {
+ private class AdapterStateChangedReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE, android.bluetooth.BluetoothDevice.class);
-
- BluetoothEventReceiver receiver = mEventReceiverMap.get(action);
- if (receiver != null) {
- receiver.onReceive(context, intent, device);
- }
- }
- }
-
- private interface BluetoothEventReceiver {
- void onReceive(Context context, Intent intent, BluetoothDevice device);
- }
-
- private class AdapterStateChangedReceiver implements BluetoothEventReceiver {
- @Override
- public void onReceive(Context context, Intent intent, BluetoothDevice device) {
int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
if (state == BluetoothAdapter.STATE_OFF
|| state == BluetoothAdapter.STATE_TURNING_OFF) {
@@ -529,9 +522,12 @@
}
}
- private class DeviceStateChangedReceiver implements BluetoothEventReceiver {
+ private class DeviceStateChangedReceiver extends BroadcastReceiver {
@Override
- public void onReceive(Context context, Intent intent, BluetoothDevice device) {
+ public void onReceive(Context context, Intent intent) {
+ BluetoothDevice device = intent.getParcelableExtra(
+ BluetoothDevice.EXTRA_DEVICE, android.bluetooth.BluetoothDevice.class);
+
switch (intent.getAction()) {
case BluetoothA2dp.ACTION_ACTIVE_DEVICE_CHANGED:
clearActiveRoutesWithType(MediaRoute2Info.TYPE_BLUETOOTH_A2DP);
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index 8c58e15..6edfebf 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -2852,8 +2852,8 @@
setWallpaperComponent(name, UserHandle.getCallingUserId(), FLAG_SYSTEM);
}
- private void setWallpaperComponent(ComponentName name, @SetWallpaperFlags int which,
- int userId) {
+ @VisibleForTesting
+ void setWallpaperComponent(ComponentName name, @SetWallpaperFlags int which, int userId) {
userId = ActivityManager.handleIncomingUser(getCallingPid(), getCallingUid(), userId,
false /* all */, true /* full */, "changing live wallpaper", null /* pkg */);
checkPermission(android.Manifest.permission.SET_WALLPAPER_COMPONENT);
diff --git a/services/tests/mockingservicestests/src/com/android/server/wallpaper/WallpaperManagerServiceTests.java b/services/tests/mockingservicestests/src/com/android/server/wallpaper/WallpaperManagerServiceTests.java
index 52ed3bc..c08f6bf 100644
--- a/services/tests/mockingservicestests/src/com/android/server/wallpaper/WallpaperManagerServiceTests.java
+++ b/services/tests/mockingservicestests/src/com/android/server/wallpaper/WallpaperManagerServiceTests.java
@@ -71,7 +71,6 @@
import android.util.Xml;
import android.view.Display;
-import androidx.test.filters.FlakyTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
@@ -89,6 +88,7 @@
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -110,7 +110,6 @@
* atest FrameworksMockingServicesTests:WallpaperManagerServiceTests
*/
@Presubmit
-@FlakyTest(bugId = 129797242)
@RunWith(AndroidJUnit4.class)
public class WallpaperManagerServiceTests {
@@ -273,8 +272,10 @@
/**
* Tests setWallpaperComponent and clearWallpaper should work as expected.
+ * TODO ignored since the assumption never passes. to be investigated.
*/
@Test
+ @Ignore("b/264533465")
public void testSetThenClearComponent() {
// Skip if there is no pre-defined default wallpaper component.
assumeThat(sDefaultWallpaperComponent,
@@ -285,7 +286,7 @@
verifyLastWallpaperData(testUserId, sDefaultWallpaperComponent);
verifyCurrentSystemData(testUserId);
- mService.setWallpaperComponent(sImageWallpaperComponentName);
+ mService.setWallpaperComponent(sImageWallpaperComponentName, FLAG_SYSTEM, testUserId);
verifyLastWallpaperData(testUserId, sImageWallpaperComponentName);
verifyCurrentSystemData(testUserId);
@@ -312,7 +313,7 @@
WallpaperManagerService.WallpaperConnection.DisplayConnector connector =
mService.mLastWallpaper.connection.getDisplayConnectorOrCreate(DEFAULT_DISPLAY);
- mService.setWallpaperComponent(sDefaultWallpaperComponent);
+ mService.setWallpaperComponent(sDefaultWallpaperComponent, FLAG_SYSTEM, testUserId);
verify(connector.mEngine).dispatchWallpaperCommand(
eq(COMMAND_REAPPLY), anyInt(), anyInt(), anyInt(), any());
@@ -454,7 +455,7 @@
public void testGetAdjustedWallpaperColorsOnDimming() throws RemoteException {
final int testUserId = USER_SYSTEM;
mService.switchUser(testUserId, null);
- mService.setWallpaperComponent(sDefaultWallpaperComponent);
+ mService.setWallpaperComponent(sDefaultWallpaperComponent, FLAG_SYSTEM, testUserId);
WallpaperData wallpaper = mService.getCurrentWallpaperData(FLAG_SYSTEM, testUserId);
// Mock a wallpaper data with color hints that support dark text and dark theme
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
index 9643282..13c0f17 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
@@ -251,11 +251,29 @@
@Nullable String attributionTag,
@Nullable IVoiceInteractionSessionShowCallback showCallback,
@Nullable IBinder activityToken) {
+ try {
+ if (mService != null) {
+ mService.prepareToShowSession(args, flags);
+ }
+ } catch (RemoteException e) {
+ Slog.w(TAG, "RemoteException while calling prepareToShowSession", e);
+ }
+
if (mActiveSession == null) {
mActiveSession = new VoiceInteractionSessionConnection(mServiceStub,
mSessionComponentName, mUser, mContext, this,
mInfo.getServiceInfo().applicationInfo.uid, mHandler);
}
+ if (!mActiveSession.mBound) {
+ try {
+ if (mService != null) {
+ mService.showSessionFailed();
+ }
+ } catch (RemoteException e) {
+ Slog.w(TAG, "RemoteException while calling showSessionFailed", e);
+ }
+ }
+
List<ActivityAssistInfo> allVisibleActivities =
LocalServices.getService(ActivityTaskManagerInternal.class)
.getTopVisibleActivities();