Loading PREUPLOAD.cfg +2 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,8 @@ clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp services/incremental/ [Hook Scripts] checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT} strings_lint_hook = ${REPO_ROOT}/frameworks/base/tools/stringslint/stringslint_sha.sh ${PREUPLOAD_COMMIT} hidden_api_txt_checksorted_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT} Loading core/java/android/view/ImeFocusController.java +5 −5 Original line number Diff line number Diff line Loading @@ -125,11 +125,11 @@ public final class ImeFocusController { final View viewForWindowFocus = focusedView != null ? focusedView : mViewRootImpl.mView; onViewFocusChanged(viewForWindowFocus, true); // Skip starting input when the next focused view is same as served view and the served // input connection still exists. // Starting new input when the next focused view is same as served view but the // editor is not aligned with the same editor or editor is inactive. final boolean nextFocusIsServedView = mServedView != null && mServedView == focusedView; if (nextFocusIsServedView && immDelegate.isAcceptingText()) { forceFocus = false; if (nextFocusIsServedView && !immDelegate.isSameEditorAndAcceptingText(focusedView)) { forceFocus = true; } immDelegate.startInputAsyncOnWindowFocusGain(viewForWindowFocus, Loading Loading @@ -254,7 +254,7 @@ public final class ImeFocusController { void setCurrentRootView(ViewRootImpl rootView); boolean isCurrentRootView(ViewRootImpl rootView); boolean isRestartOnNextWindowFocus(boolean reset); boolean isAcceptingText(); boolean isSameEditorAndAcceptingText(View view); } public View getServedView() { Loading core/java/android/view/inputmethod/InputMethodManager.java +31 −15 Original line number Diff line number Diff line Loading @@ -633,20 +633,21 @@ public final class InputMethodManager { // we'll just do a window focus gain and call it a day. try { View servedView = controller.getServedView(); boolean nextFocusIsServedView = servedView != null && servedView == focusedView; boolean nextFocusSameEditor = servedView != null && servedView == focusedView && isSameEditorAndAcceptingText(focusedView); if (DEBUG) { Log.v(TAG, "Reporting focus gain, without startInput" + ", nextFocusIsServedView=" + nextFocusIsServedView); + ", nextFocusIsServedView=" + nextFocusSameEditor); } final int startInputReason = nextFocusIsServedView ? WINDOW_FOCUS_GAIN_REPORT_WITH_SAME_EDITOR nextFocusSameEditor ? WINDOW_FOCUS_GAIN_REPORT_WITH_SAME_EDITOR : WINDOW_FOCUS_GAIN_REPORT_WITHOUT_EDITOR; mService.startInputOrWindowGainedFocus( startInputReason, mClient, focusedView.getWindowToken(), startInputFlags, softInputMode, windowFlags, nextFocusIsServedView ? mCurrentTextBoxAttribute : null, nextFocusIsServedView ? mServedInputConnectionWrapper : null, null, null, 0 /* missingMethodFlags */, mCurRootView.mContext.getApplicationInfo().targetSdkVersion); } catch (RemoteException e) { Loading @@ -671,10 +672,6 @@ public final class InputMethodManager { @Override public void setCurrentRootView(ViewRootImpl rootView) { synchronized (mH) { if (mCurRootView != null) { // Restart the input when the next window focus state of the root view changed. mRestartOnNextWindowFocus = true; } mCurRootView = rootView; } } Loading Loading @@ -704,14 +701,33 @@ public final class InputMethodManager { } /** * For {@link ImeFocusController} to check if the currently served view is accepting full * text edits. * For {@link ImeFocusController} to check if the given focused view aligns with the same * editor and the editor is active to accept the text input. * * TODO(b/160968797): Remove this method and move mCurrentTextBoxAttritube to * ImeFocusController. * In the long-term, we should make mCurrentTextBoxAtrtribue as per-window base instance, * so that we we can directly check if the current focused view aligned with the same editor * in the window without using this checking. * * Note that this method is only use for fixing start new input may ignored issue * (e.g. b/160391516), DO NOT leverage this method to do another check. */ @Override public boolean isAcceptingText() { public boolean isSameEditorAndAcceptingText(View view) { synchronized (mH) { return mServedInputConnectionWrapper != null && mServedInputConnectionWrapper.getInputConnection() != null; if (!hasServedByInputMethodLocked(view) || mCurrentTextBoxAttribute == null) { return false; } final EditorInfo ic = mCurrentTextBoxAttribute; // This sameEditor checking is based on using object hash comparison to check if // some fields of the current EditorInfo (e.g. autoFillId, OpPackageName) the // hash code is same as the given focused view. final boolean sameEditor = view.onCheckIsTextEditor() && view.getId() == ic.fieldId && view.getAutofillId() == ic.autofillId && view.getContext().getOpPackageName() == ic.packageName; return sameEditor && mServedInputConnectionWrapper != null && mServedInputConnectionWrapper.isActive(); } } } Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java +29 −5 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ public class SyncRtSurfaceTransactionApplierCompat { public static final int FLAG_CORNER_RADIUS = 1 << 4; public static final int FLAG_BACKGROUND_BLUR_RADIUS = 1 << 5; public static final int FLAG_VISIBILITY = 1 << 6; public static final int FLAG_RELATIVE_LAYER = 1 << 7; private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0; Loading Loading @@ -192,6 +193,8 @@ public class SyncRtSurfaceTransactionApplierCompat { Matrix matrix; Rect windowCrop; int layer; SurfaceControl relativeTo; int relativeLayer; boolean visible; /** Loading Loading @@ -248,6 +251,18 @@ public class SyncRtSurfaceTransactionApplierCompat { return this; } /** * @param relativeTo The surface that's set relative layer to. * @param relativeLayer The relative layer. * @return this Builder */ public Builder withRelativeLayerTo(SurfaceControl relativeTo, int relativeLayer) { this.relativeTo = relativeTo; this.relativeLayer = relativeLayer; flags |= FLAG_RELATIVE_LAYER; return this; } /** * @param radius the Radius for rounded corners to apply to the surface. * @return this Builder Loading Loading @@ -283,7 +298,7 @@ public class SyncRtSurfaceTransactionApplierCompat { */ public SurfaceParams build() { return new SurfaceParams(surface, flags, alpha, matrix, windowCrop, layer, cornerRadius, backgroundBlurRadius, visible); relativeTo, relativeLayer, cornerRadius, backgroundBlurRadius, visible); } } Loading @@ -297,21 +312,25 @@ public class SyncRtSurfaceTransactionApplierCompat { * @param windowCrop Crop to apply, only applied if not {@code null} */ public SurfaceParams(SurfaceControlCompat surface, float alpha, Matrix matrix, Rect windowCrop, int layer, float cornerRadius) { Rect windowCrop, int layer, SurfaceControl relativeTo, int relativeLayer, float cornerRadius) { this(surface.mSurfaceControl, FLAG_ALL & ~(FLAG_VISIBILITY | FLAG_BACKGROUND_BLUR_RADIUS), alpha, matrix, windowCrop, layer, cornerRadius, 0 /* backgroundBlurRadius */, true); matrix, windowCrop, layer, relativeTo, relativeLayer, cornerRadius, 0 /* backgroundBlurRadius */, true); } private SurfaceParams(SurfaceControl surface, int flags, float alpha, Matrix matrix, Rect windowCrop, int layer, float cornerRadius, int backgroundBlurRadius, boolean visible) { Rect windowCrop, int layer, SurfaceControl relativeTo, int relativeLayer, float cornerRadius, int backgroundBlurRadius, boolean visible) { this.flags = flags; this.surface = surface; this.alpha = alpha; this.matrix = new Matrix(matrix); this.windowCrop = windowCrop != null ? new Rect(windowCrop) : null; this.layer = layer; this.relativeTo = relativeTo; this.relativeLayer = relativeLayer; this.cornerRadius = cornerRadius; this.backgroundBlurRadius = backgroundBlurRadius; this.visible = visible; Loading @@ -327,6 +346,8 @@ public class SyncRtSurfaceTransactionApplierCompat { public final Matrix matrix; public final Rect windowCrop; public final int layer; public final SurfaceControl relativeTo; public final int relativeLayer; public final boolean visible; public void applyTo(SurfaceControl.Transaction t) { Loading Loading @@ -355,6 +376,9 @@ public class SyncRtSurfaceTransactionApplierCompat { t.hide(surface); } } if ((flags & FLAG_RELATIVE_LAYER) != 0) { t.setRelativeLayer(surface, relativeTo, relativeLayer); } } } } packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +18 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private final Context mContext; private final boolean mIsPrimaryUser; private final boolean mIsAutomotive; private final StatusBarStateController mStatusBarStateController; HashMap<Integer, SimData> mSimDatas = new HashMap<>(); HashMap<Integer, ServiceState> mServiceStates = new HashMap<Integer, ServiceState>(); Loading Loading @@ -1770,6 +1771,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mFaceManager.addLockoutResetCallback(mFaceLockoutResetCallback); } mIsAutomotive = isAutomotive(); ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener); mUserManager = context.getSystemService(UserManager.class); mIsPrimaryUser = mUserManager.isPrimaryUser(); Loading Loading @@ -2484,6 +2487,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab .addCategory(Intent.CATEGORY_HOME); ResolveInfo resolveInfo = mContext.getPackageManager().resolveActivity(homeIntent, 0 /* flags */); // TODO(b/160971249): Replace in the future by resolving activity as user. if (resolveInfo == null && mIsAutomotive) { Log.w(TAG, "resolveNeedsSlowUnlockTransition: returning false since activity " + "could not be resolved."); return false; } return FALLBACK_HOME_COMPONENT.equals(resolveInfo.getComponentInfo().getComponentName()); } Loading Loading @@ -2554,6 +2565,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab return false; } private boolean isAutomotive() { return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE); } /** * Remove the given observer's callback. * Loading Loading @@ -2990,5 +3005,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab pw.println(" " + time + " " + model.toString()); } } if (mIsAutomotive) { pw.println(" Running on Automotive build"); } } } Loading
PREUPLOAD.cfg +2 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,8 @@ clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp services/incremental/ [Hook Scripts] checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT} strings_lint_hook = ${REPO_ROOT}/frameworks/base/tools/stringslint/stringslint_sha.sh ${PREUPLOAD_COMMIT} hidden_api_txt_checksorted_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT} Loading
core/java/android/view/ImeFocusController.java +5 −5 Original line number Diff line number Diff line Loading @@ -125,11 +125,11 @@ public final class ImeFocusController { final View viewForWindowFocus = focusedView != null ? focusedView : mViewRootImpl.mView; onViewFocusChanged(viewForWindowFocus, true); // Skip starting input when the next focused view is same as served view and the served // input connection still exists. // Starting new input when the next focused view is same as served view but the // editor is not aligned with the same editor or editor is inactive. final boolean nextFocusIsServedView = mServedView != null && mServedView == focusedView; if (nextFocusIsServedView && immDelegate.isAcceptingText()) { forceFocus = false; if (nextFocusIsServedView && !immDelegate.isSameEditorAndAcceptingText(focusedView)) { forceFocus = true; } immDelegate.startInputAsyncOnWindowFocusGain(viewForWindowFocus, Loading Loading @@ -254,7 +254,7 @@ public final class ImeFocusController { void setCurrentRootView(ViewRootImpl rootView); boolean isCurrentRootView(ViewRootImpl rootView); boolean isRestartOnNextWindowFocus(boolean reset); boolean isAcceptingText(); boolean isSameEditorAndAcceptingText(View view); } public View getServedView() { Loading
core/java/android/view/inputmethod/InputMethodManager.java +31 −15 Original line number Diff line number Diff line Loading @@ -633,20 +633,21 @@ public final class InputMethodManager { // we'll just do a window focus gain and call it a day. try { View servedView = controller.getServedView(); boolean nextFocusIsServedView = servedView != null && servedView == focusedView; boolean nextFocusSameEditor = servedView != null && servedView == focusedView && isSameEditorAndAcceptingText(focusedView); if (DEBUG) { Log.v(TAG, "Reporting focus gain, without startInput" + ", nextFocusIsServedView=" + nextFocusIsServedView); + ", nextFocusIsServedView=" + nextFocusSameEditor); } final int startInputReason = nextFocusIsServedView ? WINDOW_FOCUS_GAIN_REPORT_WITH_SAME_EDITOR nextFocusSameEditor ? WINDOW_FOCUS_GAIN_REPORT_WITH_SAME_EDITOR : WINDOW_FOCUS_GAIN_REPORT_WITHOUT_EDITOR; mService.startInputOrWindowGainedFocus( startInputReason, mClient, focusedView.getWindowToken(), startInputFlags, softInputMode, windowFlags, nextFocusIsServedView ? mCurrentTextBoxAttribute : null, nextFocusIsServedView ? mServedInputConnectionWrapper : null, null, null, 0 /* missingMethodFlags */, mCurRootView.mContext.getApplicationInfo().targetSdkVersion); } catch (RemoteException e) { Loading @@ -671,10 +672,6 @@ public final class InputMethodManager { @Override public void setCurrentRootView(ViewRootImpl rootView) { synchronized (mH) { if (mCurRootView != null) { // Restart the input when the next window focus state of the root view changed. mRestartOnNextWindowFocus = true; } mCurRootView = rootView; } } Loading Loading @@ -704,14 +701,33 @@ public final class InputMethodManager { } /** * For {@link ImeFocusController} to check if the currently served view is accepting full * text edits. * For {@link ImeFocusController} to check if the given focused view aligns with the same * editor and the editor is active to accept the text input. * * TODO(b/160968797): Remove this method and move mCurrentTextBoxAttritube to * ImeFocusController. * In the long-term, we should make mCurrentTextBoxAtrtribue as per-window base instance, * so that we we can directly check if the current focused view aligned with the same editor * in the window without using this checking. * * Note that this method is only use for fixing start new input may ignored issue * (e.g. b/160391516), DO NOT leverage this method to do another check. */ @Override public boolean isAcceptingText() { public boolean isSameEditorAndAcceptingText(View view) { synchronized (mH) { return mServedInputConnectionWrapper != null && mServedInputConnectionWrapper.getInputConnection() != null; if (!hasServedByInputMethodLocked(view) || mCurrentTextBoxAttribute == null) { return false; } final EditorInfo ic = mCurrentTextBoxAttribute; // This sameEditor checking is based on using object hash comparison to check if // some fields of the current EditorInfo (e.g. autoFillId, OpPackageName) the // hash code is same as the given focused view. final boolean sameEditor = view.onCheckIsTextEditor() && view.getId() == ic.fieldId && view.getAutofillId() == ic.autofillId && view.getContext().getOpPackageName() == ic.packageName; return sameEditor && mServedInputConnectionWrapper != null && mServedInputConnectionWrapper.isActive(); } } } Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java +29 −5 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ public class SyncRtSurfaceTransactionApplierCompat { public static final int FLAG_CORNER_RADIUS = 1 << 4; public static final int FLAG_BACKGROUND_BLUR_RADIUS = 1 << 5; public static final int FLAG_VISIBILITY = 1 << 6; public static final int FLAG_RELATIVE_LAYER = 1 << 7; private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0; Loading Loading @@ -192,6 +193,8 @@ public class SyncRtSurfaceTransactionApplierCompat { Matrix matrix; Rect windowCrop; int layer; SurfaceControl relativeTo; int relativeLayer; boolean visible; /** Loading Loading @@ -248,6 +251,18 @@ public class SyncRtSurfaceTransactionApplierCompat { return this; } /** * @param relativeTo The surface that's set relative layer to. * @param relativeLayer The relative layer. * @return this Builder */ public Builder withRelativeLayerTo(SurfaceControl relativeTo, int relativeLayer) { this.relativeTo = relativeTo; this.relativeLayer = relativeLayer; flags |= FLAG_RELATIVE_LAYER; return this; } /** * @param radius the Radius for rounded corners to apply to the surface. * @return this Builder Loading Loading @@ -283,7 +298,7 @@ public class SyncRtSurfaceTransactionApplierCompat { */ public SurfaceParams build() { return new SurfaceParams(surface, flags, alpha, matrix, windowCrop, layer, cornerRadius, backgroundBlurRadius, visible); relativeTo, relativeLayer, cornerRadius, backgroundBlurRadius, visible); } } Loading @@ -297,21 +312,25 @@ public class SyncRtSurfaceTransactionApplierCompat { * @param windowCrop Crop to apply, only applied if not {@code null} */ public SurfaceParams(SurfaceControlCompat surface, float alpha, Matrix matrix, Rect windowCrop, int layer, float cornerRadius) { Rect windowCrop, int layer, SurfaceControl relativeTo, int relativeLayer, float cornerRadius) { this(surface.mSurfaceControl, FLAG_ALL & ~(FLAG_VISIBILITY | FLAG_BACKGROUND_BLUR_RADIUS), alpha, matrix, windowCrop, layer, cornerRadius, 0 /* backgroundBlurRadius */, true); matrix, windowCrop, layer, relativeTo, relativeLayer, cornerRadius, 0 /* backgroundBlurRadius */, true); } private SurfaceParams(SurfaceControl surface, int flags, float alpha, Matrix matrix, Rect windowCrop, int layer, float cornerRadius, int backgroundBlurRadius, boolean visible) { Rect windowCrop, int layer, SurfaceControl relativeTo, int relativeLayer, float cornerRadius, int backgroundBlurRadius, boolean visible) { this.flags = flags; this.surface = surface; this.alpha = alpha; this.matrix = new Matrix(matrix); this.windowCrop = windowCrop != null ? new Rect(windowCrop) : null; this.layer = layer; this.relativeTo = relativeTo; this.relativeLayer = relativeLayer; this.cornerRadius = cornerRadius; this.backgroundBlurRadius = backgroundBlurRadius; this.visible = visible; Loading @@ -327,6 +346,8 @@ public class SyncRtSurfaceTransactionApplierCompat { public final Matrix matrix; public final Rect windowCrop; public final int layer; public final SurfaceControl relativeTo; public final int relativeLayer; public final boolean visible; public void applyTo(SurfaceControl.Transaction t) { Loading Loading @@ -355,6 +376,9 @@ public class SyncRtSurfaceTransactionApplierCompat { t.hide(surface); } } if ((flags & FLAG_RELATIVE_LAYER) != 0) { t.setRelativeLayer(surface, relativeTo, relativeLayer); } } } }
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +18 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private final Context mContext; private final boolean mIsPrimaryUser; private final boolean mIsAutomotive; private final StatusBarStateController mStatusBarStateController; HashMap<Integer, SimData> mSimDatas = new HashMap<>(); HashMap<Integer, ServiceState> mServiceStates = new HashMap<Integer, ServiceState>(); Loading Loading @@ -1770,6 +1771,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mFaceManager.addLockoutResetCallback(mFaceLockoutResetCallback); } mIsAutomotive = isAutomotive(); ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener); mUserManager = context.getSystemService(UserManager.class); mIsPrimaryUser = mUserManager.isPrimaryUser(); Loading Loading @@ -2484,6 +2487,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab .addCategory(Intent.CATEGORY_HOME); ResolveInfo resolveInfo = mContext.getPackageManager().resolveActivity(homeIntent, 0 /* flags */); // TODO(b/160971249): Replace in the future by resolving activity as user. if (resolveInfo == null && mIsAutomotive) { Log.w(TAG, "resolveNeedsSlowUnlockTransition: returning false since activity " + "could not be resolved."); return false; } return FALLBACK_HOME_COMPONENT.equals(resolveInfo.getComponentInfo().getComponentName()); } Loading Loading @@ -2554,6 +2565,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab return false; } private boolean isAutomotive() { return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE); } /** * Remove the given observer's callback. * Loading Loading @@ -2990,5 +3005,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab pw.println(" " + time + " " + model.toString()); } } if (mIsAutomotive) { pw.println(" Running on Automotive build"); } } }