diff options
author | Xin Li <delphij@google.com> | 2023-10-17 10:08:40 -0700 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2023-10-17 10:08:40 -0700 |
commit | a00b686adbf448efc7e1eb1f8f9be15ad506d518 (patch) | |
tree | c1ca87bac0d9a325eeba4c1dca2b1712fbd20a69 | |
parent | c757db2714deee8ae8b31a8e2df1e962e5c3aa33 (diff) | |
parent | 2f700bd30d8fb98311a8f0727e99fc8724222161 (diff) | |
download | services-tmp_amf_315507370.tar.gz |
Merge 10952656tmp_amf_315507370
Merged-In: I7c0a2e59a88effd96b76df0ce24e1910bc2df5af
Change-Id: Iace724478947667603b33a42b7e573c1ef175bd8
16 files changed, 122 insertions, 75 deletions
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg index 6f35a4e..1c7c842 100644 --- a/PREUPLOAD.cfg +++ b/PREUPLOAD.cfg @@ -1,6 +1,7 @@ [Hook Scripts] checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT} -annotation_classlist_repohook = ${REPO_ROOT}/frameworks/opt/car/services/tools/repohookScript/annotation_classlist_repohook.py ${REPO_ROOT} +# Annotation and any Car mainline related checks are disabled. +# annotation_classlist_repohook = ${REPO_ROOT}/frameworks/opt/car/services/tools/repohookScript/annotation_classlist_repohook.py ${REPO_ROOT} [Builtin Hooks] commit_msg_changeid_field = true diff --git a/builtInServices/api/module-lib-current.txt b/builtInServices/api/module-lib-current.txt index ed6de32..e625c2e 100644 --- a/builtInServices/api/module-lib-current.txt +++ b/builtInServices/api/module-lib-current.txt @@ -118,6 +118,7 @@ package com.android.server.wm { public final class TaskDisplayAreaWrapper { method public android.view.Display getDisplay(); + method public int getFeatureId(); } public final class TaskWrapper { diff --git a/builtInServices/prebuilts/mu_imms-prebuilt.jar b/builtInServices/prebuilts/mu_imms-prebuilt.jar Binary files differindex f2d0a50..0d4c93e 100644 --- a/builtInServices/prebuilts/mu_imms-prebuilt.jar +++ b/builtInServices/prebuilts/mu_imms-prebuilt.jar diff --git a/builtInServices/src/com/android/server/wm/TaskDisplayAreaWrapper.java b/builtInServices/src/com/android/server/wm/TaskDisplayAreaWrapper.java index 65c7ef3..5617ad3 100644 --- a/builtInServices/src/com/android/server/wm/TaskDisplayAreaWrapper.java +++ b/builtInServices/src/com/android/server/wm/TaskDisplayAreaWrapper.java @@ -56,6 +56,13 @@ public final class TaskDisplayAreaWrapper { return mTaskDisplayArea.mDisplayContent.getDisplay(); } + /** + * Gets the feature Id for this {@link TaskDisplayAreaWrapper}. + */ + public int getFeatureId() { + return mTaskDisplayArea.mFeatureId; + } + @Override public String toString() { return mTaskDisplayArea.toString(); diff --git a/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodBindingController.java b/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodBindingController.java index 546fc72..db5e4f6 100644 --- a/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodBindingController.java +++ b/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodBindingController.java @@ -352,6 +352,7 @@ final class CarInputMethodBindingController { clearCurMethodAndSessions(); mService.clearInputShownLocked(); mService.unbindCurrentClientLocked(UnbindReason.DISCONNECT_IME); + mService.resetSystemUiLocked(); } } } diff --git a/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodManagerService.java b/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodManagerService.java index 967fa0d..3311d22 100644 --- a/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodManagerService.java +++ b/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodManagerService.java @@ -46,6 +46,7 @@ import static android.view.WindowManager.DISPLAY_IME_POLICY_LOCAL; import static com.android.server.inputmethod.CarImeVisibilityStateComputer.ImeTargetWindowState; import static com.android.server.inputmethod.CarImeVisibilityStateComputer.ImeVisibilityResult; import static com.android.server.inputmethod.CarInputMethodBindingController.TIME_TO_RECONNECT; +import static com.android.server.inputmethod.ImeVisibilityStateComputer.STATE_HIDE_IME; import static com.android.server.inputmethod.InputMethodUtils.isSoftInputModeStateVisibleAllowed; import static java.lang.annotation.RetentionPolicy.SOURCE; @@ -2332,6 +2333,28 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub } } + /** + * Called when {@link #resetCurrentMethodAndClientLocked(int)} invoked for clean-up states + * before unbinding the current method. + */ + @GuardedBy("ImfLock.class") + void onUnbindCurrentMethodByReset() { + final ImeTargetWindowState winState = mVisibilityStateComputer.getWindowStateOrNull( + mCurFocusedWindow); + if (winState != null && !winState.isRequestedImeVisible() + && !mVisibilityStateComputer.isInputShown()) { + // Normally, the focus window will apply the IME visibility state to + // WindowManager when the IME has applied it. But it would be too late when + // switching IMEs in between different users. (Since the focused IME will + // first unbind the service to switch to bind the next user of the IME + // service, that wouldn't make the attached IME token validity check in time) + // As a result, we have to notify WM to apply IME visibility before clearing the + // binding states in the first place. + mVisibilityApplier.applyImeVisibility(mCurFocusedWindow, mCurStatsToken, + STATE_HIDE_IME); + } + } + /** {@code true} when a {@link ClientState} has attached from starting the input connection. */ @GuardedBy("ImfLock.class") boolean hasAttachedClient() { @@ -2803,6 +2826,8 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub @GuardedBy("ImfLock.class") void resetCurrentMethodAndClientLocked(@UnbindReason int unbindClientReason) { setSelectedMethodIdLocked(null); + // Callback before clean-up binding states. + onUnbindCurrentMethodByReset(); mBindingController.unbindCurrentMethod(); unbindCurrentClientLocked(unbindClientReason); } @@ -3015,7 +3040,12 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub @GuardedBy("ImfLock.class") private boolean shouldShowImeSwitcherLocked(int visibility) { if (!mShowOngoingImeSwitcherForPhones) return false; + // When the IME switcher dialog is shown, the IME switcher button should be hidden. if (mMenuController.getSwitchingDialogLocked() != null) return false; + // When we are switching IMEs, the IME switcher button should be hidden. + if (!Objects.equals(getCurIdLocked(), getSelectedMethodIdLocked())) { + return false; + } if (mWindowManagerInternal.isKeyguardShowingAndNotOccluded() && mWindowManagerInternal.isKeyguardSecure(mSettings.getCurrentUserId())) { return false; @@ -3170,7 +3200,12 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub } else { vis &= ~InputMethodService.IME_VISIBLE_IMPERCEPTIBLE; } - // mImeWindowVis should be updated before calling shouldShowImeSwitcherLocked(). + if (mMenuController.getSwitchingDialogLocked() != null + || !Objects.equals(getCurIdLocked(), getSelectedMethodIdLocked())) { + // When the IME switcher dialog is shown, or we are switching IMEs, + // the back button should be in the default state (as if the IME is not shown). + backDisposition = InputMethodService.BACK_DISPOSITION_ADJUST_NOTHING; + } final boolean needsToShowImeSwitcher = shouldShowImeSwitcherLocked(vis); if (mStatusBarManagerInternal != null) { mStatusBarManagerInternal.setImeWindowStatus(mCurTokenDisplayId, @@ -5740,7 +5775,7 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub // input target changed, in case seeing the dialog dismiss flickering during // the next focused window starting the input connection. if (mLastImeTargetWindow != mCurFocusedWindow) { - mMenuController.hideInputMethodMenu(); + mMenuController.hideInputMethodMenuLocked(); } } } diff --git a/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodMenuController.java b/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodMenuController.java index 7c110d8..a3bfd5e 100644 --- a/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodMenuController.java +++ b/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodMenuController.java @@ -175,13 +175,13 @@ final class CarInputMethodMenuController { int subtypeId = mSubtypeIds[which]; adapter.mCheckedItem = which; adapter.notifyDataSetChanged(); - hideInputMethodMenu(); if (im != null) { if (subtypeId < 0 || subtypeId >= im.getSubtypeCount()) { subtypeId = NOT_A_SUBTYPE_ID; } mService.setInputMethodLocked(im.getId(), subtypeId); } + hideInputMethodMenuLocked(); } }; mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, choiceListener); @@ -220,12 +220,18 @@ final class CarInputMethodMenuController { } } + /** + * Hides the input method switcher menu. + */ void hideInputMethodMenu() { synchronized (ImfLock.class) { hideInputMethodMenuLocked(); } } + /** + * Hides the input method switcher menu. + */ @GuardedBy("ImfLock.class") void hideInputMethodMenuLocked() { if (DEBUG) Slog.v(TAG, "Hide switching menu"); diff --git a/builtInServices/tests/Android.bp b/builtInServices/tests/Android.bp index 2936937..c679b93 100644 --- a/builtInServices/tests/Android.bp +++ b/builtInServices/tests/Android.bp @@ -45,4 +45,9 @@ android_test { "libstaticjvmtiagent", "libcarservicehelperjni", ], + + test_suites: [ + "general-tests", + "automotive-tests", + ], } diff --git a/builtInServices/tests/res/raw/CSHS_classes.txt b/builtInServices/tests/res/raw/CSHS_classes.txt deleted file mode 100644 index d584c38..0000000 --- a/builtInServices/tests/res/raw/CSHS_classes.txt +++ /dev/null @@ -1,16 +0,0 @@ -com.android.internal.car.CarServiceHelperServiceUpdatable -com.android.internal.car.CarServiceHelperInterface -com.android.server.wm.ActivityInterceptorInfoWrapper -com.android.server.wm.CarLaunchParamsModifierInterface -com.android.server.wm.TaskWrapper -com.android.server.wm.CarActivityInterceptorUpdatable -com.android.server.wm.ActivityInterceptResultWrapper -com.android.server.wm.WindowLayoutWrapper -com.android.server.wm.CarLaunchParamsModifierUpdatable -com.android.server.wm.TaskDisplayAreaWrapper -com.android.server.wm.CalculateParams -com.android.server.wm.LaunchParamsWrapper -com.android.server.wm.ActivityOptionsWrapper -com.android.server.wm.ActivityRecordWrapper -com.android.server.wm.RequestWrapper -com.android.server.wm.CarActivityInterceptorInterface diff --git a/builtInServices/tests/src/com/android/server/wm/AnnotationTest.java b/builtInServices/tests/src/com/android/server/wm/AnnotationTest.java deleted file mode 100644 index 4673f86..0000000 --- a/builtInServices/tests/src/com/android/server/wm/AnnotationTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.server.wm; - -import static android.car.test.util.AnnotationHelper.checkForAnnotation; - -import androidx.test.core.app.ApplicationProvider; - -import com.android.annotation.AddedIn; -import com.android.internal.car.R; - -import org.junit.Test; - -import java.io.IOException; -import java.io.InputStream; - -public class AnnotationTest { - @Test - public void testCarHelperServiceAPIAddedInAnnotation() throws Exception { - checkForAnnotation(readFile(R.raw.CSHS_classes), AddedIn.class); - } - - - private String[] readFile(int resourceId) throws IOException { - try (InputStream configurationStream = ApplicationProvider.getApplicationContext() - .getResources().openRawResource(resourceId)) { - return new String(configurationStream.readAllBytes()).split("\n"); - } - } -} - diff --git a/updatableServices/Android.bp b/updatableServices/Android.bp index 4b60f41..b6e7efc 100644 --- a/updatableServices/Android.bp +++ b/updatableServices/Android.bp @@ -20,14 +20,14 @@ java_library { "android.car.builtin", "car-frameworks-service", "framework-annotations-lib", - "modules-utils-preconditions", ], srcs: [ ":car-frameworks-updatable-service-sources", ], sdk_version: "module_current", - min_sdk_version: "33", + // TODO(b/288271411): enable it when car mainline module is supported + // min_sdk_version: "33", apex_available: [ "//apex_available:platform", "com.android.car.framework" diff --git a/updatableServices/src/com/android/internal/car/updatable/CarServiceHelperServiceUpdatableImpl.java b/updatableServices/src/com/android/internal/car/updatable/CarServiceHelperServiceUpdatableImpl.java index 5e6a746..a079414 100644 --- a/updatableServices/src/com/android/internal/car/updatable/CarServiceHelperServiceUpdatableImpl.java +++ b/updatableServices/src/com/android/internal/car/updatable/CarServiceHelperServiceUpdatableImpl.java @@ -308,7 +308,10 @@ public final class CarServiceHelperServiceUpdatableImpl return; } - mCarServiceProxy.dump(new IndentingPrintWriter(writer)); + IndentingPrintWriter pw = new IndentingPrintWriter(writer); + mCarServiceProxy.dump(pw); + mCarLaunchParamsModifierUpdatable.dump(pw); + mCarActivityInterceptorUpdatable.dump(pw); } @VisibleForTesting diff --git a/updatableServices/src/com/android/internal/car/updatable/CarServiceProxy.java b/updatableServices/src/com/android/internal/car/updatable/CarServiceProxy.java index 4f830cb..29955cc 100644 --- a/updatableServices/src/com/android/internal/car/updatable/CarServiceProxy.java +++ b/updatableServices/src/com/android/internal/car/updatable/CarServiceProxy.java @@ -46,7 +46,6 @@ import com.android.car.internal.util.DebugUtils; import com.android.car.internal.util.IndentingPrintWriter; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.util.Preconditions; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -383,8 +382,6 @@ final class CarServiceProxy { } switch (operationId) { case PO_ON_USER_REMOVED: - Preconditions.checkArgument((value instanceof UserHandle), - "invalid value passed to ON_USER_REMOVED", value); if (pendingOperation.value instanceof ArrayList) { if (DBG) Slogf.d(TAG, "Adding " + value + " to existing " + pendingOperation); ((ArrayList) pendingOperation.value).add(value); @@ -443,8 +440,6 @@ final class CarServiceProxy { @GuardedBy("mLock") private void onUserRemovedLocked(@NonNull Object value) throws RemoteException { - Preconditions.checkArgument((value instanceof UserHandle), - "Invalid value for ON_USER_REMOVED: %s", value); UserHandle user = (UserHandle) value; // TODO(235524989): Consolidating logging with other lifecycle events, // including user metrics. diff --git a/updatableServices/src/com/android/server/wm/CarActivityInterceptorUpdatableImpl.java b/updatableServices/src/com/android/server/wm/CarActivityInterceptorUpdatableImpl.java index ee0d999..1cb925d 100644 --- a/updatableServices/src/com/android/server/wm/CarActivityInterceptorUpdatableImpl.java +++ b/updatableServices/src/com/android/server/wm/CarActivityInterceptorUpdatableImpl.java @@ -29,6 +29,7 @@ import android.os.RemoteException; import android.util.ArrayMap; import android.util.ArraySet; +import com.android.car.internal.util.IndentingPrintWriter; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; @@ -165,4 +166,26 @@ public final class CarActivityInterceptorUpdatableImpl implements CarActivityInt return mActivityToRootTaskMap; } } + + /** + * Dump {code CarActivityInterceptorUpdatableImpl#mActivityToRootTaskMap} + */ + public void dump(IndentingPrintWriter writer) { + writer.println(TAG); + writer.increaseIndent(); + writer.println("Activity to root task map:"); + writer.increaseIndent(); + synchronized (mLock) { + if (mActivityToRootTaskMap.size() == 0) { + writer.println("No activity persisted on a root task"); + } else { + for (int i = 0; i < mActivityToRootTaskMap.size(); i++) { + writer.println("Activity name: " + mActivityToRootTaskMap.keyAt(i) + + " - Binder object: " + mActivityToRootTaskMap.valueAt(i)); + } + } + } + writer.decreaseIndent(); + writer.decreaseIndent(); + } } diff --git a/updatableServices/src/com/android/server/wm/CarLaunchParamsModifierUpdatableImpl.java b/updatableServices/src/com/android/server/wm/CarLaunchParamsModifierUpdatableImpl.java index a5e79b9..0be52fb 100644 --- a/updatableServices/src/com/android/server/wm/CarLaunchParamsModifierUpdatableImpl.java +++ b/updatableServices/src/com/android/server/wm/CarLaunchParamsModifierUpdatableImpl.java @@ -37,6 +37,7 @@ import android.util.Pair; import android.util.SparseIntArray; import android.view.Display; +import com.android.car.internal.util.IndentingPrintWriter; import com.android.car.internal.util.VersionUtils; import com.android.internal.annotations.GuardedBy; @@ -53,7 +54,7 @@ import java.util.List; @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) public final class CarLaunchParamsModifierUpdatableImpl implements CarLaunchParamsModifierUpdatable { - private static final String TAG = "CAR.LAUNCH"; + private static final String TAG = CarLaunchParamsModifierUpdatableImpl.class.getSimpleName(); private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG); // Comes from android.os.UserHandle.USER_NULL. private static final int USER_NULL = -10000; @@ -518,4 +519,30 @@ public final class CarLaunchParamsModifierUpdatableImpl } return CarActivityManager.RESULT_SUCCESS; } + + /** + * Dump {code CarLaunchParamsModifierUpdatableImpl#mPersistentActivities} + */ + public void dump(IndentingPrintWriter writer) { + writer.println(TAG); + writer.increaseIndent(); + writer.println("Persistent Activities:"); + writer.increaseIndent(); + synchronized (mLock) { + if (mPersistentActivities.size() == 0) { + writer.println("No activity persisted on a task display area"); + } else { + for (int i = 0; i < mPersistentActivities.size(); i++) { + TaskDisplayAreaWrapper taskDisplayAreaWrapper = + mPersistentActivities.valueAt(i); + writer.println( + "Activity name: " + mPersistentActivities.keyAt(i) + " - Display ID: " + + taskDisplayAreaWrapper.getDisplay().getDisplayId() + + " , Feature ID: " + taskDisplayAreaWrapper.getFeatureId()); + } + } + } + writer.decreaseIndent(); + writer.decreaseIndent(); + } } diff --git a/updatableServices/tests/Android.bp b/updatableServices/tests/Android.bp index 4c52a59..a25751f 100644 --- a/updatableServices/tests/Android.bp +++ b/updatableServices/tests/Android.bp @@ -47,4 +47,8 @@ android_test { "libstaticjvmtiagent", ], -} + test_suites: [ + "automotive-tests", + "automotive-general-tests", + ], +}
\ No newline at end of file |