From f6209830db9f104f61af2f0c541ec654d262d39b Mon Sep 17 00:00:00 2001 From: Filip Zakrzewski Date: Tue, 6 Jun 2023 23:41:49 +0000 Subject: Add test_suites to FrameworkOptCarServicesUpdatableTest Test: manual NO_BUG: minor addition to the build Change-Id: I8ef045def07d1020847313d9a2419d80b2c91c55 --- updatableServices/tests/Android.bp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/updatableServices/tests/Android.bp b/updatableServices/tests/Android.bp index c01ffeb..6322d8e 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 -- cgit v1.2.3 From 3044a7a5ae4c1fd096c7cc21ee11f64aa89aa535 Mon Sep 17 00:00:00 2001 From: Mayank Garg Date: Mon, 12 Jun 2023 12:22:56 -0700 Subject: Remove modules-utils-preconditions dependency Bug: 285866690 Test: m Change-Id: I5ac6d5c293a71940877fdee24c9238f6f244938b --- updatableServices/Android.bp | 1 - .../src/com/android/internal/car/updatable/CarServiceProxy.java | 5 ----- 2 files changed, 6 deletions(-) diff --git a/updatableServices/Android.bp b/updatableServices/Android.bp index 3069027..ab63886 100644 --- a/updatableServices/Android.bp +++ b/updatableServices/Android.bp @@ -20,7 +20,6 @@ java_library { "android.car.builtin", "car-frameworks-service", "framework-annotations-lib", - "modules-utils-preconditions", ], srcs: [ ":car-frameworks-updatable-service-sources", 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. -- cgit v1.2.3 From 49ff7e08a119bfa2ec9c9748f37facc46510bdc9 Mon Sep 17 00:00:00 2001 From: Mayank Garg Date: Wed, 21 Jun 2023 10:07:28 -0700 Subject: Removed min sdk version from car mainline Apks Bug: 288271411 Test: m (successful build) Change-Id: I7909974a720bc7078cd66fde4e529cbab9af13c6 --- updatableServices/Android.bp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/updatableServices/Android.bp b/updatableServices/Android.bp index 3069027..50374cf 100644 --- a/updatableServices/Android.bp +++ b/updatableServices/Android.bp @@ -27,7 +27,8 @@ java_library { ], 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" -- cgit v1.2.3 From dfdbb427ce40e46fdfb1c8d9ac385cc9a2549bce Mon Sep 17 00:00:00 2001 From: Antonio Kantek Date: Fri, 23 Jun 2023 19:47:45 +0000 Subject: Update mu_imms-prebuilt.jar Sync with: * I7980a68bca22009c364a635e557214da2ccf7fa9 * I9c0d521d372db8b33f4898eb25bdef1e6fc50e48 Notes for the reviewer: CarIMMS#shouldShowImeSwitcherLocked and CarIMMS#updateSystemUiLocked are affected by both CLs. Bug: 288601525 Test: atest InputMethodManagerServiceProxyTest Test: manual Change-Id: I2cb5dc50da405221aea60c7db1bef0228a66e036 --- builtInServices/prebuilts/mu_imms-prebuilt.jar | Bin 158987 -> 158995 bytes .../CarInputMethodBindingController.java | 1 + .../inputmethod/CarInputMethodManagerService.java | 99 ++++++++++++--------- .../inputmethod/CarInputMethodMenuController.java | 8 +- 4 files changed, 66 insertions(+), 42 deletions(-) diff --git a/builtInServices/prebuilts/mu_imms-prebuilt.jar b/builtInServices/prebuilts/mu_imms-prebuilt.jar index f2d0a50..a5b2410 100644 Binary files a/builtInServices/prebuilts/mu_imms-prebuilt.jar and b/builtInServices/prebuilts/mu_imms-prebuilt.jar differ 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..7f833d3 100644 --- a/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodManagerService.java +++ b/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodManagerService.java @@ -640,8 +640,9 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub private InputMethodSubtype mCurrentSubtype; /** - * {@code true} if the IME has not been mostly hidden via {@link android.view.InsetsController} + * {@code true} if the IME has not been mostly hidden via {@link android.view.InsetsController}. */ + @GuardedBy("ImfLock.class") private boolean mCurPerceptible; /** @@ -755,33 +756,26 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub SparseArray mEnabledAccessibilitySessions = new SparseArray<>(); /** - * True if the device is currently interactive with user. The value is true initially. + * {@code true} if the device is currently interactive with the user, initially true. + * + * @see #handleSetInteractive */ + @GuardedBy("ImfLock.class") boolean mIsInteractive = true; + @GuardedBy("ImfLock.class") + @InputMethodService.BackDispositionMode int mBackDisposition = InputMethodService.BACK_DISPOSITION_DEFAULT; /** - * A set of status bits regarding the active IME. + * The {@link InputMethodService.ImeWindowVisibility} of the currently bound IME, + * or {@code 0} if no IME is bound. * - *

This value is a combination of following two bits:

- *
- *
{@link InputMethodService#IME_ACTIVE}
- *
- * If this bit is ON, connected IME is ready to accept touch/key events. - *
- *
{@link InputMethodService#IME_VISIBLE}
- *
- * If this bit is ON, some of IME view, e.g. software input, candidate view, is visible. - *
- *
{@link InputMethodService#IME_INVISIBLE}
- *
If this bit is ON, IME is ready with views from last EditorInfo but is - * currently invisible. - *
- *
- * Do not update this value outside of {@link #setImeWindowStatus(IBinder, int, int)} and + *

Do not update this value outside of {@link #setImeWindowStatus(IBinder, int, int)} and * {@link InputMethodBindingController#unbindCurrentMethod()}. */ + @GuardedBy("ImfLock.class") + @InputMethodService.ImeWindowVisibility int mImeWindowVis; private LocaleList mLastSystemLocales; @@ -1522,7 +1516,6 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub // Uh oh, current input method is no longer around! // Pick another one... Slog.i(TAG, "Current input method removed: " + curInputMethodId); - updateSystemUiLocked(0 /* vis */, mBackDisposition); if (!chooseNewDefaultIMELocked()) { changed = true; curIm = null; @@ -2903,7 +2896,6 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub sessionState.mSession.finishSession(); } catch (RemoteException e) { Slog.w(TAG, "Session failed to close due to remote exception", e); - updateSystemUiLocked(0 /* vis */, mBackDisposition); } sessionState.mSession = null; } @@ -3013,15 +3005,20 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub } @GuardedBy("ImfLock.class") - private boolean shouldShowImeSwitcherLocked(int visibility) { + private boolean shouldShowImeSwitcherLocked( + @InputMethodService.ImeWindowVisibility 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; } - if ((visibility & InputMethodService.IME_ACTIVE) == 0 - || (visibility & InputMethodService.IME_INVISIBLE) != 0) { + if ((visibility & InputMethodService.IME_ACTIVE) == 0) { return false; } if (mWindowManagerInternal.isHardKeyboardAvailable()) { @@ -3080,7 +3077,9 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub @BinderThread @SuppressWarnings("deprecation") - private void setImeWindowStatus(@NonNull IBinder token, int vis, int backDisposition) { + private void setImeWindowStatus(@NonNull IBinder token, + @InputMethodService.ImeWindowVisibility int vis, + @InputMethodService.BackDispositionMode int backDisposition) { final int topFocusedDisplayId = mWindowManagerInternal.getTopFocusedDisplayId(); synchronized (ImfLock.class) { @@ -3097,7 +3096,7 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub } mImeWindowVis = vis; mBackDisposition = backDisposition; - updateSystemUiLocked(vis, backDisposition); + updateSystemUiLocked(mImeWindowVis, mBackDisposition); } final boolean dismissImeOnBackKeyPressed; @@ -3132,37 +3131,46 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub private void updateImeWindowStatus(boolean disableImeIcon) { synchronized (ImfLock.class) { - if (disableImeIcon) { - updateSystemUiLocked(0, mBackDisposition); - } else { - updateSystemUiLocked(); - } + // TODO(b/285109020): disableImeIcon should be stored in a property like + // mIsSwitcherIconDisabled, but it is currently not reliably cleared. + updateSystemUiLocked(disableImeIcon ? 0 : mImeWindowVis, mBackDisposition); } } @GuardedBy("ImfLock.class") void updateSystemUiLocked() { + // This is only used by InputMethodMenuController to trigger the IME switcher icon + // visibility, by having {@code shouldShowImeSwitcherLocked} called, which depends on the + // visibility of the IME switcher dialog. updateSystemUiLocked(mImeWindowVis, mBackDisposition); } // Caution! This method is called in this class. Handle multi-user carefully @GuardedBy("ImfLock.class") - private void updateSystemUiLocked(int vis, int backDisposition) { + private void updateSystemUiLocked(@InputMethodService.ImeWindowVisibility int vis, + @InputMethodService.BackDispositionMode int backDisposition) { if (getCurTokenLocked() == null) { return; } if (DEBUG) { Slog.d(TAG, "IME window vis: " + vis - + " active: " + (vis & InputMethodService.IME_ACTIVE) - + " inv: " + (vis & InputMethodService.IME_INVISIBLE) + + " active: " + ((vis & InputMethodService.IME_ACTIVE) != 0) + + " visible: " + ((vis & InputMethodService.IME_VISIBLE) != 0) + + " backDisposition: " + backDisposition + + " isInteractive: " + mIsInteractive + + " curPerceptible: " + mCurPerceptible + " displayId: " + mCurTokenDisplayId); } // TODO: Move this clearing calling identity block to setImeWindowStatus after making sure - // all updateSystemUi happens on system privilege. + // all updateSystemUi happens on system privilege. final long ident = Binder.clearCallingIdentity(); try { - if (!mCurPerceptible) { + if (!mIsInteractive) { + // When we are not interactive, + // the visibility should be 0 (no IME icons should be shown). + vis = 0; + } else if (!mCurPerceptible) { if ((vis & InputMethodService.IME_VISIBLE) != 0) { vis &= ~InputMethodService.IME_VISIBLE; vis |= InputMethodService.IME_VISIBLE_IMPERCEPTIBLE; @@ -3170,7 +3178,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, @@ -3492,7 +3505,7 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub return; } mCurPerceptible = perceptible; - updateSystemUiLocked(); + updateSystemUiLocked(mImeWindowVis, mBackDisposition); } }); } @@ -5054,8 +5067,11 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub private void handleSetInteractive(final boolean interactive) { synchronized (ImfLock.class) { + if (mIsInteractive == interactive) { + return; + } mIsInteractive = interactive; - updateSystemUiLocked(interactive ? mImeWindowVis : 0, mBackDisposition); + updateSystemUiLocked(mImeWindowVis, mBackDisposition); // Inform the current client of the change in active status if (mCurClient == null || mCurClient.mClient == null) { @@ -5740,7 +5756,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(); } } } @@ -6699,7 +6715,8 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub @BinderThread @Override - public void setImeWindowStatusAsync(int vis, int backDisposition) { + public void setImeWindowStatusAsync(@InputMethodService.ImeWindowVisibility int vis, + @InputMethodService.BackDispositionMode int backDisposition) { mImms.setImeWindowStatus(mToken, vis, backDisposition); } 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"); -- cgit v1.2.3 From 642cfa4d8187d8beba7c0f22816f8cdbec432209 Mon Sep 17 00:00:00 2001 From: Antonio Kantek Date: Wed, 28 Jun 2023 18:28:05 +0000 Subject: Update mu_imms-prebuilt.jar Sync with: * Iaa074a2b368c903aff4c87daca375744001e217f * I0873ec065722e9e0b22dd5010d3415d3704cfd2d Bug: 288601525 Test: atest InputMethodManagerServiceProxyTest Test: manual Change-Id: I60d42dd327fe24fe7158ab1f8f9261758953b8d9 --- builtInServices/prebuilts/mu_imms-prebuilt.jar | Bin 158995 -> 159172 bytes .../inputmethod/CarInputMethodManagerService.java | 110 ++++++++++++--------- 2 files changed, 64 insertions(+), 46 deletions(-) diff --git a/builtInServices/prebuilts/mu_imms-prebuilt.jar b/builtInServices/prebuilts/mu_imms-prebuilt.jar index a5b2410..0d4c93e 100644 Binary files a/builtInServices/prebuilts/mu_imms-prebuilt.jar and b/builtInServices/prebuilts/mu_imms-prebuilt.jar differ diff --git a/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodManagerService.java b/builtInServices/src_imms/com/android/server/inputmethod/CarInputMethodManagerService.java index 7f833d3..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; @@ -640,9 +641,8 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub private InputMethodSubtype mCurrentSubtype; /** - * {@code true} if the IME has not been mostly hidden via {@link android.view.InsetsController}. + * {@code true} if the IME has not been mostly hidden via {@link android.view.InsetsController} */ - @GuardedBy("ImfLock.class") private boolean mCurPerceptible; /** @@ -756,26 +756,33 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub SparseArray mEnabledAccessibilitySessions = new SparseArray<>(); /** - * {@code true} if the device is currently interactive with the user, initially true. - * - * @see #handleSetInteractive + * True if the device is currently interactive with user. The value is true initially. */ - @GuardedBy("ImfLock.class") boolean mIsInteractive = true; - @GuardedBy("ImfLock.class") - @InputMethodService.BackDispositionMode int mBackDisposition = InputMethodService.BACK_DISPOSITION_DEFAULT; /** - * The {@link InputMethodService.ImeWindowVisibility} of the currently bound IME, - * or {@code 0} if no IME is bound. + * A set of status bits regarding the active IME. * - *

Do not update this value outside of {@link #setImeWindowStatus(IBinder, int, int)} and + *

This value is a combination of following two bits:

+ *
+ *
{@link InputMethodService#IME_ACTIVE}
+ *
+ * If this bit is ON, connected IME is ready to accept touch/key events. + *
+ *
{@link InputMethodService#IME_VISIBLE}
+ *
+ * If this bit is ON, some of IME view, e.g. software input, candidate view, is visible. + *
+ *
{@link InputMethodService#IME_INVISIBLE}
+ *
If this bit is ON, IME is ready with views from last EditorInfo but is + * currently invisible. + *
+ *
+ * Do not update this value outside of {@link #setImeWindowStatus(IBinder, int, int)} and * {@link InputMethodBindingController#unbindCurrentMethod()}. */ - @GuardedBy("ImfLock.class") - @InputMethodService.ImeWindowVisibility int mImeWindowVis; private LocaleList mLastSystemLocales; @@ -1516,6 +1523,7 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub // Uh oh, current input method is no longer around! // Pick another one... Slog.i(TAG, "Current input method removed: " + curInputMethodId); + updateSystemUiLocked(0 /* vis */, mBackDisposition); if (!chooseNewDefaultIMELocked()) { changed = true; curIm = null; @@ -2325,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() { @@ -2796,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); } @@ -2896,6 +2928,7 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub sessionState.mSession.finishSession(); } catch (RemoteException e) { Slog.w(TAG, "Session failed to close due to remote exception", e); + updateSystemUiLocked(0 /* vis */, mBackDisposition); } sessionState.mSession = null; } @@ -3005,8 +3038,7 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub } @GuardedBy("ImfLock.class") - private boolean shouldShowImeSwitcherLocked( - @InputMethodService.ImeWindowVisibility int visibility) { + 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; @@ -3018,7 +3050,8 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub && mWindowManagerInternal.isKeyguardSecure(mSettings.getCurrentUserId())) { return false; } - if ((visibility & InputMethodService.IME_ACTIVE) == 0) { + if ((visibility & InputMethodService.IME_ACTIVE) == 0 + || (visibility & InputMethodService.IME_INVISIBLE) != 0) { return false; } if (mWindowManagerInternal.isHardKeyboardAvailable()) { @@ -3077,9 +3110,7 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub @BinderThread @SuppressWarnings("deprecation") - private void setImeWindowStatus(@NonNull IBinder token, - @InputMethodService.ImeWindowVisibility int vis, - @InputMethodService.BackDispositionMode int backDisposition) { + private void setImeWindowStatus(@NonNull IBinder token, int vis, int backDisposition) { final int topFocusedDisplayId = mWindowManagerInternal.getTopFocusedDisplayId(); synchronized (ImfLock.class) { @@ -3096,7 +3127,7 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub } mImeWindowVis = vis; mBackDisposition = backDisposition; - updateSystemUiLocked(mImeWindowVis, mBackDisposition); + updateSystemUiLocked(vis, backDisposition); } final boolean dismissImeOnBackKeyPressed; @@ -3131,46 +3162,37 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub private void updateImeWindowStatus(boolean disableImeIcon) { synchronized (ImfLock.class) { - // TODO(b/285109020): disableImeIcon should be stored in a property like - // mIsSwitcherIconDisabled, but it is currently not reliably cleared. - updateSystemUiLocked(disableImeIcon ? 0 : mImeWindowVis, mBackDisposition); + if (disableImeIcon) { + updateSystemUiLocked(0, mBackDisposition); + } else { + updateSystemUiLocked(); + } } } @GuardedBy("ImfLock.class") void updateSystemUiLocked() { - // This is only used by InputMethodMenuController to trigger the IME switcher icon - // visibility, by having {@code shouldShowImeSwitcherLocked} called, which depends on the - // visibility of the IME switcher dialog. updateSystemUiLocked(mImeWindowVis, mBackDisposition); } // Caution! This method is called in this class. Handle multi-user carefully @GuardedBy("ImfLock.class") - private void updateSystemUiLocked(@InputMethodService.ImeWindowVisibility int vis, - @InputMethodService.BackDispositionMode int backDisposition) { + private void updateSystemUiLocked(int vis, int backDisposition) { if (getCurTokenLocked() == null) { return; } if (DEBUG) { Slog.d(TAG, "IME window vis: " + vis - + " active: " + ((vis & InputMethodService.IME_ACTIVE) != 0) - + " visible: " + ((vis & InputMethodService.IME_VISIBLE) != 0) - + " backDisposition: " + backDisposition - + " isInteractive: " + mIsInteractive - + " curPerceptible: " + mCurPerceptible + + " active: " + (vis & InputMethodService.IME_ACTIVE) + + " inv: " + (vis & InputMethodService.IME_INVISIBLE) + " displayId: " + mCurTokenDisplayId); } // TODO: Move this clearing calling identity block to setImeWindowStatus after making sure - // all updateSystemUi happens on system privilege. + // all updateSystemUi happens on system privilege. final long ident = Binder.clearCallingIdentity(); try { - if (!mIsInteractive) { - // When we are not interactive, - // the visibility should be 0 (no IME icons should be shown). - vis = 0; - } else if (!mCurPerceptible) { + if (!mCurPerceptible) { if ((vis & InputMethodService.IME_VISIBLE) != 0) { vis &= ~InputMethodService.IME_VISIBLE; vis |= InputMethodService.IME_VISIBLE_IMPERCEPTIBLE; @@ -3505,7 +3527,7 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub return; } mCurPerceptible = perceptible; - updateSystemUiLocked(mImeWindowVis, mBackDisposition); + updateSystemUiLocked(); } }); } @@ -5067,11 +5089,8 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub private void handleSetInteractive(final boolean interactive) { synchronized (ImfLock.class) { - if (mIsInteractive == interactive) { - return; - } mIsInteractive = interactive; - updateSystemUiLocked(mImeWindowVis, mBackDisposition); + updateSystemUiLocked(interactive ? mImeWindowVis : 0, mBackDisposition); // Inform the current client of the change in active status if (mCurClient == null || mCurClient.mClient == null) { @@ -6715,8 +6734,7 @@ public final class CarInputMethodManagerService extends IInputMethodManager.Stub @BinderThread @Override - public void setImeWindowStatusAsync(@InputMethodService.ImeWindowVisibility int vis, - @InputMethodService.BackDispositionMode int backDisposition) { + public void setImeWindowStatusAsync(int vis, int backDisposition) { mImms.setImeWindowStatus(mToken, vis, backDisposition); } -- cgit v1.2.3 From aecb59e46fb078673638fb4a078a097a311ea697 Mon Sep 17 00:00:00 2001 From: Mayank Garg Date: Mon, 14 Aug 2023 11:47:49 -0700 Subject: Disable repohook for Car mainline related changes Bug: 295906237 Test: Manual Change-Id: I828b8e44631e2c603be313cc35aadec68cbb1716 --- PREUPLOAD.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3 From 716884d3d648f1da737f673951daf2d9f9150fcb Mon Sep 17 00:00:00 2001 From: Mayank Garg Date: Mon, 14 Aug 2023 12:27:12 -0700 Subject: Remove AnnotationTest for CSHS The test checks ApiRequirement and AddedIn annotation. These annotations are no longer required, so the test is also no longer required. Bug: 295910517 Test: m Change-Id: I13125bd02389c87061674017cf670a8d5fd36386 --- builtInServices/tests/res/raw/CSHS_classes.txt | 16 -------- .../src/com/android/server/wm/AnnotationTest.java | 45 ---------------------- 2 files changed, 61 deletions(-) delete mode 100644 builtInServices/tests/res/raw/CSHS_classes.txt delete mode 100644 builtInServices/tests/src/com/android/server/wm/AnnotationTest.java 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"); - } - } -} - -- cgit v1.2.3 From eb655c50db31b9dd3a86d3b2be427165682d77d9 Mon Sep 17 00:00:00 2001 From: Rachit Jain Date: Mon, 28 Aug 2023 17:08:20 +0000 Subject: Dump the persistent activities map from CarLaunchParamsModifierUpdatableImpl and CarActivityInterceptorUpdatableImpl Bug: 280358563 Test: adb shell dumpsys > log.txt Search for CarActivityInterceptorUpdatableImpl and CarLaunchParamsModifierUpdatableImpl (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c90c7f2354ef0ae2ba5cccee1db9b61da43916c9) Change-Id: Icd13059f5db69de6e9d660b98f5a08b2c5b8f5ea --- builtInServices/api/module-lib-current.txt | 1 + .../android/server/wm/TaskDisplayAreaWrapper.java | 7 ++++++ .../CarServiceHelperServiceUpdatableImpl.java | 5 +++- .../wm/CarActivityInterceptorUpdatableImpl.java | 23 +++++++++++++++++ .../wm/CarLaunchParamsModifierUpdatableImpl.java | 29 +++++++++++++++++++++- 5 files changed, 63 insertions(+), 2 deletions(-) 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/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/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/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(); + } } -- cgit v1.2.3 From 4c6b1768525449a5b6fd3b87388ed3f6e538fce0 Mon Sep 17 00:00:00 2001 From: Filip Zakrzewski Date: Wed, 20 Sep 2023 00:28:50 +0000 Subject: Add missing automotive-tests suite for FrameworkOptCarServicesTest Bug: 301167357 Change-Id: I9ec2f70c82c99c367b278cd2a29797ac70c98fee Test: manual verification --- builtInServices/tests/Android.bp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/builtInServices/tests/Android.bp b/builtInServices/tests/Android.bp index eb0346f..2126872 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", + ], } -- cgit v1.2.3