Merge "[AC] Fix NPE. If the client sends multiple unregister requests at the same time, the client request could be null before the next request is processed."
diff --git a/core/java/android/app/IUidObserver.aidl b/core/java/android/app/IUidObserver.aidl
index 0c920f1..60c2eed 100644
--- a/core/java/android/app/IUidObserver.aidl
+++ b/core/java/android/app/IUidObserver.aidl
@@ -58,8 +58,9 @@
* Report a proc oom adj change associated with a uid.
*
* @param uid The uid for which the state change is being reported.
+ * @param adj The minimum OOM adj among all processes with this uid.
*/
- void onUidProcAdjChanged(int uid);
+ void onUidProcAdjChanged(int uid, int adj);
// =============== End of transactions used on native side as well ============================
diff --git a/core/java/android/app/UidObserver.java b/core/java/android/app/UidObserver.java
index 9e92807..5196624 100644
--- a/core/java/android/app/UidObserver.java
+++ b/core/java/android/app/UidObserver.java
@@ -41,7 +41,7 @@
}
@Override
- public void onUidProcAdjChanged(int uid) {
+ public void onUidProcAdjChanged(int uid, int adj) {
}
@Override
diff --git a/core/proto/android/companion/telecom.proto b/core/proto/android/companion/telecom.proto
index 3a9e5ee..02ba7c5 100644
--- a/core/proto/android/companion/telecom.proto
+++ b/core/proto/android/companion/telecom.proto
@@ -25,7 +25,7 @@
// Next index: 6
message Call {
// UUID representing this call
- int64 id = 1;
+ string id = 1;
message Origin {
// Caller's name and/or phone number; what a user would see displayed when receiving an
@@ -48,22 +48,23 @@
}
Status status = 3;
- enum Control {
- UNKNOWN_CONTROL = 0;
- ACCEPT = 1;
- REJECT = 2;
- SILENCE = 3;
- MUTE = 4;
- UNMUTE = 5;
- END = 6;
- PUT_ON_HOLD = 7;
- TAKE_OFF_HOLD = 8;
- REJECT_AND_BLOCK = 9;
- IGNORE = 10;
- }
repeated Control controls = 4;
}
+ enum Control {
+ UNKNOWN_CONTROL = 0;
+ ACCEPT = 1;
+ REJECT = 2;
+ SILENCE = 3;
+ MUTE = 4;
+ UNMUTE = 5;
+ END = 6;
+ PUT_ON_HOLD = 7;
+ TAKE_OFF_HOLD = 8;
+ REJECT_AND_BLOCK = 9;
+ IGNORE = 10;
+ }
+
// The list of active calls.
repeated Call calls = 1;
// The list of requested calls or call changes.
diff --git a/core/tests/coretests/src/android/accessibilityservice/AccessibilityServiceTest.java b/core/tests/coretests/src/android/accessibilityservice/AccessibilityServiceTest.java
deleted file mode 100644
index 53ba140..0000000
--- a/core/tests/coretests/src/android/accessibilityservice/AccessibilityServiceTest.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.accessibilityservice;
-
-import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY;
-import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC;
-import static android.view.Display.DEFAULT_DISPLAY;
-import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
-import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
-
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.verify;
-
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.PixelFormat;
-import android.hardware.display.DisplayManager;
-import android.hardware.display.VirtualDisplay;
-import android.media.ImageReader;
-import android.os.Binder;
-import android.os.IBinder;
-import android.os.Looper;
-import android.os.RemoteException;
-import android.util.SparseArray;
-import android.view.Display;
-import android.view.View;
-import android.view.WindowManager;
-import android.view.WindowManagerGlobal;
-import android.view.accessibility.AccessibilityEvent;
-import android.window.WindowTokenClient;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.core.app.ApplicationProvider;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-/**
- * Unit tests for AccessibilityService.
- */
-@SmallTest
-@RunWith(AndroidJUnit4.class)
-public class AccessibilityServiceTest {
- private static final String TAG = "AccessibilityServiceTest";
- private static final int CONNECTION_ID = 1;
- private final WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(
- TYPE_ACCESSIBILITY_OVERLAY);
-
- private static class AccessibilityServiceTestClass extends AccessibilityService {
- private IAccessibilityServiceClient mCallback;
- private Looper mLooper;
-
- AccessibilityServiceTestClass() {
- super();
- Context context = ApplicationProvider.getApplicationContext();
- final Display display = context.getSystemService(DisplayManager.class)
- .getDisplay(DEFAULT_DISPLAY);
-
- attachBaseContext(context.createTokenContext(new WindowTokenClient(), display));
- mLooper = InstrumentationRegistry.getContext().getMainLooper();
- }
-
- public void setupCallback(IAccessibilityServiceClient callback) {
- mCallback = callback;
- }
-
- public Looper getMainLooper() {
- return mLooper;
- }
-
- public void onAccessibilityEvent(AccessibilityEvent event) { }
- public void onInterrupt() { }
-
- @Override
- public void onSystemActionsChanged() {
- try {
- if (mCallback != null) mCallback.onSystemActionsChanged();
- } catch (RemoteException e) {
- }
- }
- }
-
- private @Mock IAccessibilityServiceClient mMockClientForCallback;
- private @Mock IAccessibilityServiceConnection mMockConnection;
- private @Mock IBinder mMockIBinder;
- private IAccessibilityServiceClient mServiceInterface;
- private AccessibilityServiceTestClass mService;
- private final SparseArray<IBinder> mWindowTokens = new SparseArray<>();
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- mService = new AccessibilityServiceTestClass();
- mService.onCreate();
- mService.setupCallback(mMockClientForCallback);
- mServiceInterface = (IAccessibilityServiceClient) mService.onBind(new Intent());
- mServiceInterface.init(mMockConnection, CONNECTION_ID, mMockIBinder);
- doAnswer(invocation -> {
- Object[] args = invocation.getArguments();
- final int displayId = (int) args[0];
- final IBinder token = new Binder();
- WindowManagerGlobal.getWindowManagerService().addWindowToken(token,
- TYPE_ACCESSIBILITY_OVERLAY, displayId, null /* options */);
- mWindowTokens.put(displayId, token);
- return token;
- }).when(mMockConnection).getOverlayWindowToken(anyInt());
- }
-
- @After
- public void tearDown() throws Exception {
- for (int i = mWindowTokens.size() - 1; i >= 0; --i) {
- WindowManagerGlobal.getWindowManagerService().removeWindowToken(
- mWindowTokens.valueAt(i), mWindowTokens.keyAt(i));
- }
- }
-
- @Test
- public void testOnSystemActionsChanged() throws RemoteException {
- mServiceInterface.onSystemActionsChanged();
-
- verify(mMockClientForCallback).onSystemActionsChanged();
- }
-
- @Test
- public void testGetSystemActions() throws RemoteException {
- mService.getSystemActions();
-
- verify(mMockConnection).getSystemActions();
- }
-
- @Test
- public void testAddViewWithA11yServiceDerivedDisplayContext() throws Exception {
- try (VirtualDisplaySession session = new VirtualDisplaySession()) {
- final Context context = mService.createDisplayContext(session.getDisplay());
- InstrumentationRegistry.getInstrumentation().runOnMainSync(
- () -> context.getSystemService(WindowManager.class)
- .addView(new View(context), mParams)
- );
- }
- }
-
- @Test
- public void testAddViewWithA11yServiceDerivedWindowContext() throws Exception {
- try (VirtualDisplaySession session = new VirtualDisplaySession()) {
- final Context context = mService.createDisplayContext(session.getDisplay())
- .createWindowContext(TYPE_ACCESSIBILITY_OVERLAY, null /* options */);
- InstrumentationRegistry.getInstrumentation().runOnMainSync(
- () -> context.getSystemService(WindowManager.class)
- .addView(new View(context), mParams)
- );
- }
- }
-
- @Test
- public void testAddViewWithA11yServiceDerivedWindowContextWithDisplay() throws Exception {
- try (VirtualDisplaySession session = new VirtualDisplaySession()) {
- final Context context = mService.createWindowContext(session.getDisplay(),
- TYPE_ACCESSIBILITY_OVERLAY, null /* options */);
- InstrumentationRegistry.getInstrumentation().runOnMainSync(
- () -> context.getSystemService(WindowManager.class)
- .addView(new View(context), mParams)
- );
- }
- }
-
- @Test(expected = WindowManager.BadTokenException.class)
- public void testAddViewWithA11yServiceDerivedWindowContextWithDifferentType()
- throws Exception {
- try (VirtualDisplaySession session = new VirtualDisplaySession()) {
- final Context context = mService.createWindowContext(session.getDisplay(),
- TYPE_APPLICATION_OVERLAY, null /* options */);
- InstrumentationRegistry.getInstrumentation().runOnMainSync(
- () -> context.getSystemService(WindowManager.class)
- .addView(new View(context), mParams)
- );
- }
- }
-
-
- private static class VirtualDisplaySession implements AutoCloseable {
- private final VirtualDisplay mVirtualDisplay;
-
- VirtualDisplaySession() {
- final DisplayManager displayManager = ApplicationProvider.getApplicationContext()
- .getSystemService(DisplayManager.class);
- final int width = 800;
- final int height = 480;
- final int density = 160;
- ImageReader reader = ImageReader.newInstance(width, height, PixelFormat.RGBA_8888,
- 2 /* maxImages */);
- mVirtualDisplay = displayManager.createVirtualDisplay(
- TAG, width, height, density, reader.getSurface(),
- VIRTUAL_DISPLAY_FLAG_PUBLIC | VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY);
- }
-
- private Display getDisplay() {
- return mVirtualDisplay.getDisplay();
- }
-
- @Override
- public void close() throws Exception {
- mVirtualDisplay.release();
- }
- }
-}
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index bee7797..00cb8100 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -522,6 +522,8 @@
<permission name="android.permission.SATELLITE_COMMUNICATION"/>
<!-- Permission required for GTS test - GtsAttestationVerificationDeviceSideTestCases -->
<permission name="android.permission.USE_ATTESTATION_VERIFICATION_SERVICE" />
+ <!-- Permission required for GTS test - GtsCredentialsTestCases -->
+ <permission name="android.permission.LAUNCH_CREDENTIAL_SELECTOR"/>
</privapp-permissions>
<privapp-permissions package="com.android.statementservice">
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java
index 80e920f..28368ef 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java
@@ -189,12 +189,13 @@
static Optional<DragAndDropController> provideDragAndDropController(Context context,
ShellInit shellInit,
ShellController shellController,
+ ShellCommandHandler shellCommandHandler,
DisplayController displayController,
UiEventLogger uiEventLogger,
IconProvider iconProvider,
@ShellMainThread ShellExecutor mainExecutor) {
return Optional.ofNullable(DragAndDropController.create(context, shellInit, shellController,
- displayController, uiEventLogger, iconProvider, mainExecutor));
+ shellCommandHandler, displayController, uiEventLogger, iconProvider, mainExecutor));
}
@WMSingleton
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragAndDropController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragAndDropController.java
index 091de3a..be2489d 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragAndDropController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragAndDropController.java
@@ -35,10 +35,14 @@
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
+import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission;
+import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_DRAG_AND_DROP;
+
import android.content.ClipDescription;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.res.Configuration;
+import android.graphics.HardwareRenderer;
import android.graphics.PixelFormat;
import android.util.Slog;
import android.util.SparseArray;
@@ -50,6 +54,8 @@
import android.view.WindowManager;
import android.widget.FrameLayout;
+import androidx.annotation.BinderThread;
+import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import com.android.internal.logging.InstanceId;
@@ -58,25 +64,31 @@
import com.android.launcher3.icons.IconProvider;
import com.android.wm.shell.R;
import com.android.wm.shell.common.DisplayController;
+import com.android.wm.shell.common.ExternalInterfaceBinder;
+import com.android.wm.shell.common.RemoteCallable;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.annotations.ExternalMainThread;
import com.android.wm.shell.protolog.ShellProtoLogGroup;
import com.android.wm.shell.splitscreen.SplitScreenController;
+import com.android.wm.shell.sysui.ShellCommandHandler;
import com.android.wm.shell.sysui.ShellController;
import com.android.wm.shell.sysui.ShellInit;
+import java.io.PrintWriter;
import java.util.ArrayList;
/**
* Handles the global drag and drop handling for the Shell.
*/
-public class DragAndDropController implements DisplayController.OnDisplaysChangedListener,
+public class DragAndDropController implements RemoteCallable<DragAndDropController>,
+ DisplayController.OnDisplaysChangedListener,
View.OnDragListener, ComponentCallbacks2 {
private static final String TAG = DragAndDropController.class.getSimpleName();
private final Context mContext;
private final ShellController mShellController;
+ private final ShellCommandHandler mShellCommandHandler;
private final DisplayController mDisplayController;
private final DragAndDropEventLogger mLogger;
private final IconProvider mIconProvider;
@@ -100,6 +112,7 @@
public static DragAndDropController create(Context context,
ShellInit shellInit,
ShellController shellController,
+ ShellCommandHandler shellCommandHandler,
DisplayController displayController,
UiEventLogger uiEventLogger,
IconProvider iconProvider,
@@ -107,19 +120,21 @@
if (!context.getResources().getBoolean(R.bool.config_enableShellDragDrop)) {
return null;
}
- return new DragAndDropController(context, shellInit, shellController, displayController,
- uiEventLogger, iconProvider, mainExecutor);
+ return new DragAndDropController(context, shellInit, shellController, shellCommandHandler,
+ displayController, uiEventLogger, iconProvider, mainExecutor);
}
DragAndDropController(Context context,
ShellInit shellInit,
ShellController shellController,
+ ShellCommandHandler shellCommandHandler,
DisplayController displayController,
UiEventLogger uiEventLogger,
IconProvider iconProvider,
ShellExecutor mainExecutor) {
mContext = context;
mShellController = shellController;
+ mShellCommandHandler = shellCommandHandler;
mDisplayController = displayController;
mLogger = new DragAndDropEventLogger(uiEventLogger);
mIconProvider = iconProvider;
@@ -137,6 +152,23 @@
mMainExecutor.executeDelayed(() -> {
mDisplayController.addDisplayWindowListener(this);
}, 0);
+ mShellController.addExternalInterface(KEY_EXTRA_SHELL_DRAG_AND_DROP,
+ this::createExternalInterface, this);
+ mShellCommandHandler.addDumpCallback(this::dump, this);
+ }
+
+ private ExternalInterfaceBinder createExternalInterface() {
+ return new IDragAndDropImpl(this);
+ }
+
+ @Override
+ public Context getContext() {
+ return mContext;
+ }
+
+ @Override
+ public ShellExecutor getRemoteCallExecutor() {
+ return mMainExecutor;
}
/**
@@ -156,7 +188,7 @@
mListeners.remove(listener);
}
- private void notifyListeners() {
+ private void notifyDragStarted() {
for (int i = 0; i < mListeners.size(); i++) {
mListeners.get(i).onDragStarted();
}
@@ -273,7 +305,7 @@
pd.dragLayout.prepare(mDisplayController.getDisplayLayout(displayId),
event.getClipData(), loggerSessionId);
setDropTargetWindowVisibility(pd, View.VISIBLE);
- notifyListeners();
+ notifyDragStarted();
break;
case ACTION_DRAG_ENTERED:
pd.dragLayout.show();
@@ -327,13 +359,7 @@
}
private void setDropTargetWindowVisibility(PerDisplay pd, int visibility) {
- ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DRAG_AND_DROP,
- "Set drop target window visibility: displayId=%d visibility=%d",
- pd.displayId, visibility);
- pd.rootView.setVisibility(visibility);
- if (visibility == View.VISIBLE) {
- pd.rootView.requestApplyInsets();
- }
+ pd.setWindowVisibility(visibility);
}
private String getMimeTypes(ClipDescription description) {
@@ -347,6 +373,18 @@
return mimeTypes;
}
+ /**
+ * Returns if any displays are currently ready to handle a drag/drop.
+ */
+ private boolean isReadyToHandleDrag() {
+ for (int i = 0; i < mDisplayDropTargets.size(); i++) {
+ if (mDisplayDropTargets.valueAt(i).mHasDrawn) {
+ return true;
+ }
+ }
+ return false;
+ }
+
// Note: Component callbacks are always called on the main thread of the process
@ExternalMainThread
@Override
@@ -372,12 +410,53 @@
// Do nothing
}
- private static class PerDisplay {
+ /**
+ * Dumps information about this controller.
+ */
+ public void dump(@NonNull PrintWriter pw, String prefix) {
+ pw.println(prefix + TAG);
+ pw.println(prefix + " listeners=" + mListeners.size());
+ }
+
+ /**
+ * The interface for calls from outside the host process.
+ */
+ @BinderThread
+ private static class IDragAndDropImpl extends IDragAndDrop.Stub
+ implements ExternalInterfaceBinder {
+ private DragAndDropController mController;
+
+ public IDragAndDropImpl(DragAndDropController controller) {
+ mController = controller;
+ }
+
+ /**
+ * Invalidates this instance, preventing future calls from updating the controller.
+ */
+ @Override
+ public void invalidate() {
+ mController = null;
+ }
+
+ @Override
+ public boolean isReadyToHandleDrag() {
+ boolean[] result = new boolean[1];
+ executeRemoteCallWithTaskPermission(mController, "isReadyToHandleDrag",
+ controller -> result[0] = controller.isReadyToHandleDrag(),
+ true /* blocking */
+ );
+ return result[0];
+ }
+ }
+
+ private static class PerDisplay implements HardwareRenderer.FrameDrawingCallback {
final int displayId;
final Context context;
final WindowManager wm;
final FrameLayout rootView;
final DragLayout dragLayout;
+ // Tracks whether the window has fully drawn since it was last made visible
+ boolean mHasDrawn;
boolean isHandlingDrag;
// A count of the number of active drags in progress to ensure that we only hide the window
@@ -391,5 +470,25 @@
rootView = rv;
dragLayout = dl;
}
+
+ private void setWindowVisibility(int visibility) {
+ ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DRAG_AND_DROP,
+ "Set drop target window visibility: displayId=%d visibility=%d",
+ displayId, visibility);
+ rootView.setVisibility(visibility);
+ if (visibility == View.VISIBLE) {
+ rootView.requestApplyInsets();
+ if (!mHasDrawn && rootView.getViewRootImpl() != null) {
+ rootView.getViewRootImpl().registerRtFrameCallback(this);
+ }
+ } else {
+ mHasDrawn = false;
+ }
+ }
+
+ @Override
+ public void onFrameDraw(long frame) {
+ mHasDrawn = true;
+ }
}
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/IDragAndDrop.aidl b/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/IDragAndDrop.aidl
new file mode 100644
index 0000000..aeb0c63
--- /dev/null
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/IDragAndDrop.aidl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2023 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.wm.shell.draganddrop;
+
+/**
+ * Interface that is exposed to remote callers to manipulate drag and drop.
+ */
+interface IDragAndDrop {
+ /**
+ * Returns whether the shell drop target is showing and will handle a drag/drop.
+ */
+ boolean isReadyToHandleDrag() = 1;
+}
+// Last id = 1
\ No newline at end of file
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/sysui/ShellSharedConstants.java b/libs/WindowManager/Shell/src/com/android/wm/shell/sysui/ShellSharedConstants.java
index bfa6390..5f54f58 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/sysui/ShellSharedConstants.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/sysui/ShellSharedConstants.java
@@ -42,4 +42,6 @@
public static final String KEY_EXTRA_SHELL_FLOATING_TASKS = "extra_shell_floating_tasks";
// See IDesktopMode.aidl
public static final String KEY_EXTRA_SHELL_DESKTOP_MODE = "extra_shell_desktop_mode";
+ // See IDragAndDrop.aidl
+ public static final String KEY_EXTRA_SHELL_DRAG_AND_DROP = "extra_shell_drag_and_drop";
}
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/draganddrop/DragAndDropControllerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/draganddrop/DragAndDropControllerTest.java
index 523cb66..54f36f6 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/draganddrop/DragAndDropControllerTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/draganddrop/DragAndDropControllerTest.java
@@ -48,6 +48,7 @@
import com.android.wm.shell.ShellTestCase;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.ShellExecutor;
+import com.android.wm.shell.sysui.ShellCommandHandler;
import com.android.wm.shell.sysui.ShellController;
import com.android.wm.shell.sysui.ShellInit;
@@ -71,6 +72,8 @@
@Mock
private ShellController mShellController;
@Mock
+ private ShellCommandHandler mShellCommandHandler;
+ @Mock
private DisplayController mDisplayController;
@Mock
private UiEventLogger mUiEventLogger;
@@ -89,7 +92,8 @@
public void setUp() throws RemoteException {
MockitoAnnotations.initMocks(this);
mController = new DragAndDropController(mContext, mShellInit, mShellController,
- mDisplayController, mUiEventLogger, mIconProvider, mMainExecutor);
+ mShellCommandHandler, mDisplayController, mUiEventLogger, mIconProvider,
+ mMainExecutor);
mController.onInit();
}
diff --git a/libs/hwui/pipeline/skia/StretchMask.cpp b/libs/hwui/pipeline/skia/StretchMask.cpp
index cad3703..1676787 100644
--- a/libs/hwui/pipeline/skia/StretchMask.cpp
+++ b/libs/hwui/pipeline/skia/StretchMask.cpp
@@ -18,14 +18,13 @@
#include "SkBlendMode.h"
#include "SkCanvas.h"
#include "SkSurface.h"
-#include "include/gpu/GpuTypes.h" // from Skia
#include "TransformCanvas.h"
#include "SkiaDisplayList.h"
using android::uirenderer::StretchMask;
-void StretchMask::draw(GrRecordingContext* context,
+void StretchMask::draw(GrRecordingContext*,
const StretchEffect& stretch,
const SkRect& bounds,
skiapipeline::SkiaDisplayList* displayList,
@@ -35,16 +34,14 @@
if (mMaskSurface == nullptr || mMaskSurface->width() != width ||
mMaskSurface->height() != height) {
// Create a new surface if we don't have one or our existing size does
- // not match.
- mMaskSurface = SkSurface::MakeRenderTarget(
- context,
- skgpu::Budgeted::kYes,
- SkImageInfo::Make(
- width,
- height,
- SkColorType::kAlpha_8_SkColorType,
- SkAlphaType::kPremul_SkAlphaType)
- );
+ // not match. SkCanvas::makeSurface returns a new surface that will
+ // be GPU-backed if canvas was also.
+ mMaskSurface = canvas->makeSurface(SkImageInfo::Make(
+ width,
+ height,
+ SkColorType::kAlpha_8_SkColorType,
+ SkAlphaType::kPremul_SkAlphaType
+ ));
mIsDirty = true;
}
@@ -53,7 +50,7 @@
// Make sure to apply target transformation to the mask canvas
// to ensure the replayed drawing commands generate the same result
auto previousMatrix = displayList->mParentMatrix;
- displayList->mParentMatrix = maskCanvas->getTotalMatrix();
+ displayList->mParentMatrix = maskCanvas->getLocalToDeviceAs3x3();
maskCanvas->save();
maskCanvas->drawColor(0, SkBlendMode::kClear);
TransformCanvas transformCanvas(maskCanvas, SkBlendMode::kSrcOver);
diff --git a/libs/hwui/renderthread/CacheManager.cpp b/libs/hwui/renderthread/CacheManager.cpp
index 7e9d44f..c00a270 100644
--- a/libs/hwui/renderthread/CacheManager.cpp
+++ b/libs/hwui/renderthread/CacheManager.cpp
@@ -29,6 +29,7 @@
#include "Layer.h"
#include "Properties.h"
#include "RenderThread.h"
+#include "VulkanManager.h"
#include "pipeline/skia/ATraceMemoryDump.h"
#include "pipeline/skia/ShaderCache.h"
#include "pipeline/skia/SkiaMemoryTracer.h"
@@ -182,8 +183,14 @@
}
log.appendFormat("Contexts: %zu (stopped = %zu)\n", mCanvasContexts.size(), stoppedContexts);
+ auto vkInstance = VulkanManager::peekInstance();
if (!mGrContext) {
- log.appendFormat("No GPU context.\n");
+ if (!vkInstance) {
+ log.appendFormat("No GPU context.\n");
+ } else {
+ log.appendFormat("No GrContext; however %d remaining Vulkan refs",
+ vkInstance->getStrongCount() - 1);
+ }
return;
}
std::vector<skiapipeline::ResourcePair> cpuResourceMap = {
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp
index f198bca..4cffc6c 100644
--- a/libs/hwui/renderthread/VulkanManager.cpp
+++ b/libs/hwui/renderthread/VulkanManager.cpp
@@ -107,11 +107,11 @@
#define GET_INST_PROC(F) m##F = (PFN_vk##F)vkGetInstanceProcAddr(mInstance, "vk" #F)
#define GET_DEV_PROC(F) m##F = (PFN_vk##F)vkGetDeviceProcAddr(mDevice, "vk" #F)
-sp<VulkanManager> VulkanManager::getInstance() {
- // cache a weakptr to the context to enable a second thread to share the same vulkan state
- static wp<VulkanManager> sWeakInstance = nullptr;
- static std::mutex sLock;
+// cache a weakptr to the context to enable a second thread to share the same vulkan state
+static wp<VulkanManager> sWeakInstance = nullptr;
+static std::mutex sLock;
+sp<VulkanManager> VulkanManager::getInstance() {
std::lock_guard _lock{sLock};
sp<VulkanManager> vulkanManager = sWeakInstance.promote();
if (!vulkanManager.get()) {
@@ -122,6 +122,11 @@
return vulkanManager;
}
+sp<VulkanManager> VulkanManager::peekInstance() {
+ std::lock_guard _lock{sLock};
+ return sWeakInstance.promote();
+}
+
VulkanManager::~VulkanManager() {
if (mDevice != VK_NULL_HANDLE) {
mDeviceWaitIdle(mDevice);
@@ -404,9 +409,13 @@
}
}
-sk_sp<GrDirectContext> VulkanManager::createContext(const GrContextOptions& options,
- ContextType contextType) {
+static void onGrContextReleased(void* context) {
+ VulkanManager* manager = (VulkanManager*)context;
+ manager->decStrong((void*)onGrContextReleased);
+}
+sk_sp<GrDirectContext> VulkanManager::createContext(GrContextOptions& options,
+ ContextType contextType) {
GrVkBackendContext backendContext;
backendContext.fInstance = mInstance;
backendContext.fPhysicalDevice = mPhysicalDevice;
@@ -418,6 +427,11 @@
backendContext.fDeviceFeatures2 = &mPhysicalDeviceFeatures2;
backendContext.fGetProc = sSkiaGetProp;
+ LOG_ALWAYS_FATAL_IF(options.fContextDeleteProc != nullptr, "Conflicting fContextDeleteProcs!");
+ this->incStrong((void*)onGrContextReleased);
+ options.fContextDeleteContext = this;
+ options.fContextDeleteProc = onGrContextReleased;
+
return GrDirectContext::MakeVulkan(backendContext, options);
}
diff --git a/libs/hwui/renderthread/VulkanManager.h b/libs/hwui/renderthread/VulkanManager.h
index c5196ee..00a40c0 100644
--- a/libs/hwui/renderthread/VulkanManager.h
+++ b/libs/hwui/renderthread/VulkanManager.h
@@ -66,6 +66,7 @@
class VulkanManager final : public RefBase {
public:
static sp<VulkanManager> getInstance();
+ static sp<VulkanManager> peekInstance();
// Sets up the vulkan context that is shared amonst all clients of the VulkanManager. This must
// be call once before use of the VulkanManager. Multiple calls after the first will simiply
@@ -109,7 +110,7 @@
};
// returns a Skia graphic context used to draw content on the specified thread
- sk_sp<GrDirectContext> createContext(const GrContextOptions& options,
+ sk_sp<GrDirectContext> createContext(GrContextOptions& options,
ContextType contextType = ContextType::kRenderThread);
uint32_t getDriverVersion() const { return mDriverVersion; }
diff --git a/media/java/android/media/projection/IMediaProjection.aidl b/media/java/android/media/projection/IMediaProjection.aidl
index e3829e6..388b2c5 100644
--- a/media/java/android/media/projection/IMediaProjection.aidl
+++ b/media/java/android/media/projection/IMediaProjection.aidl
@@ -28,6 +28,7 @@
boolean canProjectVideo();
boolean canProjectSecureVideo();
+ @EnforcePermission("MANAGE_MEDIA_PROJECTION")
@JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
+ ".permission.MANAGE_MEDIA_PROJECTION)")
int applyVirtualDisplayFlags(int flags);
@@ -40,6 +41,7 @@
* Returns the {@link android.os.IBinder} identifying the task to record, or {@code null} if
* there is none.
*/
+ @EnforcePermission("MANAGE_MEDIA_PROJECTION")
@JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
+ ".permission.MANAGE_MEDIA_PROJECTION)")
IBinder getLaunchCookie();
@@ -48,6 +50,7 @@
* Updates the {@link android.os.IBinder} identifying the task to record, or {@code null} if
* there is none.
*/
+ @EnforcePermission("MANAGE_MEDIA_PROJECTION")
@JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
+ ".permission.MANAGE_MEDIA_PROJECTION)")
void setLaunchCookie(in IBinder launchCookie);
@@ -62,6 +65,7 @@
* @throws IllegalStateException If the caller's target SDK is at least {@code U} and the
* projection is not valid.
*/
+ @EnforcePermission("MANAGE_MEDIA_PROJECTION")
@JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
+ ".permission.MANAGE_MEDIA_PROJECTION)")
boolean isValid();
@@ -70,6 +74,7 @@
* Sets that {@link MediaProjection#createVirtualDisplay} has been invoked with this token (it
* should only be called once).
*/
+ @EnforcePermission("MANAGE_MEDIA_PROJECTION")
@JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
+ ".permission.MANAGE_MEDIA_PROJECTION)")
void notifyVirtualDisplayCreated(int displayId);
diff --git a/media/java/android/media/projection/IMediaProjectionManager.aidl b/media/java/android/media/projection/IMediaProjectionManager.aidl
index a3cd623..304eecb 100644
--- a/media/java/android/media/projection/IMediaProjectionManager.aidl
+++ b/media/java/android/media/projection/IMediaProjectionManager.aidl
@@ -67,6 +67,7 @@
* Returns {@code true} if the given {@link IMediaProjection} corresponds to the current
* projection, or {@code false} otherwise.
*/
+ @EnforcePermission("MANAGE_MEDIA_PROJECTION")
@JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
+ ".permission.MANAGE_MEDIA_PROJECTION)")
boolean isCurrentProjection(IMediaProjection projection);
@@ -83,6 +84,7 @@
*
* <p>Returns immediately but waits to start recording until user has reviewed their consent.
*/
+ @EnforcePermission("MANAGE_MEDIA_PROJECTION")
@JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
+ ".permission.MANAGE_MEDIA_PROJECTION)")
void requestConsentForInvalidProjection(in IMediaProjection projection);
@@ -91,14 +93,17 @@
+ ".permission.MANAGE_MEDIA_PROJECTION)")
MediaProjectionInfo getActiveProjectionInfo();
+ @EnforcePermission("MANAGE_MEDIA_PROJECTION")
@JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
+ ".permission.MANAGE_MEDIA_PROJECTION)")
void stopActiveProjection();
+ @EnforcePermission("MANAGE_MEDIA_PROJECTION")
@JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
+ ".permission.MANAGE_MEDIA_PROJECTION)")
void notifyActiveProjectionCapturedContentResized(int width, int height);
+ @EnforcePermission("MANAGE_MEDIA_PROJECTION")
@JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
+ ".permission.MANAGE_MEDIA_PROJECTION)")
void notifyActiveProjectionCapturedContentVisibilityChanged(boolean isVisible);
@@ -123,6 +128,7 @@
* @param projection the non-null projection the session describes
* @throws SecurityException If the provided projection is not current.
*/
+ @EnforcePermission("MANAGE_MEDIA_PROJECTION")
@JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
+ ".permission.MANAGE_MEDIA_PROJECTION)")
boolean setContentRecordingSession(in ContentRecordingSession incomingSession,
diff --git a/native/android/activity_manager.cpp b/native/android/activity_manager.cpp
index 155a355..bc6a84f 100644
--- a/native/android/activity_manager.cpp
+++ b/native/android/activity_manager.cpp
@@ -45,7 +45,7 @@
void onUidIdle(uid_t uid, bool disabled) override;
void onUidStateChanged(uid_t uid, int32_t procState, int64_t procStateSeq,
int32_t capability) override;
- void onUidProcAdjChanged(uid_t uid) override;
+ void onUidProcAdjChanged(uid_t uid, int32_t adj) override;
// IBinder::DeathRecipient implementation
void binderDied(const wp<IBinder>& who) override;
@@ -121,7 +121,7 @@
void UidObserver::onUidIdle(uid_t uid __unused, bool disabled __unused) {}
-void UidObserver::onUidProcAdjChanged(uid_t uid __unused) {}
+void UidObserver::onUidProcAdjChanged(uid_t uid __unused, int32_t adj __unused) {}
void UidObserver::onUidStateChanged(uid_t uid, int32_t procState,
int64_t procStateSeq __unused,
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index d3a9e91..0978cfd 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -3062,7 +3062,7 @@
Settings.System.APPLY_RAMPING_RINGER,
SystemSettingsProto.APPLY_RAMPING_RINGER);
- // Please insert new settings using the same order as in SecureSettingsProto.
+ // Please insert new settings using the same order as in SystemSettingsProto.
// The rest of the settings were moved to Settings.Secure, and are thus excluded here since
// they're deprecated from Settings.System.
@@ -3100,8 +3100,8 @@
// The rest of the settings were moved to Settings.Secure, and are thus excluded here since
// they're deprecated from Settings.System.
- // Please insert new settings using the same order as in SecureSettingsProto.
+ // Please insert new settings using the same order as in SystemSettingsProto.
p.end(token);
- // Please insert new settings using the same order as in SecureSettingsProto.
+ // Please insert new settings using the same order as in SystemSettingsProto.
}
}
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index 7d112f9..1515798 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -125,7 +125,7 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
- <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE"/>
+ <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<!-- BLUETOOTH_PRIVILEGED is needed for testing purposes only. -->
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
@@ -136,7 +136,7 @@
<uses-permission android:name="android.permission.MANAGE_NETWORK_POLICY" />
<uses-permission android:name="android.permission.MANAGE_USB" />
<uses-permission android:name="android.permission.USE_RESERVED_DISK" />
- <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- System tool permissions granted to the shell. -->
<uses-permission android:name="android.permission.REAL_GET_TASKS" />
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
@@ -231,16 +231,16 @@
<uses-permission android:name="android.permission.FORCE_DEVICE_POLICY_MANAGER_LOGS" />
<uses-permission android:name="android.permission.CLEAR_FREEZE_PERIOD" />
<uses-permission android:name="android.permission.MODIFY_QUIET_MODE" />
- <uses-permission android:name="android.permission.ACCESS_LOWPAN_STATE"/>
- <uses-permission android:name="android.permission.CHANGE_LOWPAN_STATE"/>
- <uses-permission android:name="android.permission.READ_LOWPAN_CREDENTIAL"/>
+ <uses-permission android:name="android.permission.ACCESS_LOWPAN_STATE" />
+ <uses-permission android:name="android.permission.CHANGE_LOWPAN_STATE" />
+ <uses-permission android:name="android.permission.READ_LOWPAN_CREDENTIAL" />
<uses-permission android:name="android.permission.BLUETOOTH_STACK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.RETRIEVE_WINDOW_TOKEN" />
<uses-permission android:name="android.permission.FRAME_STATS" />
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
<uses-permission android:name="android.permission.UPDATE_APP_OPS_STATS" />
- <uses-permission android:name="android.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS"/>
+ <uses-permission android:name="android.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS" />
<uses-permission android:name="android.permission.CHANGE_APP_IDLE_STATE" />
<uses-permission android:name="android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
@@ -304,7 +304,7 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.BACKGROUND_CAMERA" />
<uses-permission android:name="android.permission.SYSTEM_CAMERA" />
- <!-- Permissions needed to test onCameraOpened/Closed callbacks -->
+ <!-- Permissions needed to test onCameraOpened/Closed callbacks -->
<uses-permission android:name="android.permission.CAMERA_OPEN_CLOSE_LISTENER" />
<!-- Permissions needed for CTS camera test: RecordingTest.java when assuming shell id -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
@@ -344,7 +344,7 @@
<uses-permission android:name="android.permission.LOADER_USAGE_STATS" />
<!-- Permission required for storage tests - FuseDaemonHostTest -->
- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<!-- Permission needed to run network tests in CTS -->
<uses-permission android:name="android.permission.MANAGE_TEST_NETWORKS" />
@@ -386,54 +386,54 @@
<uses-permission android:name="android.permission.BIND_EXPLICIT_HEALTH_CHECK_SERVICE" />
<!-- Permission required for CTS test - CrossProfileAppsHostSideTest -->
- <uses-permission android:name="android.permission.INTERACT_ACROSS_PROFILES"/>
+ <uses-permission android:name="android.permission.INTERACT_ACROSS_PROFILES" />
<!-- Permission required for CTS test - CrossProfileAppsHostSideTest -->
- <uses-permission android:name="android.permission.START_CROSS_PROFILE_ACTIVITIES"/>
+ <uses-permission android:name="android.permission.START_CROSS_PROFILE_ACTIVITIES" />
<!-- permissions required for CTS test - PhoneStateListenerTest -->
<uses-permission android:name="android.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH" />
<!-- Permissions required for granting and logging -->
- <uses-permission android:name="android.permission.LOG_COMPAT_CHANGE"/>
- <uses-permission android:name="android.permission.READ_COMPAT_CHANGE_CONFIG"/>
- <uses-permission android:name="android.permission.OVERRIDE_COMPAT_CHANGE_CONFIG"/>
- <uses-permission android:name="android.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD"/>
+ <uses-permission android:name="android.permission.LOG_COMPAT_CHANGE" />
+ <uses-permission android:name="android.permission.READ_COMPAT_CHANGE_CONFIG" />
+ <uses-permission android:name="android.permission.OVERRIDE_COMPAT_CHANGE_CONFIG" />
+ <uses-permission android:name="android.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD" />
<!-- Permission required for CTS test - BatterySaverTest -->
- <uses-permission android:name="android.permission.MODIFY_DAY_NIGHT_MODE"/>
+ <uses-permission android:name="android.permission.MODIFY_DAY_NIGHT_MODE" />
<!-- Permission required for CTS test - UiModeManagerTest -->
- <uses-permission android:name="android.permission.ENTER_CAR_MODE_PRIORITIZED"/>
- <uses-permission android:name="android.permission.READ_PROJECTION_STATE"/>
+ <uses-permission android:name="android.permission.ENTER_CAR_MODE_PRIORITIZED" />
+ <uses-permission android:name="android.permission.READ_PROJECTION_STATE" />
<!-- Permission required for CTS tests - UiModeManagerTest, CarModeInCallServiceTest -->
- <uses-permission android:name="android.permission.TOGGLE_AUTOMOTIVE_PROJECTION"/>
+ <uses-permission android:name="android.permission.TOGGLE_AUTOMOTIVE_PROJECTION" />
<!-- Permission required for CTS test - SystemConfigTest -->
- <uses-permission android:name="android.permission.READ_CARRIER_APP_INFO"/>
+ <uses-permission android:name="android.permission.READ_CARRIER_APP_INFO" />
<!-- Permission required for CTS test - CarModeInCallServiceTest -->
- <uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE"/>
+ <uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE" />
<!-- Permission requried for CTS test - CellBroadcastIntentsTest -->
- <uses-permission android:name="android.permission.GRANT_RUNTIME_PERMISSIONS_TO_TELEPHONY_DEFAULTS"/>
+ <uses-permission android:name="android.permission.GRANT_RUNTIME_PERMISSIONS_TO_TELEPHONY_DEFAULTS" />
<!-- Permission required for CTS test - TetheringManagerTest -->
- <uses-permission android:name="android.permission.TETHER_PRIVILEGED"/>
+ <uses-permission android:name="android.permission.TETHER_PRIVILEGED" />
<!-- Permission required for CTS test - CtsOsTestCases -->
- <uses-permission android:name="android.permission.MANAGE_CRATES"/>
+ <uses-permission android:name="android.permission.MANAGE_CRATES" />
<!-- Allows setting brightness from the shell -->
- <uses-permission android:name="android.permission.CONTROL_DISPLAY_BRIGHTNESS"/>
+ <uses-permission android:name="android.permission.CONTROL_DISPLAY_BRIGHTNESS" />
<!-- Permission required for CTS test - ShortcutManagerUsageTest -->
- <uses-permission android:name="android.permission.ACCESS_SHORTCUTS"/>
+ <uses-permission android:name="android.permission.ACCESS_SHORTCUTS" />
<!-- Permissions required for CTS test - UsageStatsTest -->
- <uses-permission android:name="android.permission.MANAGE_NOTIFICATIONS"/>
- <uses-permission android:name="android.permission.ACCESS_LOCUS_ID_USAGE_STATS"/>
+ <uses-permission android:name="android.permission.MANAGE_NOTIFICATIONS" />
+ <uses-permission android:name="android.permission.ACCESS_LOCUS_ID_USAGE_STATS" />
<!-- Permission needed for CTS test - MusicRecognitionManagerTest -->
<uses-permission android:name="android.permission.MANAGE_MUSIC_RECOGNITION" />
@@ -442,8 +442,8 @@
<uses-permission android:name="android.permission.MANAGE_SPEECH_RECOGNITION" />
<!-- Permissions required to test ambient display. -->
- <uses-permission android:name="android.permission.READ_DREAM_STATE"/>
- <uses-permission android:name="android.permission.WRITE_DREAM_STATE"/>
+ <uses-permission android:name="android.permission.READ_DREAM_STATE" />
+ <uses-permission android:name="android.permission.WRITE_DREAM_STATE" />
<!-- Permission required for CTS test - CtsLightsManagerTest -->
<uses-permission android:name="android.permission.CONTROL_DEVICE_LIGHTS" />
@@ -470,7 +470,7 @@
<uses-permission android:name="android.permission.MODIFY_SETTINGS_OVERRIDEABLE_BY_RESTORE" />
<!-- Permission required for testing system audio effect APIs. -->
- <uses-permission android:name="android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS"/>
+ <uses-permission android:name="android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS" />
<!-- Permission required for running networking unit tests -->
<uses-permission android:name="android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS" />
@@ -495,7 +495,7 @@
<uses-permission android:name="android.permission.TV_INPUT_HARDWARE" />
<uses-permission android:name="android.permission.TIS_EXTENSION_INTERFACE" />
<uses-permission android:name="com.android.providers.tv.permission.ACCESS_WATCHED_PROGRAMS" />
- <uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA"/>
+ <uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" />
<!-- Permission needed for CTS test - PrivilegedLocationPermissionTest -->
<uses-permission android:name="android.permission.LOCATION_HARDWARE" />
@@ -560,14 +560,14 @@
<uses-permission android:name="android.permission.BIND_CARRIER_SERVICES" />
<!-- Allows overriding the system's device state from the shell -->
- <uses-permission android:name="android.permission.CONTROL_DEVICE_STATE"/>
+ <uses-permission android:name="android.permission.CONTROL_DEVICE_STATE" />
<!-- Permissions required for CTS tests to close system dialogs -->
<uses-permission android:name="android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS" />
<!-- Permissions required for CTS test - HideOverlayWindowsTest -->
- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
- <uses-permission android:name="android.permission.SYSTEM_APPLICATION_OVERLAY"/>
+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+ <uses-permission android:name="android.permission.SYSTEM_APPLICATION_OVERLAY" />
<!-- Permission required for CTS test - CtsHdmiCecHostTestCases -->
<uses-permission android:name="android.permission.HDMI_CEC" />
@@ -630,21 +630,21 @@
<uses-permission android:name="android.permission.UPDATE_FONTS" />
<!-- Permission required for Launcher testing - DigitalWellbeingToastTest -->
- <uses-permission android:name="android.permission.GET_TOP_ACTIVITY_INFO"/>
+ <uses-permission android:name="android.permission.GET_TOP_ACTIVITY_INFO" />
<!-- Permission required for hotword detection service CTS tests -->
<uses-permission android:name="android.permission.MANAGE_HOTWORD_DETECTION" />
<uses-permission android:name="android.permission.BIND_HOTWORD_DETECTION_SERVICE" />
<!-- Permission required for CTS test - CtsVoiceInteractionTestCases -->
- <uses-permission android:name="android.permission.SOUND_TRIGGER_RUN_IN_BATTERY_SAVER"/>
+ <uses-permission android:name="android.permission.SOUND_TRIGGER_RUN_IN_BATTERY_SAVER" />
<uses-permission android:name="android.permission.BIND_VISUAL_QUERY_DETECTION_SERVICE" />
<!-- Permission required for CTS test - KeyguardLockedStateApiTest -->
<uses-permission android:name="android.permission.SUBSCRIBE_TO_KEYGUARD_LOCKED_STATE" />
- <uses-permission android:name="android.permission.MANAGE_APP_HIBERNATION"/>
+ <uses-permission android:name="android.permission.MANAGE_APP_HIBERNATION" />
<!-- Permission required for CTS test - MediaCodecResourceTest -->
<uses-permission android:name="android.permission.MEDIA_RESOURCE_OVERRIDE_PID" />
@@ -820,8 +820,8 @@
<uses-permission android:name="android.permission.DELETE_STAGED_HEALTH_CONNECT_REMOTE_DATA" />
<uses-permission android:name="android.permission.STAGE_HEALTH_CONNECT_REMOTE_DATA" />
- <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SYSTEM_EXEMPTED"/>
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SYSTEM_EXEMPTED" />
<!-- Permissions required for CTS test - CtsBroadcastRadioTestCases -->
<uses-permission android:name="android.permission.ACCESS_BROADCAST_RADIO" />
@@ -832,7 +832,7 @@
<!-- Permission required for CTS test - CtsTelephonyProviderTestCases -->
<uses-permission android:name="android.permission.WRITE_APN_SETTINGS" />
- <uses-permission android:name="android.permission.LOG_FOREGROUND_RESOURCE_USE"/>
+ <uses-permission android:name="android.permission.LOG_FOREGROUND_RESOURCE_USE" />
<!-- Permission required for CTS test - CtsPackageInstallTestCases -->
<uses-permission android:name="android.permission.READ_INSTALLED_SESSION_PATHS" />
@@ -840,10 +840,14 @@
<!-- Permission required for GTS test - GtsAttestationVerificationDeviceSideTestCases -->
<uses-permission android:name="android.permission.USE_ATTESTATION_VERIFICATION_SERVICE" />
- <application android:label="@string/app_label"
- android:theme="@android:style/Theme.DeviceDefault.DayNight"
- android:defaultToDeviceProtectedStorage="true"
- android:directBootAware="true">
+ <!-- Permission required for GTS test - GtsCredentialsTestCases -->
+ <uses-permission android:name="android.permission.LAUNCH_CREDENTIAL_SELECTOR" />
+
+ <application
+ android:label="@string/app_label"
+ android:theme="@android:style/Theme.DeviceDefault.DayNight"
+ android:defaultToDeviceProtectedStorage="true"
+ android:directBootAware="true">
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.android.shell"
@@ -866,10 +870,11 @@
</intent-filter>
</provider>
- <provider android:name=".HeapDumpProvider"
- android:authorities="com.android.shell.heapdump"
- android:grantUriPermissions="true"
- android:exported="false" />
+ <provider
+ android:name=".HeapDumpProvider"
+ android:authorities="com.android.shell.heapdump"
+ android:grantUriPermissions="true"
+ android:exported="false" />
<activity
android:name=".BugreportWarningActivity"
@@ -878,13 +883,14 @@
android:excludeFromRecents="true"
android:exported="false" />
- <activity android:name=".HeapDumpActivity"
- android:theme="@*android:style/Theme.Translucent.NoTitleBar"
- android:label="@*android:string/dump_heap_title"
- android:finishOnCloseSystemDialogs="true"
- android:noHistory="true"
- android:excludeFromRecents="true"
- android:exported="false" />
+ <activity
+ android:name=".HeapDumpActivity"
+ android:theme="@*android:style/Theme.Translucent.NoTitleBar"
+ android:label="@*android:string/dump_heap_title"
+ android:finishOnCloseSystemDialogs="true"
+ android:noHistory="true"
+ android:excludeFromRecents="true"
+ android:exported="false" />
<receiver
android:name=".BugreportRequestedReceiver"
@@ -909,7 +915,7 @@
<receiver
android:name=".ProfcollectUploadReceiver"
android:exported="true"
- android:permission="android.permission.TRIGGER_SHELL_PROFCOLLECT_UPLOAD" >
+ android:permission="android.permission.TRIGGER_SHELL_PROFCOLLECT_UPLOAD">
<intent-filter>
<action android:name="com.android.shell.action.PROFCOLLECT_UPLOAD" />
</intent-filter>
@@ -918,6 +924,6 @@
<service
android:name=".BugreportProgressService"
android:foregroundServiceType="systemExempted"
- android:exported="false"/>
+ android:exported="false" />
</application>
</manifest>
diff --git a/packages/SystemUI/res/layout/smart_action_button.xml b/packages/SystemUI/res/layout/smart_action_button.xml
index 488be3a..4e5785d 100644
--- a/packages/SystemUI/res/layout/smart_action_button.xml
+++ b/packages/SystemUI/res/layout/smart_action_button.xml
@@ -29,8 +29,8 @@
android:textSize="@dimen/smart_reply_button_font_size"
android:lineSpacingExtra="@dimen/smart_reply_button_line_spacing_extra"
android:textColor="@color/smart_reply_button_text"
- android:paddingLeft="@dimen/smart_reply_button_action_padding_left"
- android:paddingRight="@dimen/smart_reply_button_padding_horizontal"
+ android:paddingStart="@dimen/smart_reply_button_action_padding_left"
+ android:paddingEnd="@dimen/smart_reply_button_padding_horizontal"
android:drawablePadding="@dimen/smart_action_button_icon_padding"
android:textStyle="normal"
android:ellipsize="none"/>
diff --git a/packages/SystemUI/res/layout/smart_reply_button.xml b/packages/SystemUI/res/layout/smart_reply_button.xml
index ddf16e0..b24362f 100644
--- a/packages/SystemUI/res/layout/smart_reply_button.xml
+++ b/packages/SystemUI/res/layout/smart_reply_button.xml
@@ -31,7 +31,7 @@
android:textSize="@dimen/smart_reply_button_font_size"
android:lineSpacingExtra="@dimen/smart_reply_button_line_spacing_extra"
android:textColor="@color/smart_reply_button_text"
- android:paddingLeft="@dimen/smart_reply_button_padding_horizontal"
- android:paddingRight="@dimen/smart_reply_button_padding_horizontal"
+ android:paddingStart="@dimen/smart_reply_button_padding_horizontal"
+ android:paddingEnd="@dimen/smart_reply_button_padding_horizontal"
android:textStyle="normal"
android:ellipsize="none"/>
diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml
index 499dfa4..eaeaabe 100644
--- a/packages/SystemUI/res/values/ids.xml
+++ b/packages/SystemUI/res/values/ids.xml
@@ -198,6 +198,9 @@
<item type="id" name="pm_lite"/>
<item type="id" name="settings_button_container"/>
+ <!--Keyboard Backlight Dialog -->
+ <item type="id" name="keyboard_backlight_dialog_container"/>
+
<item type="id" name="log_access_dialog_allow_button" />
<item type="id" name="log_access_dialog_deny_button" />
</resources>
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
index 4629e8b..1ca63fb 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
@@ -21,6 +21,7 @@
import com.android.systemui.log.LogBuffer;
import com.android.systemui.log.LogLevel;
import com.android.systemui.plugins.ClockController;
+import com.android.systemui.shared.clocks.DefaultClockController;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
@@ -46,6 +47,9 @@
public static final int LARGE = 0;
public static final int SMALL = 1;
+ // compensate for translation of parents subject to device screen
+ // In this case, the translation comes from KeyguardStatusView
+ public int screenOffsetYPadding = 0;
/** Returns a region for the large clock to position itself, based on the given parent. */
public static Rect getLargeClockRegion(ViewGroup parent) {
@@ -161,8 +165,18 @@
}
if (mLargeClockFrame.isLaidOut()) {
- mClock.getLargeClock().getEvents().onTargetRegionChanged(
- getLargeClockRegion(mLargeClockFrame));
+ Rect targetRegion = getLargeClockRegion(mLargeClockFrame);
+ if (mClock instanceof DefaultClockController) {
+ mClock.getLargeClock().getEvents().onTargetRegionChanged(
+ targetRegion);
+ } else {
+ mClock.getLargeClock().getEvents().onTargetRegionChanged(
+ new Rect(
+ targetRegion.left,
+ targetRegion.top - screenOffsetYPadding,
+ targetRegion.right,
+ targetRegion.bottom - screenOffsetYPadding));
+ }
}
}
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
index 50dac32..d8bf570 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
@@ -169,6 +169,16 @@
}
/**
+ * Used for status view to pass the screen offset from parent view
+ */
+ public void setLockscreenClockY(int clockY) {
+ if (mView.screenOffsetYPadding != clockY) {
+ mView.screenOffsetYPadding = clockY;
+ mView.updateClockTargetRegions();
+ }
+ }
+
+ /**
* Attach the controller to the view it relates to.
*/
@Override
@@ -394,13 +404,6 @@
PropertyAnimator.setProperty(mStatusArea, AnimatableProperty.TRANSLATION_X,
x, props, animate);
}
-
- }
-
- void updateKeyguardStatusViewOffset() {
- // updateClockTargetRegions will call onTargetRegionChanged
- // which will require the correct translationY property of keyguardStatusView after updating
- mView.updateClockTargetRegions();
}
/**
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java
index 0826f8a..68d8143 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java
@@ -215,6 +215,15 @@
}
/**
+ * Pass top margin from ClockPositionAlgorithm in NotificationPanelViewController
+ * Use for clock view in LS to compensate for top margin to align to the screen
+ * Regardless of translation from AOD and unlock gestures
+ */
+ public void setLockscreenClockY(int clockY) {
+ mKeyguardClockSwitchController.setLockscreenClockY(clockY);
+ }
+
+ /**
* Set whether the view accessibility importance mode.
*/
public void setStatusAccessibilityImportance(int mode) {
@@ -230,7 +239,6 @@
* Update position of the view with an optional animation
*/
public void updatePosition(int x, int y, float scale, boolean animate) {
- float oldY = mView.getY();
setProperty(AnimatableProperty.Y, y, animate);
ClockController clock = mKeyguardClockSwitchController.getClock();
@@ -246,10 +254,6 @@
setProperty(AnimatableProperty.SCALE_X, 1f, animate);
setProperty(AnimatableProperty.SCALE_Y, 1f, animate);
}
-
- if (oldY != y) {
- mKeyguardClockSwitchController.updateKeyguardStatusViewOffset();
- }
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/keyboard/backlight/ui/view/KeyboardBacklightDialog.kt b/packages/SystemUI/src/com/android/systemui/keyboard/backlight/ui/view/KeyboardBacklightDialog.kt
index 2ef5e19..328beed 100644
--- a/packages/SystemUI/src/com/android/systemui/keyboard/backlight/ui/view/KeyboardBacklightDialog.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyboard/backlight/ui/view/KeyboardBacklightDialog.kt
@@ -159,6 +159,7 @@
private fun buildRootView(): LinearLayout {
val linearLayout =
LinearLayout(context).apply {
+ id = R.id.keyboard_backlight_dialog_container
orientation = LinearLayout.HORIZONTAL
layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT)
setPadding(
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index 137a99ef..4b44ac0 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -1513,6 +1513,8 @@
mKeyguardStatusViewController.getClockBottom(mStatusBarHeaderHeightKeyguard),
mKeyguardStatusViewController.isClockTopAligned());
mClockPositionAlgorithm.run(mClockPositionResult);
+ mKeyguardStatusViewController.setLockscreenClockY(
+ mClockPositionAlgorithm.getExpandedPreferredClockY());
mKeyguardBottomAreaInteractor.setClockPosition(
mClockPositionResult.clockX, mClockPositionResult.clockY);
boolean animate = mNotificationStackScrollLayoutController.isAddOrRemoveAnimationPending();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
index 4522e41..b4bfded 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
@@ -966,7 +966,7 @@
@Override
public ApplicationInfo getApplicationInfo() {
- ApplicationInfo applicationInfo = super.getApplicationInfo();
+ ApplicationInfo applicationInfo = new ApplicationInfo(super.getApplicationInfo());
applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_RTL;
return applicationInfo;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
index 90a6d0f..eba04f1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
@@ -239,7 +239,11 @@
}
}
- private int getExpandedPreferredClockY() {
+ /**
+ * give the static topMargin, used for lockscreen clocks to get the initial translationY
+ * to do counter translation
+ */
+ public int getExpandedPreferredClockY() {
if (mIsSplitShade) {
return mSplitShadeTargetTopMargin;
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt
index b563d86..21d0338 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt
@@ -311,7 +311,7 @@
setBounds(0, 0, newIconSize, newIconSize)
}
// Add the action icon to the Smart Action button.
- setCompoundDrawables(iconDrawable, null, null, null)
+ setCompoundDrawablesRelative(iconDrawable, null, null, null)
val onClickListener = View.OnClickListener {
onSmartActionClick(entry, smartActions, actionIndex, action)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
index 9e88ceb..fb6ba85 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
@@ -588,15 +588,15 @@
}
/**
- * Returns the combined width of the left drawable (the action icon) and the padding between the
- * drawable and the button text.
+ * Returns the combined width of the start drawable (the action icon) and the padding between
+ * the drawable and the button text.
*/
- private int getLeftCompoundDrawableWidthWithPadding(Button button) {
- Drawable[] drawables = button.getCompoundDrawables();
- Drawable leftDrawable = drawables[0];
- if (leftDrawable == null) return 0;
+ private int getStartCompoundDrawableWidthWithPadding(Button button) {
+ Drawable[] drawables = button.getCompoundDrawablesRelative();
+ Drawable startDrawable = drawables[0];
+ if (startDrawable == null) return 0;
- return leftDrawable.getBounds().width() + button.getCompoundDrawablePadding();
+ return startDrawable.getBounds().width() + button.getCompoundDrawablePadding();
}
private int squeezeButtonToTextWidth(Button button, int heightMeasureSpec, int textWidth) {
@@ -605,8 +605,8 @@
// Re-measure the squeezed smart reply button.
clearLayoutLineCount(button);
final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(
- button.getPaddingLeft() + button.getPaddingRight() + textWidth
- + getLeftCompoundDrawableWidthWithPadding(button), MeasureSpec.AT_MOST);
+ button.getPaddingStart() + button.getPaddingEnd() + textWidth
+ + getStartCompoundDrawableWidthWithPadding(button), MeasureSpec.AT_MOST);
button.measure(widthMeasureSpec, heightMeasureSpec);
if (button.getLayout() == null) {
Log.wtf(TAG, "Button layout is null after measure.");
diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsTrampolineActivityTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsTrampolineActivityTest.java
index 31a33d4..cbd9dba 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsTrampolineActivityTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsTrampolineActivityTest.java
@@ -30,6 +30,7 @@
import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assume.assumeFalse;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
@@ -127,6 +128,9 @@
@Before
public void setUp() {
+ assumeFalse("Skip test: does not apply to watches",
+ mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH));
+
MockitoAnnotations.initMocks(this);
mMainHandler = mContext.getMainThreadHandler();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java
index d9d8b63..3b0d512 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java
@@ -585,8 +585,6 @@
// devices.
layout.setBaselineAligned(false);
- final boolean isRtl = mView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
-
// Add smart replies
Button previous = null;
SmartReplyView.SmartReplies smartReplies =
@@ -606,11 +604,7 @@
if (previous != null) {
ViewGroup.MarginLayoutParams lp =
(ViewGroup.MarginLayoutParams) previous.getLayoutParams();
- if (isRtl) {
- lp.leftMargin = mSpacing;
- } else {
- lp.rightMargin = mSpacing;
- }
+ lp.setMarginEnd(mSpacing);
}
layout.addView(current);
previous = current;
@@ -634,11 +628,7 @@
if (previous != null) {
ViewGroup.MarginLayoutParams lp =
(ViewGroup.MarginLayoutParams) previous.getLayoutParams();
- if (isRtl) {
- lp.leftMargin = mSpacing;
- } else {
- lp.rightMargin = mSpacing;
- }
+ lp.setMarginEnd(mSpacing);
}
layout.addView(current);
previous = current;
@@ -937,8 +927,8 @@
.collect(Collectors.toList());
Button singleLineButton = buttons.get(0);
Button doubleLineButton = buttons.get(1);
- Drawable singleLineDrawable = singleLineButton.getCompoundDrawables()[0]; // left drawable
- Drawable doubleLineDrawable = doubleLineButton.getCompoundDrawables()[0]; // left drawable
+ Drawable singleLineDrawable = singleLineButton.getCompoundDrawablesRelative()[0]; // start
+ Drawable doubleLineDrawable = doubleLineButton.getCompoundDrawablesRelative()[0]; // start
assertEquals(singleLineDrawable.getBounds().width(),
doubleLineDrawable.getBounds().width());
assertEquals(singleLineDrawable.getBounds().height(),
diff --git a/services/companion/java/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncConnectionService.java b/services/companion/java/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncConnectionService.java
index 6f99d86..e436e93 100644
--- a/services/companion/java/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncConnectionService.java
+++ b/services/companion/java/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncConnectionService.java
@@ -128,9 +128,9 @@
private static final class CallMetadataSyncConnectionIdentifier {
private final int mAssociationId;
- private final long mCallId;
+ private final String mCallId;
- CallMetadataSyncConnectionIdentifier(int associationId, long callId) {
+ CallMetadataSyncConnectionIdentifier(int associationId, String callId) {
mAssociationId = associationId;
mCallId = callId;
}
@@ -139,7 +139,7 @@
return mAssociationId;
}
- public long getCallId() {
+ public String getCallId() {
return mCallId;
}
@@ -161,9 +161,7 @@
private abstract static class CallMetadataSyncConnectionCallback {
- abstract void sendCallAction(int associationId, long callId, int action);
-
- abstract void sendStateChange(int associationId, long callId, int newState);
+ abstract void sendCallAction(int associationId, String callId, int action);
}
private static class CallMetadataSyncConnection extends Connection {
@@ -184,7 +182,7 @@
mCallback = callback;
}
- public long getCallId() {
+ public String getCallId() {
return mCall.getId();
}
@@ -205,22 +203,22 @@
}
final Bundle extras = new Bundle();
- extras.putLong(CrossDeviceCall.EXTRA_CALL_ID, mCall.getId());
+ extras.putString(CrossDeviceCall.EXTRA_CALL_ID, mCall.getId());
putExtras(extras);
int capabilities = getConnectionCapabilities();
- if (mCall.hasControl(android.companion.Telecom.Call.PUT_ON_HOLD)) {
+ if (mCall.hasControl(android.companion.Telecom.PUT_ON_HOLD)) {
capabilities |= CAPABILITY_HOLD;
} else {
capabilities &= ~CAPABILITY_HOLD;
}
- if (mCall.hasControl(android.companion.Telecom.Call.MUTE)) {
+ if (mCall.hasControl(android.companion.Telecom.MUTE)) {
capabilities |= CAPABILITY_MUTE;
} else {
capabilities &= ~CAPABILITY_MUTE;
}
mAudioManager.setMicrophoneMute(
- mCall.hasControl(android.companion.Telecom.Call.UNMUTE));
+ mCall.hasControl(android.companion.Telecom.UNMUTE));
if (capabilities != getConnectionCapabilities()) {
setConnectionCapabilities(capabilities);
}
@@ -248,8 +246,8 @@
int capabilities = getConnectionCapabilities();
final boolean hasHoldControl = mCall.hasControl(
- android.companion.Telecom.Call.PUT_ON_HOLD)
- || mCall.hasControl(android.companion.Telecom.Call.TAKE_OFF_HOLD);
+ android.companion.Telecom.PUT_ON_HOLD)
+ || mCall.hasControl(android.companion.Telecom.TAKE_OFF_HOLD);
if (hasHoldControl != ((getConnectionCapabilities() & CAPABILITY_HOLD)
== CAPABILITY_HOLD)) {
if (hasHoldControl) {
@@ -258,7 +256,7 @@
capabilities &= ~CAPABILITY_HOLD;
}
}
- final boolean hasMuteControl = mCall.hasControl(android.companion.Telecom.Call.MUTE);
+ final boolean hasMuteControl = mCall.hasControl(android.companion.Telecom.MUTE);
if (hasMuteControl != ((getConnectionCapabilities() & CAPABILITY_MUTE)
== CAPABILITY_MUTE)) {
if (hasMuteControl) {
@@ -268,7 +266,7 @@
}
}
mAudioManager.setMicrophoneMute(
- mCall.hasControl(android.companion.Telecom.Call.UNMUTE));
+ mCall.hasControl(android.companion.Telecom.UNMUTE));
if (capabilities != getConnectionCapabilities()) {
setConnectionCapabilities(capabilities);
}
@@ -276,12 +274,12 @@
@Override
public void onAnswer(int videoState) {
- sendCallAction(android.companion.Telecom.Call.ACCEPT);
+ sendCallAction(android.companion.Telecom.ACCEPT);
}
@Override
public void onReject() {
- sendCallAction(android.companion.Telecom.Call.REJECT);
+ sendCallAction(android.companion.Telecom.REJECT);
}
@Override
@@ -296,33 +294,28 @@
@Override
public void onSilence() {
- sendCallAction(android.companion.Telecom.Call.SILENCE);
+ sendCallAction(android.companion.Telecom.SILENCE);
}
@Override
public void onHold() {
- sendCallAction(android.companion.Telecom.Call.PUT_ON_HOLD);
+ sendCallAction(android.companion.Telecom.PUT_ON_HOLD);
}
@Override
public void onUnhold() {
- sendCallAction(android.companion.Telecom.Call.TAKE_OFF_HOLD);
+ sendCallAction(android.companion.Telecom.TAKE_OFF_HOLD);
}
@Override
public void onMuteStateChanged(boolean isMuted) {
- sendCallAction(isMuted ? android.companion.Telecom.Call.MUTE
- : android.companion.Telecom.Call.UNMUTE);
+ sendCallAction(isMuted ? android.companion.Telecom.MUTE
+ : android.companion.Telecom.UNMUTE);
}
@Override
public void onDisconnect() {
- sendCallAction(android.companion.Telecom.Call.END);
- }
-
- @Override
- public void onStateChanged(int state) {
- mCallback.sendStateChange(mAssociationId, mCall.getId(), state);
+ sendCallAction(android.companion.Telecom.END);
}
private void sendCallAction(int action) {
diff --git a/services/companion/java/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncData.java b/services/companion/java/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncData.java
index 1e4bb9a..5b0c745 100644
--- a/services/companion/java/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncData.java
+++ b/services/companion/java/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncData.java
@@ -33,14 +33,14 @@
/** A read-only snapshot of an {@link ContextSyncMessage}. */
class CallMetadataSyncData {
- final Map<Long, CallMetadataSyncData.Call> mCalls = new HashMap<>();
+ final Map<String, CallMetadataSyncData.Call> mCalls = new HashMap<>();
final List<CallMetadataSyncData.Call> mRequests = new ArrayList<>();
public void addCall(CallMetadataSyncData.Call call) {
mCalls.put(call.getId(), call);
}
- public boolean hasCall(long id) {
+ public boolean hasCall(String id) {
return mCalls.containsKey(id);
}
@@ -57,7 +57,7 @@
}
public static class Call implements Parcelable {
- private long mId;
+ private String mId;
private String mCallerId;
private byte[] mAppIcon;
private String mAppName;
@@ -67,7 +67,7 @@
public static Call fromParcel(Parcel parcel) {
final Call call = new Call();
- call.setId(parcel.readLong());
+ call.setId(parcel.readString());
call.setCallerId(parcel.readString());
call.setAppIcon(parcel.readBlob());
call.setAppName(parcel.readString());
@@ -82,7 +82,7 @@
@Override
public void writeToParcel(Parcel parcel, int parcelableFlags) {
- parcel.writeLong(mId);
+ parcel.writeString(mId);
parcel.writeString(mCallerId);
parcel.writeBlob(mAppIcon);
parcel.writeString(mAppName);
@@ -94,7 +94,7 @@
}
}
- void setId(long id) {
+ void setId(String id) {
mId = id;
}
@@ -122,7 +122,7 @@
mControls.add(control);
}
- long getId() {
+ String getId() {
return mId;
}
@@ -157,7 +157,7 @@
@Override
public boolean equals(Object other) {
if (other instanceof CallMetadataSyncData.Call) {
- return ((Call) other).getId() == getId();
+ return mId != null && mId.equals(((Call) other).getId());
}
return false;
}
diff --git a/services/companion/java/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncInCallService.java b/services/companion/java/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncInCallService.java
index 443a732..0c23730 100644
--- a/services/companion/java/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncInCallService.java
+++ b/services/companion/java/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncInCallService.java
@@ -41,7 +41,6 @@
public class CallMetadataSyncInCallService extends InCallService {
private static final String TAG = "CallMetadataIcs";
- private static final long NOT_VALID = -1L;
private CompanionDeviceManagerServiceInternal mCdmsi;
@@ -71,7 +70,7 @@
callMetadataSyncData.getRequests().iterator();
while (iterator.hasNext()) {
final CallMetadataSyncData.Call call = iterator.next();
- if (call.getId() != 0) {
+ if (call.getId() != null) {
// The call is already assigned an id; treat as control invocations.
for (int control : call.getControls()) {
processCallControlAction(call.getId(), control);
@@ -81,41 +80,41 @@
}
}
- private void processCallControlAction(long crossDeviceCallId,
+ private void processCallControlAction(String crossDeviceCallId,
int callControlAction) {
final CrossDeviceCall crossDeviceCall = getCallForId(crossDeviceCallId,
mCurrentCalls.values());
switch (callControlAction) {
- case android.companion.Telecom.Call.ACCEPT:
+ case android.companion.Telecom.ACCEPT:
if (crossDeviceCall != null) {
crossDeviceCall.doAccept();
}
break;
- case android.companion.Telecom.Call.REJECT:
+ case android.companion.Telecom.REJECT:
if (crossDeviceCall != null) {
crossDeviceCall.doReject();
}
break;
- case android.companion.Telecom.Call.SILENCE:
+ case android.companion.Telecom.SILENCE:
doSilence();
break;
- case android.companion.Telecom.Call.MUTE:
+ case android.companion.Telecom.MUTE:
doMute();
break;
- case android.companion.Telecom.Call.UNMUTE:
+ case android.companion.Telecom.UNMUTE:
doUnmute();
break;
- case android.companion.Telecom.Call.END:
+ case android.companion.Telecom.END:
if (crossDeviceCall != null) {
crossDeviceCall.doEnd();
}
break;
- case android.companion.Telecom.Call.PUT_ON_HOLD:
+ case android.companion.Telecom.PUT_ON_HOLD:
if (crossDeviceCall != null) {
crossDeviceCall.doPutOnHold();
}
break;
- case android.companion.Telecom.Call.TAKE_OFF_HOLD:
+ case android.companion.Telecom.TAKE_OFF_HOLD:
if (crossDeviceCall != null) {
crossDeviceCall.doTakeOffHold();
}
@@ -171,12 +170,12 @@
@Nullable
@VisibleForTesting
- CrossDeviceCall getCallForId(long crossDeviceCallId, Collection<CrossDeviceCall> calls) {
- if (crossDeviceCallId == NOT_VALID) {
+ CrossDeviceCall getCallForId(String crossDeviceCallId, Collection<CrossDeviceCall> calls) {
+ if (crossDeviceCallId == null) {
return null;
}
for (CrossDeviceCall crossDeviceCall : calls) {
- if (crossDeviceCall.getId() == crossDeviceCallId) {
+ if (crossDeviceCallId.equals(crossDeviceCall.getId())) {
return crossDeviceCall;
}
}
diff --git a/services/companion/java/com/android/server/companion/datatransfer/contextsync/CrossDeviceCall.java b/services/companion/java/com/android/server/companion/datatransfer/contextsync/CrossDeviceCall.java
index ac981d4..168068e 100644
--- a/services/companion/java/com/android/server/companion/datatransfer/contextsync/CrossDeviceCall.java
+++ b/services/companion/java/com/android/server/companion/datatransfer/contextsync/CrossDeviceCall.java
@@ -23,7 +23,6 @@
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
-import android.os.Bundle;
import android.telecom.Call;
import android.telecom.CallAudioState;
import android.telecom.VideoProfile;
@@ -34,7 +33,7 @@
import java.io.ByteArrayOutputStream;
import java.util.HashSet;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
+import java.util.UUID;
/** Data holder for a telecom call and additional metadata. */
public class CrossDeviceCall {
@@ -45,9 +44,7 @@
"com.android.companion.datatransfer.contextsync.extra.CALL_ID";
private static final int APP_ICON_BITMAP_DIMENSION = 256;
- private static final AtomicLong sNextId = new AtomicLong(1);
-
- private final long mId;
+ private final String mId;
private Call mCall;
@VisibleForTesting boolean mIsEnterprise;
@VisibleForTesting boolean mIsOtt;
@@ -64,14 +61,14 @@
CallAudioState callAudioState) {
this(packageManager, call.getDetails(), callAudioState);
mCall = call;
- final Bundle extras = new Bundle();
- extras.putLong(EXTRA_CALL_ID, mId);
- call.putExtras(extras);
+ call.putExtra(EXTRA_CALL_ID, mId);
}
CrossDeviceCall(PackageManager packageManager, Call.Details callDetails,
CallAudioState callAudioState) {
- mId = sNextId.getAndIncrement();
+ final String predefinedId = callDetails.getIntentExtras() != null
+ ? callDetails.getIntentExtras().getString(EXTRA_CALL_ID) : null;
+ mId = predefinedId != null ? predefinedId : UUID.randomUUID().toString();
mCallingAppPackageName =
callDetails.getAccountHandle().getComponentName().getPackageName();
mIsOtt = (callDetails.getCallCapabilities() & Call.Details.PROPERTY_SELF_MANAGED)
@@ -145,7 +142,7 @@
if (mStatus == android.companion.Telecom.Call.RINGING) {
mStatus = android.companion.Telecom.Call.RINGING_SILENCED;
}
- mControls.remove(android.companion.Telecom.Call.SILENCE);
+ mControls.remove(android.companion.Telecom.SILENCE);
}
@VisibleForTesting
@@ -156,26 +153,26 @@
mControls.clear();
if (mStatus == android.companion.Telecom.Call.RINGING
|| mStatus == android.companion.Telecom.Call.RINGING_SILENCED) {
- mControls.add(android.companion.Telecom.Call.ACCEPT);
- mControls.add(android.companion.Telecom.Call.REJECT);
+ mControls.add(android.companion.Telecom.ACCEPT);
+ mControls.add(android.companion.Telecom.REJECT);
if (mStatus == android.companion.Telecom.Call.RINGING) {
- mControls.add(android.companion.Telecom.Call.SILENCE);
+ mControls.add(android.companion.Telecom.SILENCE);
}
}
if (mStatus == android.companion.Telecom.Call.ONGOING
|| mStatus == android.companion.Telecom.Call.ON_HOLD) {
- mControls.add(android.companion.Telecom.Call.END);
+ mControls.add(android.companion.Telecom.END);
if (callDetails.can(Call.Details.CAPABILITY_HOLD)) {
mControls.add(
mStatus == android.companion.Telecom.Call.ON_HOLD
- ? android.companion.Telecom.Call.TAKE_OFF_HOLD
- : android.companion.Telecom.Call.PUT_ON_HOLD);
+ ? android.companion.Telecom.TAKE_OFF_HOLD
+ : android.companion.Telecom.PUT_ON_HOLD);
}
}
if (mStatus == android.companion.Telecom.Call.ONGOING && callDetails.can(
Call.Details.CAPABILITY_MUTE)) {
- mControls.add(mIsMuted ? android.companion.Telecom.Call.UNMUTE
- : android.companion.Telecom.Call.MUTE);
+ mControls.add(mIsMuted ? android.companion.Telecom.UNMUTE
+ : android.companion.Telecom.MUTE);
}
}
@@ -212,7 +209,7 @@
}
}
- public long getId() {
+ public String getId() {
return mId;
}
diff --git a/services/companion/java/com/android/server/companion/datatransfer/contextsync/CrossDeviceSyncController.java b/services/companion/java/com/android/server/companion/datatransfer/contextsync/CrossDeviceSyncController.java
index adc5faf..e5ab963 100644
--- a/services/companion/java/com/android/server/companion/datatransfer/contextsync/CrossDeviceSyncController.java
+++ b/services/companion/java/com/android/server/companion/datatransfer/contextsync/CrossDeviceSyncController.java
@@ -270,7 +270,7 @@
while (pis.nextField() != ProtoInputStream.NO_MORE_FIELDS) {
switch (pis.getFieldNumber()) {
case (int) Telecom.Call.ID:
- call.setId(pis.readLong(Telecom.Call.ID));
+ call.setId(pis.readString(Telecom.Call.ID));
break;
case (int) Telecom.Call.ORIGIN:
final long originToken = pis.start(Telecom.Call.ORIGIN);
@@ -336,7 +336,7 @@
}
/** Create a call control message. */
- public static byte[] createCallControlMessage(long callId, int control) {
+ public static byte[] createCallControlMessage(String callId, int control) {
final ProtoOutputStream pos = new ProtoOutputStream();
pos.write(ContextSyncMessage.VERSION, CURRENT_VERSION);
final long telecomToken = pos.start(ContextSyncMessage.TELECOM);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index f2d2933..bee501a 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -16062,6 +16062,8 @@
final int procState = uidRec != null
? uidRec.getSetProcState() : PROCESS_STATE_NONEXISTENT;
+ final int procAdj = uidRec != null
+ ? uidRec.getMinProcAdj() : ProcessList.INVALID_ADJ;
final long procStateSeq = uidRec != null ? uidRec.curProcStateSeq : 0;
final int capability = uidRec != null ? uidRec.getSetCapability() : 0;
final boolean ephemeral = uidRec != null ? uidRec.isEphemeral() : isEphemeralLocked(uid);
@@ -16077,7 +16079,7 @@
}
final int enqueuedChange = mUidObserverController.enqueueUidChange(
uidRec == null ? null : uidRec.pendingChange,
- uid, change, procState, procStateSeq, capability, ephemeral);
+ uid, change, procState, procAdj, procStateSeq, capability, ephemeral);
if (uidRec != null) {
uidRec.setLastReportedChange(enqueuedChange);
}
diff --git a/services/core/java/com/android/server/am/PendingIntentRecord.java b/services/core/java/com/android/server/am/PendingIntentRecord.java
index daf227c..939f151 100644
--- a/services/core/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/core/java/com/android/server/am/PendingIntentRecord.java
@@ -46,7 +46,6 @@
import android.os.RemoteException;
import android.os.TransactionTooLargeException;
import android.os.UserHandle;
-import android.provider.DeviceConfig;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.Slog;
@@ -68,10 +67,6 @@
@EnabledAfter(targetSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Overridable
private static final long DEFAULT_RESCIND_BAL_PRIVILEGES_FROM_PENDING_INTENT_SENDER = 244637991;
- private static final String ENABLE_DEFAULT_RESCIND_BAL_PRIVILEGES_FROM_PENDING_INTENT_SENDER =
- "DefaultRescindBalPrivilegesFromPendingIntentSender__"
- + "enable_default_rescind_bal_privileges_from_pending_intent_sender";
-
public static final int FLAG_ACTIVITY_SENDER = 1 << 0;
public static final int FLAG_BROADCAST_SENDER = 1 << 1;
public static final int FLAG_SERVICE_SENDER = 1 << 2;
@@ -373,13 +368,6 @@
: BackgroundStartPrivileges.NONE;
}
- private static boolean isDefaultRescindBalPrivilegesFromPendingIntentSenderEnabled() {
- return DeviceConfig.getBoolean(
- DeviceConfig.NAMESPACE_WINDOW_MANAGER,
- ENABLE_DEFAULT_RESCIND_BAL_PRIVILEGES_FROM_PENDING_INTENT_SENDER,
- false); // assume false if the property is unknown
- }
-
/**
* Default {@link BackgroundStartPrivileges} to be used if the intent sender has not made an
* explicit choice.
@@ -393,10 +381,9 @@
})
public static BackgroundStartPrivileges getDefaultBackgroundStartPrivileges(
int callingUid) {
- boolean isFlagEnabled = isDefaultRescindBalPrivilegesFromPendingIntentSenderEnabled();
boolean isChangeEnabledForApp = CompatChanges.isChangeEnabled(
DEFAULT_RESCIND_BAL_PRIVILEGES_FROM_PENDING_INTENT_SENDER, callingUid);
- if (isFlagEnabled && isChangeEnabledForApp) {
+ if (isChangeEnabledForApp) {
return BackgroundStartPrivileges.ALLOW_FGS;
} else {
return BackgroundStartPrivileges.ALLOW_BAL;
diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java
index 438a08c..0417b8c 100644
--- a/services/core/java/com/android/server/am/ProcessRecord.java
+++ b/services/core/java/com/android/server/am/ProcessRecord.java
@@ -644,6 +644,11 @@
}
}
+ @GuardedBy({"mService", "mProcLock"})
+ int getSetAdj() {
+ return mState.getSetAdj();
+ }
+
@GuardedBy(anyOf = {"mService", "mProcLock"})
IApplicationThread getThread() {
return mThread;
diff --git a/services/core/java/com/android/server/am/UidObserverController.java b/services/core/java/com/android/server/am/UidObserverController.java
index 51cb987..790cc7b 100644
--- a/services/core/java/com/android/server/am/UidObserverController.java
+++ b/services/core/java/com/android/server/am/UidObserverController.java
@@ -96,7 +96,7 @@
}
int enqueueUidChange(@Nullable ChangeRecord currentRecord, int uid, int change, int procState,
- long procStateSeq, int capability, boolean ephemeral) {
+ int procAdj, long procStateSeq, int capability, boolean ephemeral) {
synchronized (mLock) {
if (mPendingUidChanges.size() == 0) {
if (DEBUG_UID_OBSERVERS) {
@@ -117,6 +117,7 @@
changeRecord.uid = uid;
changeRecord.change = change;
changeRecord.procState = procState;
+ changeRecord.procAdj = procAdj;
changeRecord.procStateSeq = procStateSeq;
changeRecord.capability = capability;
changeRecord.ephemeral = ephemeral;
@@ -344,7 +345,7 @@
}
if ((reg.mWhich & ActivityManager.UID_OBSERVER_PROC_OOM_ADJ) != 0
&& (change & UidRecord.CHANGE_PROCADJ) != 0) {
- observer.onUidProcAdjChanged(item.uid);
+ observer.onUidProcAdjChanged(item.uid, item.procAdj);
}
}
final int duration = (int) (SystemClock.uptimeMillis() - start);
@@ -426,6 +427,7 @@
public int uid;
public int change;
public int procState;
+ public int procAdj;
public int capability;
public boolean ephemeral;
public long procStateSeq;
@@ -435,6 +437,7 @@
changeRecord.uid = uid;
changeRecord.change = change;
changeRecord.procState = procState;
+ changeRecord.procAdj = procAdj;
changeRecord.capability = capability;
changeRecord.ephemeral = ephemeral;
changeRecord.procStateSeq = procStateSeq;
diff --git a/services/core/java/com/android/server/am/UidRecord.java b/services/core/java/com/android/server/am/UidRecord.java
index e39ac2b..993088e 100644
--- a/services/core/java/com/android/server/am/UidRecord.java
+++ b/services/core/java/com/android/server/am/UidRecord.java
@@ -51,6 +51,12 @@
private boolean mProcAdjChanged;
@CompositeRWLock({"mService", "mProcLock"})
+ private int mCurAdj;
+
+ @CompositeRWLock({"mService", "mProcLock"})
+ private int mSetAdj;
+
+ @CompositeRWLock({"mService", "mProcLock"})
private int mCurCapability;
@CompositeRWLock({"mService", "mProcLock"})
@@ -201,12 +207,24 @@
mProcAdjChanged = false;
}
- @GuardedBy({"mService", "mProcLock"})
+ @GuardedBy(anyOf = {"mService", "mProcLock"})
boolean getProcAdjChanged() {
return mProcAdjChanged;
}
@GuardedBy(anyOf = {"mService", "mProcLock"})
+ int getMinProcAdj() {
+ int minAdj = ProcessList.UNKNOWN_ADJ;
+ for (int i = mProcRecords.size() - 1; i >= 0; i--) {
+ int adj = mProcRecords.valueAt(i).getSetAdj();
+ if (adj < minAdj) {
+ minAdj = adj;
+ }
+ }
+ return minAdj;
+ }
+
+ @GuardedBy(anyOf = {"mService", "mProcLock"})
int getCurCapability() {
return mCurCapability;
}
diff --git a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
index 377b8cf..0695aeb 100644
--- a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
+++ b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
@@ -588,13 +588,10 @@
return projection;
}
+ @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)
@Override // Binder call
public boolean isCurrentProjection(IMediaProjection projection) {
- if (mContext.checkCallingOrSelfPermission(MANAGE_MEDIA_PROJECTION)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION in order to check "
- + "if the given projection is current.");
- }
+ isCurrentProjection_enforcePermission();
return MediaProjectionManagerService.this.isCurrentProjection(
projection == null ? null : projection.asBinder());
}
@@ -614,13 +611,10 @@
}
}
+ @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)
@Override // Binder call
public void stopActiveProjection() {
- if (mContext.checkCallingOrSelfPermission(MANAGE_MEDIA_PROJECTION)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION in order to stop "
- + "the active projection");
- }
+ stopActiveProjection_enforcePermission();
final long token = Binder.clearCallingIdentity();
try {
if (mProjectionGrant != null) {
@@ -631,13 +625,10 @@
}
}
+ @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)
@Override // Binder call
public void notifyActiveProjectionCapturedContentResized(int width, int height) {
- if (mContext.checkCallingOrSelfPermission(MANAGE_MEDIA_PROJECTION)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION in order to notify "
- + "on captured content resize");
- }
+ notifyActiveProjectionCapturedContentResized_enforcePermission();
if (!isCurrentProjection(mProjectionGrant)) {
return;
}
@@ -651,13 +642,10 @@
}
}
+ @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)
@Override
public void notifyActiveProjectionCapturedContentVisibilityChanged(boolean isVisible) {
- if (mContext.checkCallingOrSelfPermission(MANAGE_MEDIA_PROJECTION)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION in order to notify "
- + "on captured content visibility changed");
- }
+ notifyActiveProjectionCapturedContentVisibilityChanged_enforcePermission();
if (!isCurrentProjection(mProjectionGrant)) {
return;
}
@@ -701,14 +689,11 @@
}
}
+ @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)
@Override
public boolean setContentRecordingSession(@Nullable ContentRecordingSession incomingSession,
@NonNull IMediaProjection projection) {
- if (mContext.checkCallingOrSelfPermission(Manifest.permission.MANAGE_MEDIA_PROJECTION)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION to set session "
- + "details.");
- }
+ setContentRecordingSession_enforcePermission();
if (!isCurrentProjection(projection)) {
throw new SecurityException("Unable to set ContentRecordingSession on "
+ "non-current MediaProjection");
@@ -722,13 +707,10 @@
}
}
+ @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)
@Override
public void requestConsentForInvalidProjection(@NonNull IMediaProjection projection) {
- if (mContext.checkCallingOrSelfPermission(Manifest.permission.MANAGE_MEDIA_PROJECTION)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION to check if the given"
- + "projection is valid.");
- }
+ requestConsentForInvalidProjection_enforcePermission();
if (!isCurrentProjection(projection)) {
Slog.v(TAG, "Reusing token: Won't request consent again for a token that "
+ "isn't current");
@@ -840,13 +822,10 @@
|| mType == MediaProjectionManager.TYPE_SCREEN_CAPTURE;
}
+ @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)
@Override // Binder call
public int applyVirtualDisplayFlags(int flags) {
- if (mContext.checkCallingOrSelfPermission(MANAGE_MEDIA_PROJECTION)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION to apply virtual "
- + "display flags.");
- }
+ applyVirtualDisplayFlags_enforcePermission();
if (mType == MediaProjectionManager.TYPE_SCREEN_CAPTURE) {
flags &= ~DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY;
flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR
@@ -998,33 +977,24 @@
mCallbackDelegate.remove(callback);
}
+ @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)
@Override // Binder call
public void setLaunchCookie(IBinder launchCookie) {
- if (mContext.checkCallingOrSelfPermission(MANAGE_MEDIA_PROJECTION)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION to set launch "
- + "cookie.");
- }
+ setLaunchCookie_enforcePermission();
mLaunchCookie = launchCookie;
}
+ @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)
@Override // Binder call
public IBinder getLaunchCookie() {
- if (mContext.checkCallingOrSelfPermission(MANAGE_MEDIA_PROJECTION)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION to get launch "
- + "cookie.");
- }
+ getLaunchCookie_enforcePermission();
return mLaunchCookie;
}
+ @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)
@Override
public boolean isValid() {
- if (mContext.checkCallingOrSelfPermission(Manifest.permission.MANAGE_MEDIA_PROJECTION)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION to check if this"
- + "projection is valid.");
- }
+ isValid_enforcePermission();
synchronized (mLock) {
final long curMs = mClock.uptimeMillis();
final boolean hasTimedOut = curMs - mCreateTimeMs > mTimeoutMs;
@@ -1051,13 +1021,10 @@
}
}
+ @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)
@Override
public void notifyVirtualDisplayCreated(int displayId) {
- if (mContext.checkCallingOrSelfPermission(Manifest.permission.MANAGE_MEDIA_PROJECTION)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires MANAGE_MEDIA_PROJECTION to notify virtual "
- + "display created.");
- }
+ notifyVirtualDisplayCreated_enforcePermission();
synchronized (mLock) {
mVirtualDisplayId = displayId;
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index 8744332..7b0ac80 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -5690,8 +5690,14 @@
}
if (eventTime > now) {
- Slog.e(TAG, "Event time " + eventTime + " cannot be newer than " + now);
- throw new IllegalArgumentException("event time must not be in the future");
+ Slog.wtf(TAG, "Event cannot be newer than the current time ("
+ + "now=" + now
+ + ", eventTime=" + eventTime
+ + ", displayId=" + displayId
+ + ", event=" + PowerManager.userActivityEventToString(event)
+ + ", flags=" + flags
+ + ")");
+ return;
}
final int uid = Binder.getCallingUid();
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 24a271f..26b40b4 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -582,6 +582,9 @@
boolean mPauseSchedulePendingForPip = false;
+ // Gets set to indicate that the activity is currently being auto-pipped.
+ boolean mAutoEnteringPip = false;
+
private void updateEnterpriseThumbnailDrawable(Context context) {
DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
mEnterpriseThumbnailDrawable = dpm.getResources().getDrawable(
@@ -6099,8 +6102,7 @@
try {
mAtmService.getLifecycleManager().scheduleTransaction(app.getThread(), token,
PauseActivityItem.obtain(finishing, false /* userLeaving */,
- configChangeFlags, false /* dontReport */,
- false /* autoEnteringPip */));
+ configChangeFlags, false /* dontReport */, mAutoEnteringPip));
} catch (Exception e) {
Slog.w(TAG, "Exception thrown sending pause: " + intent.getComponent(), e);
}
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index a0ea1c3..f86df2a 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -3592,15 +3592,21 @@
}
}
+ boolean enterPictureInPictureMode(@NonNull ActivityRecord r,
+ @NonNull PictureInPictureParams params, boolean fromClient) {
+ return enterPictureInPictureMode(r, params, fromClient, false /* isAutoEnter */);
+ }
+
/**
* Puts the given activity in picture in picture mode if possible.
*
* @param fromClient true if this comes from a client call (eg. Activity.enterPip).
+ * @param isAutoEnter true if this comes from an automatic pip-enter.
* @return true if the activity is now in picture-in-picture mode, or false if it could not
* enter picture-in-picture mode.
*/
boolean enterPictureInPictureMode(@NonNull ActivityRecord r,
- @NonNull PictureInPictureParams params, boolean fromClient) {
+ @NonNull PictureInPictureParams params, boolean fromClient, boolean isAutoEnter) {
// If the activity is already in picture in picture mode, then just return early
if (r.inPinnedWindowingMode()) {
return true;
@@ -3635,6 +3641,7 @@
return;
}
r.setPictureInPictureParams(params);
+ r.mAutoEnteringPip = isAutoEnter;
mRootWindowContainer.moveActivityToPinnedRootTask(r,
null /* launchIntoPipHostActivity */, "enterPictureInPictureMode",
transition);
@@ -3643,6 +3650,7 @@
r.getTask().schedulePauseActivity(r, false /* userLeaving */,
false /* pauseImmediately */, true /* autoEnteringPip */, "auto-pip");
}
+ r.mAutoEnteringPip = false;
}
};
diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java
index 80f918b..a1e497e 100644
--- a/services/core/java/com/android/server/wm/Transition.java
+++ b/services/core/java/com/android/server/wm/Transition.java
@@ -963,7 +963,7 @@
return false;
}
return mController.mAtm.enterPictureInPictureMode(ar, ar.pictureInPictureArgs,
- false /* fromClient */);
+ false /* fromClient */, true /* isAutoEnter */);
}
// Legacy pip-entry (not via isAutoEnterEnabled).
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 58457c5..2b26559 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -10011,10 +10011,6 @@
"clearDeviceOwner can only be called by the device owner");
}
enforceUserUnlocked(deviceOwnerUserId);
- DevicePolicyData policy = getUserData(deviceOwnerUserId);
- if (policy.mPasswordTokenHandle != 0) {
- mLockPatternUtils.removeEscrowToken(policy.mPasswordTokenHandle, deviceOwnerUserId);
- }
final ActiveAdmin admin = getDeviceOwnerAdminLocked();
mInjector.binderWithCleanCallingIdentity(() -> {
@@ -10069,6 +10065,10 @@
}
final DevicePolicyData policyData = getUserData(userId);
policyData.mCurrentInputMethodSet = false;
+ if (policyData.mPasswordTokenHandle != 0) {
+ mLockPatternUtils.removeEscrowToken(policyData.mPasswordTokenHandle, userId);
+ policyData.mPasswordTokenHandle = 0;
+ }
saveSettingsLocked(userId);
mPolicyCache.onUserRemoved(userId);
final DevicePolicyData systemPolicyData = getUserData(UserHandle.USER_SYSTEM);
diff --git a/services/tests/servicestests/src/com/android/server/am/UidObserverControllerTest.java b/services/tests/servicestests/src/com/android/server/am/UidObserverControllerTest.java
index f788c92..46974cf7 100644
--- a/services/tests/servicestests/src/com/android/server/am/UidObserverControllerTest.java
+++ b/services/tests/servicestests/src/com/android/server/am/UidObserverControllerTest.java
@@ -28,6 +28,8 @@
import static android.app.ActivityManager.PROCESS_STATE_SERVICE;
import static android.app.ActivityManager.PROCESS_STATE_TOP;
+import static com.android.server.am.ProcessList.UNKNOWN_ADJ;
+
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
@@ -81,7 +83,7 @@
public void testEnqueueUidChange() {
int change = mUidObserverController.enqueueUidChange(null, TEST_UID1,
UidRecord.CHANGE_ACTIVE, PROCESS_STATE_FOREGROUND_SERVICE,
- PROCESS_CAPABILITY_ALL, 0, false);
+ UNKNOWN_ADJ, PROCESS_CAPABILITY_ALL, 0, false);
assertEquals("expected=ACTIVE,actual=" + changeToStr(change),
UidRecord.CHANGE_ACTIVE, change);
assertPendingChange(TEST_UID1, UidRecord.CHANGE_ACTIVE, PROCESS_STATE_FOREGROUND_SERVICE,
@@ -91,8 +93,8 @@
final ChangeRecord record2 = new ChangeRecord();
change = mUidObserverController.enqueueUidChange(record2, TEST_UID2,
- UidRecord.CHANGE_CACHED, PROCESS_STATE_CACHED_RECENT, PROCESS_CAPABILITY_NONE,
- 99, true);
+ UidRecord.CHANGE_CACHED, PROCESS_STATE_CACHED_RECENT, UNKNOWN_ADJ,
+ PROCESS_CAPABILITY_NONE, 99, true);
assertEquals("expected=ACTIVE,actual=" + changeToStr(change),
UidRecord.CHANGE_CACHED, change);
assertPendingChange(TEST_UID1, UidRecord.CHANGE_ACTIVE, PROCESS_STATE_FOREGROUND_SERVICE,
@@ -101,7 +103,8 @@
PROCESS_CAPABILITY_NONE, 99, true, record2);
change = mUidObserverController.enqueueUidChange(record1, TEST_UID1,
- UidRecord.CHANGE_UNCACHED, PROCESS_STATE_TOP, PROCESS_CAPABILITY_ALL, 0, false);
+ UidRecord.CHANGE_UNCACHED, PROCESS_STATE_TOP, UNKNOWN_ADJ,
+ PROCESS_CAPABILITY_ALL, 0, false);
assertEquals("expected=ACTIVE|UNCACHED,actual=" + changeToStr(change),
UidRecord.CHANGE_ACTIVE | UidRecord.CHANGE_UNCACHED, change);
assertPendingChange(TEST_UID1, UidRecord.CHANGE_ACTIVE | UidRecord.CHANGE_UNCACHED,
diff --git a/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncDataTest.java b/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncDataTest.java
index c5a9af7..dcd06c9 100644
--- a/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncDataTest.java
+++ b/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncDataTest.java
@@ -30,7 +30,7 @@
@Test
public void call_writeToParcel_fromParcel_reconstructsSuccessfully() {
final CallMetadataSyncData.Call call = new CallMetadataSyncData.Call();
- final long id = 5;
+ final String id = "5";
final String callerId = "callerId";
final byte[] appIcon = "appIcon".getBytes();
final String appName = "appName";
diff --git a/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncInCallServiceTest.java b/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncInCallServiceTest.java
index a488ab4..afddf3c 100644
--- a/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncInCallServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CallMetadataSyncInCallServiceTest.java
@@ -47,24 +47,24 @@
@Test
public void getCallForId_invalid() {
- when(mMockCrossDeviceCall.getId()).thenReturn(-1L);
- final CrossDeviceCall call = mSyncInCallService.getCallForId(-1L,
+ when(mMockCrossDeviceCall.getId()).thenReturn(null);
+ final CrossDeviceCall call = mSyncInCallService.getCallForId(null,
List.of(mMockCrossDeviceCall));
assertWithMessage("Unexpectedly found a match for call id").that(call).isNull();
}
@Test
public void getCallForId_noMatch() {
- when(mMockCrossDeviceCall.getId()).thenReturn(5L);
- final CrossDeviceCall call = mSyncInCallService.getCallForId(1L,
+ when(mMockCrossDeviceCall.getId()).thenReturn("123abc");
+ final CrossDeviceCall call = mSyncInCallService.getCallForId("abc123",
List.of(mMockCrossDeviceCall));
assertWithMessage("Unexpectedly found a match for call id").that(call).isNull();
}
@Test
public void getCallForId_hasMatch() {
- when(mMockCrossDeviceCall.getId()).thenReturn(5L);
- final CrossDeviceCall call = mSyncInCallService.getCallForId(5L,
+ when(mMockCrossDeviceCall.getId()).thenReturn("123abc");
+ final CrossDeviceCall call = mSyncInCallService.getCallForId("123abc",
List.of(mMockCrossDeviceCall));
assertWithMessage("Unexpectedly did not find a match for call id").that(call).isNotNull();
}
diff --git a/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CrossDeviceCallTest.java b/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CrossDeviceCallTest.java
index 9d42a5b..5a0646c 100644
--- a/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CrossDeviceCallTest.java
+++ b/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CrossDeviceCallTest.java
@@ -62,9 +62,9 @@
assertWithMessage("Wrong status").that(crossDeviceCall.getStatus())
.isEqualTo(android.companion.Telecom.Call.RINGING);
assertWithMessage("Wrong controls").that(crossDeviceCall.getControls())
- .isEqualTo(Set.of(android.companion.Telecom.Call.ACCEPT,
- android.companion.Telecom.Call.REJECT,
- android.companion.Telecom.Call.SILENCE));
+ .isEqualTo(Set.of(android.companion.Telecom.ACCEPT,
+ android.companion.Telecom.REJECT,
+ android.companion.Telecom.SILENCE));
}
@Test
@@ -77,9 +77,9 @@
assertWithMessage("Wrong status").that(crossDeviceCall.getStatus())
.isEqualTo(android.companion.Telecom.Call.ONGOING);
assertWithMessage("Wrong controls").that(crossDeviceCall.getControls())
- .isEqualTo(Set.of(android.companion.Telecom.Call.END,
- android.companion.Telecom.Call.MUTE,
- android.companion.Telecom.Call.PUT_ON_HOLD));
+ .isEqualTo(Set.of(android.companion.Telecom.END,
+ android.companion.Telecom.MUTE,
+ android.companion.Telecom.PUT_ON_HOLD));
}
@Test
@@ -92,8 +92,8 @@
assertWithMessage("Wrong status").that(crossDeviceCall.getStatus())
.isEqualTo(android.companion.Telecom.Call.ON_HOLD);
assertWithMessage("Wrong controls").that(crossDeviceCall.getControls())
- .isEqualTo(Set.of(android.companion.Telecom.Call.END,
- android.companion.Telecom.Call.TAKE_OFF_HOLD));
+ .isEqualTo(Set.of(android.companion.Telecom.END,
+ android.companion.Telecom.TAKE_OFF_HOLD));
}
@Test
@@ -106,8 +106,8 @@
assertWithMessage("Wrong status").that(crossDeviceCall.getStatus())
.isEqualTo(android.companion.Telecom.Call.ONGOING);
assertWithMessage("Wrong controls").that(crossDeviceCall.getControls())
- .isEqualTo(Set.of(android.companion.Telecom.Call.END,
- android.companion.Telecom.Call.MUTE));
+ .isEqualTo(Set.of(android.companion.Telecom.END,
+ android.companion.Telecom.MUTE));
}
@Test
@@ -120,8 +120,8 @@
assertWithMessage("Wrong status").that(crossDeviceCall.getStatus())
.isEqualTo(android.companion.Telecom.Call.ONGOING);
assertWithMessage("Wrong controls").that(crossDeviceCall.getControls())
- .isEqualTo(Set.of(android.companion.Telecom.Call.END,
- android.companion.Telecom.Call.PUT_ON_HOLD));
+ .isEqualTo(Set.of(android.companion.Telecom.END,
+ android.companion.Telecom.PUT_ON_HOLD));
}
@Test
@@ -134,17 +134,17 @@
assertWithMessage("Wrong status for ringing state").that(crossDeviceCall.getStatus())
.isEqualTo(android.companion.Telecom.Call.RINGING);
assertWithMessage("Wrong controls for ringing state").that(crossDeviceCall.getControls())
- .isEqualTo(Set.of(android.companion.Telecom.Call.ACCEPT,
- android.companion.Telecom.Call.REJECT,
- android.companion.Telecom.Call.SILENCE));
+ .isEqualTo(Set.of(android.companion.Telecom.ACCEPT,
+ android.companion.Telecom.REJECT,
+ android.companion.Telecom.SILENCE));
crossDeviceCall.updateCallDetails(createCallDetails(Call.STATE_ACTIVE,
Call.Details.CAPABILITY_HOLD | Call.Details.CAPABILITY_MUTE));
assertWithMessage("Wrong status for active state").that(crossDeviceCall.getStatus())
.isEqualTo(android.companion.Telecom.Call.ONGOING);
assertWithMessage("Wrong controls for active state").that(crossDeviceCall.getControls())
- .isEqualTo(Set.of(android.companion.Telecom.Call.END,
- android.companion.Telecom.Call.MUTE,
- android.companion.Telecom.Call.PUT_ON_HOLD));
+ .isEqualTo(Set.of(android.companion.Telecom.END,
+ android.companion.Telecom.MUTE,
+ android.companion.Telecom.PUT_ON_HOLD));
}
@Test
@@ -158,8 +158,8 @@
assertWithMessage("Wrong status").that(crossDeviceCall.getStatus())
.isEqualTo(android.companion.Telecom.Call.RINGING_SILENCED);
assertWithMessage("Wrong controls").that(crossDeviceCall.getControls())
- .isEqualTo(Set.of(android.companion.Telecom.Call.ACCEPT,
- android.companion.Telecom.Call.REJECT));
+ .isEqualTo(Set.of(android.companion.Telecom.ACCEPT,
+ android.companion.Telecom.REJECT));
}
@Test
@@ -173,9 +173,9 @@
assertWithMessage("Wrong status").that(crossDeviceCall.getStatus())
.isEqualTo(android.companion.Telecom.Call.ONGOING);
assertWithMessage("Wrong controls").that(crossDeviceCall.getControls())
- .isEqualTo(Set.of(android.companion.Telecom.Call.END,
- android.companion.Telecom.Call.MUTE,
- android.companion.Telecom.Call.PUT_ON_HOLD));
+ .isEqualTo(Set.of(android.companion.Telecom.END,
+ android.companion.Telecom.MUTE,
+ android.companion.Telecom.PUT_ON_HOLD));
}
@Test
diff --git a/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CrossDeviceSyncControllerTest.java b/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CrossDeviceSyncControllerTest.java
index eec026cc..25b0ae4 100644
--- a/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CrossDeviceSyncControllerTest.java
+++ b/services/tests/servicestests/src/com/android/server/companion/datatransfer/contextsync/CrossDeviceSyncControllerTest.java
@@ -81,7 +81,7 @@
@Test
public void processTelecomDataFromSync_createCallUpdateMessage_hasCalls() {
- when(mMockCrossDeviceCall.getId()).thenReturn(5L);
+ when(mMockCrossDeviceCall.getId()).thenReturn("123abc");
final String callerId = "Firstname Lastname";
when(mMockCrossDeviceCall.getReadableCallerId(anyBoolean())).thenReturn(callerId);
final String appName = "AppName";
@@ -90,9 +90,9 @@
when(mMockCrossDeviceCall.getCallingAppIcon()).thenReturn(appIcon.getBytes());
when(mMockCrossDeviceCall.getStatus()).thenReturn(android.companion.Telecom.Call.RINGING);
final Set<Integer> controls = Set.of(
- android.companion.Telecom.Call.ACCEPT,
- android.companion.Telecom.Call.REJECT,
- android.companion.Telecom.Call.SILENCE);
+ android.companion.Telecom.ACCEPT,
+ android.companion.Telecom.REJECT,
+ android.companion.Telecom.SILENCE);
when(mMockCrossDeviceCall.getControls()).thenReturn(controls);
final byte[] data = mCrossDeviceSyncController.createCallUpdateMessage(
new HashSet<>(List.of(mMockCrossDeviceCall)),
@@ -103,35 +103,33 @@
callMetadataSyncData.getCalls()).hasSize(1);
final CallMetadataSyncData.Call call =
callMetadataSyncData.getCalls().stream().findAny().orElseThrow();
- assertWithMessage("Wrong id").that(call.getId()).isEqualTo(5L);
+ assertWithMessage("Wrong id").that(call.getId()).isEqualTo("123abc");
assertWithMessage("Wrong app icon").that(new String(call.getAppIcon())).isEqualTo(appIcon);
assertWithMessage("Wrong app name").that(call.getAppName()).isEqualTo(appName);
assertWithMessage("Wrong caller id").that(call.getCallerId()).isEqualTo(callerId);
assertWithMessage("Wrong status").that(call.getStatus())
.isEqualTo(android.companion.Telecom.Call.RINGING);
assertWithMessage("Wrong controls").that(call.getControls()).isEqualTo(controls);
- assertWithMessage("Unexpectedly has requests").that(
- callMetadataSyncData.getRequests()).isEmpty();
}
@Test
public void processTelecomDataFromMessage_createCallControlMessage_hasCallControlRequest() {
final byte[] data = CrossDeviceSyncController.createCallControlMessage(
- /* callId= */ 5L, /* status= */ android.companion.Telecom.Call.ACCEPT);
+ /* callId= */ "123abc", /* status= */ android.companion.Telecom.ACCEPT);
final CallMetadataSyncData callMetadataSyncData =
mCrossDeviceSyncController.processTelecomDataFromSync(data);
assertWithMessage("Wrong number of requests").that(
callMetadataSyncData.getRequests()).hasSize(1);
final CallMetadataSyncData.Call call =
callMetadataSyncData.getRequests().stream().findAny().orElseThrow();
- assertWithMessage("Wrong id").that(call.getId()).isEqualTo(5L);
+ assertWithMessage("Wrong id").that(call.getId()).isEqualTo("123abc");
assertWithMessage("Wrong app icon").that(call.getAppIcon()).isNull();
assertWithMessage("Wrong app name").that(call.getAppName()).isNull();
assertWithMessage("Wrong caller id").that(call.getCallerId()).isNull();
assertWithMessage("Wrong status").that(call.getStatus())
.isEqualTo(android.companion.Telecom.Call.UNKNOWN_STATUS);
assertWithMessage("Wrong controls").that(call.getControls())
- .isEqualTo(Set.of(android.companion.Telecom.Call.ACCEPT));
+ .isEqualTo(Set.of(android.companion.Telecom.ACCEPT));
assertWithMessage("Unexpectedly has active calls").that(
callMetadataSyncData.getCalls()).isEmpty();
}
diff --git a/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java
index 2a7e2dc..43d0611 100644
--- a/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java
@@ -20,6 +20,7 @@
import static android.app.ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE;
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.MODE_ERRORED;
+import static android.os.PowerManager.USER_ACTIVITY_EVENT_BUTTON;
import static android.os.PowerManagerInternal.WAKEFULNESS_ASLEEP;
import static android.os.PowerManagerInternal.WAKEFULNESS_AWAKE;
import static android.os.PowerManagerInternal.WAKEFULNESS_DOZING;
@@ -41,6 +42,7 @@
import static org.mockito.ArgumentMatchers.same;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.atMost;
+import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
@@ -113,6 +115,7 @@
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;
+import java.time.Duration;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executor;
@@ -2494,4 +2497,18 @@
verify(mNotifierMock).onWakeLockReleased(anyInt(), eq(tag), eq(packageName), anyInt(),
anyInt(), any(), any(), same(callback2));
}
+
+ @Test
+ public void testUserActivity_futureEventsAreIgnored() {
+ createService();
+ startSystem();
+ // Starting the system triggers a user activity event, so clear that before calling
+ // userActivity() directly.
+ clearInvocations(mNotifierMock);
+ final long eventTime = mClock.now() + Duration.ofHours(10).toMillis();
+ mService.getBinderServiceInstance().userActivity(Display.DEFAULT_DISPLAY, eventTime,
+ USER_ACTIVITY_EVENT_BUTTON, /* flags= */ 0);
+ verify(mNotifierMock, never()).onUserActivity(anyInt(), anyInt(), anyInt());
+ }
+
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
index b46a3b9..95fc0fa 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
@@ -144,9 +144,6 @@
@RunWith(WindowTestRunner.class)
public class ActivityStarterTests extends WindowTestsBase {
- private static final String ENABLE_DEFAULT_RESCIND_BAL_PRIVILEGES_FROM_PENDING_INTENT_SENDER =
- "DefaultRescindBalPrivilegesFromPendingIntentSender__"
- + "enable_default_rescind_bal_privileges_from_pending_intent_sender";
private static final int PRECONDITION_NO_CALLER_APP = 1;
private static final int PRECONDITION_NO_INTENT_COMPONENT = 1 << 1;
private static final int PRECONDITION_NO_ACTIVITY_INFO = 1 << 2;
@@ -184,8 +181,6 @@
doReturn(AppOpsManager.MODE_DEFAULT).when(mAppOpsManager).checkOpNoThrow(
eq(AppOpsManager.OP_SYSTEM_EXEMPT_FROM_ACTIVITY_BG_START_RESTRICTION),
anyInt(), any());
- mDeviceConfig.set(ENABLE_DEFAULT_RESCIND_BAL_PRIVILEGES_FROM_PENDING_INTENT_SENDER,
- String.valueOf(true));
}
@After