diff options
17 files changed, 170 insertions, 88 deletions
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index dc20a02156cb..663f91005c3e 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -486,6 +486,7 @@ message Atom { KeystoreKeyEventReported keystore_key_event_reported = 302; NetworkTetheringReported network_tethering_reported = 303 [(module) = "network_tethering"]; + ImeTouchReported ime_touch_reported = 304 [(module) = "sysui"]; // StatsdStats tracks platform atoms with ids upto 500. // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value. @@ -3061,6 +3062,18 @@ message ExclusionRectStateChanged { } /** + * Logs when IME is on. + * + * Logged from: /packages/SystemUI/src/com/android/systemui/ + statusbar/phone/NavigationBarView.java + * + */ +message ImeTouchReported { + optional int32 x_coordinate = 1; // X coordinate for ACTION_DOWN event. + optional int32 y_coordinate = 2; // Y coordinate for ACTION_DOWN event. +} + +/** * Logs when Launcher (HomeScreen) UI has changed or was interacted. * * Logged from: diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index a415dc57e160..2465b0e41876 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -2699,15 +2699,12 @@ public class UserManager { * @param name the user's name * @param userType the type of user, such as {@link UserManager#USER_TYPE_FULL_GUEST}. * @param flags UserInfo flags that specify user properties. - * @return the {@link UserInfo} object for the created user, - * or throws {@link UserOperationException} if the user could not be created - * and calling app is targeting {@link android.os.Build.VERSION_CODES#R} or above - * (otherwise returns {@code null}). + * @return the {@link UserInfo} object for the created user, or {@code null} if the user + * could not be created. * - * @throws UserOperationException if the user could not be created and the calling app is - * targeting {@link android.os.Build.VERSION_CODES#R} or above. - * @hide * @see UserInfo + * + * @hide */ @RequiresPermission(anyOf = {Manifest.permission.MANAGE_USERS, Manifest.permission.CREATE_USERS}) @@ -2716,8 +2713,7 @@ public class UserManager { try { return mService.createUserWithThrow(name, userType, flags); } catch (ServiceSpecificException e) { - return returnNullOrThrowUserOperationException(e, - mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.R); + return null; } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } @@ -2743,25 +2739,19 @@ public class UserManager { * com.android.server.pm.UserManagerService#ALLOWED_FLAGS_FOR_CREATE_USERS_PERMISSION}. * * @param userType the type of user, such as {@link UserManager#USER_TYPE_FULL_GUEST}. - * @return the {@link UserInfo} object for the created user, - * or throws {@link UserOperationException} if the user could not be created - * and calling app is targeting {@link android.os.Build.VERSION_CODES#R} or above - * (otherwise returns {@code null}). - * - * @throws UserOperationException if the user could not be created and the calling app is - * targeting {@link android.os.Build.VERSION_CODES#R} or above. + * @return the {@link UserInfo} object for the created user. * + * @throws UserOperationException if the user could not be created. * @hide */ @RequiresPermission(anyOf = {Manifest.permission.MANAGE_USERS, Manifest.permission.CREATE_USERS}) - public @Nullable UserInfo preCreateUser(@NonNull String userType) + public @NonNull UserInfo preCreateUser(@NonNull String userType) throws UserOperationException { try { return mService.preCreateUserWithThrow(userType); } catch (ServiceSpecificException e) { - return returnNullOrThrowUserOperationException(e, - mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.R); + throw UserOperationException.from(e); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } @@ -2771,18 +2761,14 @@ public class UserManager { * Creates a guest user and configures it. * @param context an application context * @param name the name to set for the user - * @return the {@link UserInfo} object for the created user, - * or throws {@link UserOperationException} if the user could not be created - * and calling app is targeting {@link android.os.Build.VERSION_CODES#R} or above - * (otherwise returns {@code null}). + * @return the {@link UserInfo} object for the created user, or {@code null} if the user + * could not be created. * - * @throws UserOperationException if the user could not be created and the calling app is - * targeting {@link android.os.Build.VERSION_CODES#R} or above. * @hide */ @RequiresPermission(anyOf = {Manifest.permission.MANAGE_USERS, Manifest.permission.CREATE_USERS}) - public UserInfo createGuest(Context context, String name) throws UserOperationException { + public UserInfo createGuest(Context context, String name) { UserInfo guest = null; try { guest = mService.createUserWithThrow(name, USER_TYPE_FULL_GUEST, 0); @@ -2791,8 +2777,7 @@ public class UserManager { Settings.Secure.SKIP_FIRST_USE_HINTS, "1", guest.id); } } catch (ServiceSpecificException e) { - return returnNullOrThrowUserOperationException(e, - context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.R); + return null; } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } @@ -2902,26 +2887,20 @@ public class UserManager { * @param userId new user will be a profile of this user. * @param disallowedPackages packages that will not be installed in the profile being created. * - * @return the {@link UserInfo} object for the created user, - * or throws {@link UserOperationException} if the user could not be created - * and calling app is targeting {@link android.os.Build.VERSION_CODES#R} or above - * (otherwise returns {@code null}). + * @return the {@link UserInfo} object for the created user, or {@code null} if the user could + * not be created. * - * @throws UserOperationException if the user could not be created and the calling app is - * targeting {@link android.os.Build.VERSION_CODES#R} or above. * @hide */ @RequiresPermission(anyOf = {Manifest.permission.MANAGE_USERS, Manifest.permission.CREATE_USERS}) public UserInfo createProfileForUser(String name, @NonNull String userType, - @UserInfoFlag int flags, @UserIdInt int userId, String[] disallowedPackages) - throws UserOperationException { + @UserInfoFlag int flags, @UserIdInt int userId, String[] disallowedPackages) { try { return mService.createProfileForUserWithThrow(name, userType, flags, userId, disallowedPackages); } catch (ServiceSpecificException e) { - return returnNullOrThrowUserOperationException(e, - mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.R); + return null; } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } @@ -2938,13 +2917,12 @@ public class UserManager { Manifest.permission.CREATE_USERS}) public UserInfo createProfileForUserEvenWhenDisallowed(String name, @NonNull String userType, @UserInfoFlag int flags, @UserIdInt int userId, - String[] disallowedPackages) throws UserOperationException { + String[] disallowedPackages) { try { return mService.createProfileForUserEvenWhenDisallowedWithThrow(name, userType, flags, userId, disallowedPackages); } catch (ServiceSpecificException e) { - return returnNullOrThrowUserOperationException(e, - mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.R); + return null; } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } @@ -2955,18 +2933,14 @@ public class UserManager { * restrictions and adds shared accounts. * * @param name profile's name - * @return the {@link UserInfo} object for the created user, - * or throws {@link UserOperationException} if the user could not be created - * and calling app is targeting {@link android.os.Build.VERSION_CODES#R} or above - * (otherwise returns {@code null}). + * @return the {@link UserInfo} object for the created user, or {@code null} if the user + * could not be created. * - * @throws UserOperationException if the user could not be created and the calling app is - * targeting {@link android.os.Build.VERSION_CODES#R} or above. * @hide */ @RequiresPermission(anyOf = {Manifest.permission.MANAGE_USERS, Manifest.permission.CREATE_USERS}) - public UserInfo createRestrictedProfile(String name) throws UserOperationException { + public UserInfo createRestrictedProfile(String name) { try { UserHandle parentUserHandle = Process.myUserHandle(); UserInfo user = mService.createRestrictedProfileWithThrow(name, @@ -2977,8 +2951,7 @@ public class UserManager { } return user; } catch (ServiceSpecificException e) { - return returnNullOrThrowUserOperationException(e, - mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.R); + return null; } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } @@ -4009,15 +3982,15 @@ public class UserManager { * Sets the user's photo. * @param userId the user for whom to change the photo. * @param icon the bitmap to set as the photo. + * * @hide */ @RequiresPermission(android.Manifest.permission.MANAGE_USERS) - public void setUserIcon(@UserIdInt int userId, @NonNull Bitmap icon) - throws UserOperationException { + public void setUserIcon(@UserIdInt int userId, @NonNull Bitmap icon) { try { mService.setUserIcon(userId, icon); } catch (ServiceSpecificException e) { - throw UserOperationException.from(e); + return; } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } @@ -4027,6 +4000,10 @@ public class UserManager { * Sets the context user's photo. * * @param icon the bitmap to set as the photo. + * + * @throws UserOperationException according to the function signature, but may not actually + * throw it in practice. Catch RuntimeException instead. + * * @hide */ @SystemApi diff --git a/packages/SystemUI/src/com/android/systemui/media/KeyguardMediaController.kt b/packages/SystemUI/src/com/android/systemui/media/KeyguardMediaController.kt index f8c2b88d39de..8ef20f89085c 100644 --- a/packages/SystemUI/src/com/android/systemui/media/KeyguardMediaController.kt +++ b/packages/SystemUI/src/com/android/systemui/media/KeyguardMediaController.kt @@ -56,7 +56,7 @@ class KeyguardMediaController @Inject constructor( fun attach(mediaView: MediaHeaderView) { view = mediaView // First let's set the desired state that we want for this host - mediaHost.visibleChangedListener = { updateVisibility() } + mediaHost.addVisibilityChangeListener { updateVisibility() } mediaHost.expansion = 0.0f mediaHost.showsOnlyActiveMedia = true mediaHost.falsingProtectionNeeded = true diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt b/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt index c378c8b7d098..3266074eba7d 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt @@ -227,6 +227,10 @@ class MediaHierarchyManager @Inject constructor( fun register(mediaObject: MediaHost): UniqueObjectHostView { val viewHost = createUniqueObjectHost() mediaObject.hostView = viewHost + mediaObject.addVisibilityChangeListener { + // Never animate because of a visibility change, only state changes should do that + updateDesiredLocation(forceNoAnimation = true) + } mediaHosts[mediaObject.location] = mediaObject if (mediaObject.location == desiredLocation) { // In case we are overriding a view that is already visible, make sure we attach it @@ -260,8 +264,10 @@ class MediaHierarchyManager @Inject constructor( /** * Updates the location that the view should be in. If it changes, an animation may be triggered * going from the old desired location to the new one. + * + * @param forceNoAnimation optional parameter telling the system not to animate */ - private fun updateDesiredLocation() { + private fun updateDesiredLocation(forceNoAnimation: Boolean = false) { val desiredLocation = calculateLocation() if (desiredLocation != this.desiredLocation) { if (this.desiredLocation >= 0) { @@ -270,7 +276,8 @@ class MediaHierarchyManager @Inject constructor( val isNewView = this.desiredLocation == -1 this.desiredLocation = desiredLocation // Let's perform a transition - val animate = shouldAnimateTransition(desiredLocation, previousLocation) + val animate = !forceNoAnimation && + shouldAnimateTransition(desiredLocation, previousLocation) val (animDuration, delay) = getAnimationParams(previousLocation, desiredLocation) val host = getHost(desiredLocation) mediaCarouselController.onDesiredLocationChanged(desiredLocation, host, animate, diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaHost.kt b/packages/SystemUI/src/com/android/systemui/media/MediaHost.kt index 19eb04b10ce3..1ae9d3ff4ca5 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaHost.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaHost.kt @@ -2,6 +2,7 @@ package com.android.systemui.media import android.graphics.PointF import android.graphics.Rect +import android.util.ArraySet import android.view.View import android.view.View.OnAttachStateChangeListener import com.android.systemui.util.animation.MeasurementInput @@ -20,7 +21,7 @@ class MediaHost @Inject constructor( lateinit var hostView: UniqueObjectHostView var location: Int = -1 private set - var visibleChangedListener: ((Boolean) -> Unit)? = null + private var visibleChangedListeners: ArraySet<(Boolean) -> Unit> = ArraySet() private val tmpLocationOnScreen: IntArray = intArrayOf(0, 0) @@ -58,6 +59,10 @@ class MediaHost @Inject constructor( } } + fun addVisibilityChangeListener(listener: (Boolean) -> Unit) { + visibleChangedListeners.add(listener) + } + /** * Initialize this MediaObject and create a host view. * All state should already be set on this host before calling this method in order to avoid @@ -116,7 +121,9 @@ class MediaHost @Inject constructor( val newVisibility = if (visible) View.VISIBLE else View.GONE if (newVisibility != hostView.visibility) { hostView.visibility = newVisibility - visibleChangedListener?.invoke(visible) + visibleChangedListeners.forEach { + it.invoke(visible) + } } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/NonInterceptingScrollView.java b/packages/SystemUI/src/com/android/systemui/qs/NonInterceptingScrollView.java index aa17c4aa79b1..309b32fc85d2 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/NonInterceptingScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/NonInterceptingScrollView.java @@ -46,6 +46,11 @@ public class NonInterceptingScrollView extends ScrollView { if (parent != null) { parent.requestDisallowInterceptTouchEvent(true); } + } else if (!canScrollVertically(-1)) { + // Don't pass on the touch to the view, because scrolling will unconditionally + // disallow interception even if we can't scroll. + // if a user can't scroll at all, we should never listen to the touch. + return false; } break; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 0b24f64f888f..c8a34f010ae4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -162,7 +162,7 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne mMediaTotalBottomMargin = getResources().getDimensionPixelSize( R.dimen.quick_settings_bottom_margin_media); mMediaHost = mediaHost; - mMediaHost.setVisibleChangedListener((visible) -> { + mMediaHost.addVisibilityChangeListener((visible) -> { onMediaVisibilityChanged(visible); return null; }); diff --git a/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordDialog.java b/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordDialog.java index d057a8a43c43..8347def2d430 100644 --- a/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordDialog.java +++ b/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordDialog.java @@ -97,6 +97,9 @@ public class ScreenRecordDialog extends Activity { mModes); a.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mOptions.setAdapter(a); + mOptions.setOnItemClickListenerInt((parent, view, position, id) -> { + mAudioSwitch.setChecked(true); + }); } diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java index 42d8c959371f..6f554e698c58 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java @@ -352,8 +352,6 @@ public class DividerView extends FrameLayout implements OnTouchListener, minimizeLeft + mMinimizedShadow.getMeasuredWidth(), minimizeTop + mMinimizedShadow.getMeasuredHeight()); if (changed) { - mWindowManagerProxy.setTouchRegion(new Rect(mHandle.getLeft(), mHandle.getTop(), - mHandle.getRight(), mHandle.getBottom())); notifySplitScreenBoundsChanged(); } } @@ -679,6 +677,14 @@ public class DividerView extends FrameLayout implements OnTouchListener, private void notifySplitScreenBoundsChanged() { mOtherTaskRect.set(mSplitLayout.mSecondary); + mTmpRect.set(mHandle.getLeft(), mHandle.getTop(), mHandle.getRight(), mHandle.getBottom()); + if (isHorizontalDivision()) { + mTmpRect.offsetTo(0, mDividerPositionY); + } else { + mTmpRect.offsetTo(mDividerPositionX, 0); + } + mWindowManagerProxy.setTouchRegion(mTmpRect); + mTmpRect.set(mSplitLayout.mDisplayLayout.stableInsets()); switch (mSplitLayout.getPrimarySplitSide()) { case WindowManager.DOCKED_LEFT: diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 1a12d199c55a..8ebadfbd3b25 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -201,6 +201,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private final KeyguardBypassController mKeyguardBypassController; private final DynamicPrivacyController mDynamicPrivacyController; private final SysuiStatusBarStateController mStatusbarStateController; + private final KeyguardMediaController mKeyguardMediaController; private ExpandHelper mExpandHelper; private final NotificationSwipeHelper mSwipeHelper; @@ -672,6 +673,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd initializeForegroundServiceSection(fgsFeatureController); mUiEventLogger = uiEventLogger; mColorExtractor.addOnColorsChangedListener(mOnColorsChangedListener); + mKeyguardMediaController = keyguardMediaController; keyguardMediaController.setVisibilityChangedListener((visible) -> { if (visible) { generateAddAnimation(keyguardMediaController.getView(), false /*fromMoreCard */); @@ -6638,7 +6640,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd /* Only ever called as a consequence of a lockscreen expansion gesture. */ @Override public boolean onDraggedDown(View startingChild, int dragLengthY) { - if (mStatusBarState == StatusBarState.KEYGUARD && hasActiveNotifications()) { + boolean canDragDown = hasActiveNotifications() + || mKeyguardMediaController.getView().getVisibility() == VISIBLE; + if (mStatusBarState == StatusBarState.KEYGUARD && canDragDown) { mLockscreenGestureLogger.write( MetricsEvent.ACTION_LS_SHADE, (int) (dragLengthY / mDisplayMetrics.density), diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 06484a226165..dbff643c6e32 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -74,6 +74,7 @@ import com.android.systemui.recents.RecentsOnboarding; import com.android.systemui.shared.plugins.PluginManager; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.QuickStepContract; +import com.android.systemui.shared.system.SysUiStatsLog; import com.android.systemui.shared.system.WindowManagerWrapper; import com.android.systemui.stackdivider.Divider; import com.android.systemui.statusbar.CommandQueue; @@ -372,6 +373,11 @@ public class NavigationBarView extends FrameLayout implements @Override public boolean onInterceptTouchEvent(MotionEvent event) { + if (isGesturalMode(mNavBarMode) && mImeVisible + && event.getAction() == MotionEvent.ACTION_DOWN) { + SysUiStatsLog.write(SysUiStatsLog.IME_TOUCH_REPORTED, + (int) event.getX(), (int) event.getY()); + } return shouldDeadZoneConsumeTouchEvents(event) || super.onInterceptTouchEvent(event); } diff --git a/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java b/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java index 7b114525adcd..8ba5b9951c54 100644 --- a/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java +++ b/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java @@ -56,12 +56,14 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged private static final boolean DEBUG = false; + // NOTE: All these constants came from InsetsController. public static final int ANIMATION_DURATION_SHOW_MS = 275; public static final int ANIMATION_DURATION_HIDE_MS = 340; public static final Interpolator INTERPOLATOR = new PathInterpolator(0.4f, 0f, 0.2f, 1f); private static final int DIRECTION_NONE = 0; private static final int DIRECTION_SHOW = 1; private static final int DIRECTION_HIDE = 2; + private static final int FLOATING_IME_BOTTOM_INSET = -80; SystemWindows mSystemWindows; final Handler mHandler; @@ -271,8 +273,16 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged } // Set frame, but only if the new frame isn't empty -- this maintains continuity final Rect newFrame = imeSource.getFrame(); - if (newFrame.height() != 0) { + mImeFrame.set(newFrame); + final boolean isFloating = newFrame.height() == 0; + if (isFloating) { + // This is likely a "floating" or "expanded" IME, so to get animations, just + // pretend the ime has some size just below the screen. mImeFrame.set(newFrame); + final int floatingInset = (int) ( + mSystemWindows.mDisplayController.getDisplayLayout(mDisplayId).density() + * FLOATING_IME_BOTTOM_INSET); + mImeFrame.bottom -= floatingInset; } if (DEBUG) { Slog.d(TAG, "Run startAnim show:" + show + " was:" @@ -316,6 +326,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged SurfaceControl.Transaction t = mTransactionPool.acquire(); float value = (float) animation.getAnimatedValue(); t.setPosition(mImeSourceControl.getLeash(), x, value); + final float alpha = isFloating ? (value - hiddenY) / (shownY - hiddenY) : 1.f; + t.setAlpha(mImeSourceControl.getLeash(), alpha); dispatchPositionChanged(mDisplayId, imeTop(value), t); t.apply(); mTransactionPool.release(t); @@ -327,6 +339,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged public void onAnimationStart(Animator animation) { SurfaceControl.Transaction t = mTransactionPool.acquire(); t.setPosition(mImeSourceControl.getLeash(), x, startY); + final float alpha = isFloating ? (startY - hiddenY) / (shownY - hiddenY) : 1.f; + t.setAlpha(mImeSourceControl.getLeash(), alpha); if (DEBUG) { Slog.d(TAG, "onAnimationStart d:" + mDisplayId + " top:" + imeTop(hiddenY) + "->" + imeTop(shownY) @@ -351,6 +365,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged SurfaceControl.Transaction t = mTransactionPool.acquire(); if (!mCancelled) { t.setPosition(mImeSourceControl.getLeash(), x, endY); + t.setAlpha(mImeSourceControl.getLeash(), 1.f); } dispatchEndPositioning(mDisplayId, mCancelled, t); if (mAnimationDirection == DIRECTION_HIDE && !mCancelled) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/KeyguardMediaControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/KeyguardMediaControllerTest.kt index 9aee11e4924f..008dc12bba03 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/KeyguardMediaControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/KeyguardMediaControllerTest.kt @@ -27,6 +27,7 @@ import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.notification.stack.MediaHeaderView import com.android.systemui.statusbar.phone.KeyguardBypassController +import com.android.systemui.util.mockito.capture import org.junit.Before import org.junit.Rule import org.junit.Test @@ -94,7 +95,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() { private fun triggerVisibilityListener() { keyguardMediaController.attach(mediaHeaderView) - verify(mediaHost).visibleChangedListener = visibilityListener.capture() + verify(mediaHost).addVisibilityChangeListener(capture(visibilityListener)) visibilityListener.value.invoke(true) } }
\ No newline at end of file diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 3114a6a02e31..2b9ce2f07c70 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -1005,6 +1005,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState || disableDuration > 0) { // Response is "empty" from an UI point of view, need to notify client. notifyUnavailableToClient(sessionFinishedState, /* autofillableIds= */ null); + synchronized (mLock) { + mInlineSessionController.setInlineFillUiLocked( + InlineFillUi.emptyUi(mCurrentViewId)); + } } if (requestLog != null) { @@ -2979,8 +2983,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState inlineSuggestionsRequest.get(), response, focusedId, filterText, /*uiCallback*/this, /*onErrorCallback*/ () -> { synchronized (mLock) { - mInlineSessionController.hideInlineSuggestionsUiLocked( - focusedId); + mInlineSessionController.setInlineFillUiLocked( + InlineFillUi.emptyUi(focusedId)); } }, remoteRenderService); return mInlineSessionController.setInlineFillUiLocked(inlineFillUi); @@ -3166,12 +3170,15 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState notifyUnavailableToClient(AutofillManager.STATE_FINISHED, autofillableIds); removeSelf(); } else { - if (sVerbose) { - if ((flags & FLAG_PASSWORD_INPUT_TYPE) != 0) { + if ((flags & FLAG_PASSWORD_INPUT_TYPE) != 0) { + if (sVerbose) { Slog.v(TAG, "keeping session " + id + " when service returned null and " + "augmented service is disabled for password fields. " + "AutofillableIds: " + autofillableIds); - } else { + } + mInlineSessionController.hideInlineSuggestionsUiLocked(mCurrentViewId); + } else { + if (sVerbose) { Slog.v(TAG, "keeping session " + id + " when service returned null but " + "it can be augmented. AutofillableIds: " + autofillableIds); } @@ -3197,7 +3204,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState // non-null response but without datasets (for example, just SaveInfo) @GuardedBy("mLock") private Runnable triggerAugmentedAutofillLocked(int flags) { - // (TODO: b/141703197) Fix later by passing info to service. + // TODO: (b/141703197) Fix later by passing info to service. if ((flags & FLAG_PASSWORD_INPUT_TYPE) != 0) { return null; } @@ -3242,7 +3249,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState + ComponentName.flattenToShortString(mComponentName) + " not whitelisted "); } logAugmentedAutofillRequestLocked(mode, remoteService.getComponentName(), - mCurrentViewId, isWhitelisted, /*isInline*/null); + mCurrentViewId, isWhitelisted, /* isInline= */ null); return null; } @@ -3284,6 +3291,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState /*onErrorCallback=*/ () -> { synchronized (mLock) { cancelAugmentedAutofillLocked(); + + // Also cancel augmented in IME + mInlineSessionController.setInlineFillUiLocked( + InlineFillUi.emptyUi(mCurrentViewId)); } }, mService.getRemoteInlineSuggestionRenderServiceLocked()); } diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index d62cd0a63b44..11667c83bc6a 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -305,11 +305,14 @@ public class SubscriptionInfo implements Parcelable { } /** - * Returns the ICC ID if the calling app has been granted the READ_PRIVILEGED_PHONE_STATE - * permission, has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}), or - * is a device owner or profile owner that has been granted the READ_PHONE_STATE permission. - * The profile owner is an app that owns a managed profile on the device; for more details see - * <a href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile + * Returns the ICC ID. + * + * Starting with API level 30, returns the ICC ID if the calling app has been granted the + * READ_PRIVILEGED_PHONE_STATE permission, has carrier privileges (see + * {@link TelephonyManager#hasCarrierPrivileges}), or is a device owner or profile owner that + * has been granted the READ_PHONE_STATE permission. The profile owner is an app that owns a + * managed profile on the device; for more details see <a + * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile * owner access is deprecated and will be removed in a future release. * * @return the ICC ID, or an empty string if one of these requirements is not met @@ -449,8 +452,22 @@ public class SubscriptionInfo implements Parcelable { } /** - * @return the number of this subscription if the calling app has been granted the - * READ_PHONE_NUMBERS permission, or an empty string otherwise + * Returns the number of this subscription. + * + * Starting with API level 30, returns the number of this subscription if the calling app meets + * one of the following requirements: + * <ul> + * <li>If the calling app's target SDK is API level 29 or lower and the app has been granted + * the READ_PHONE_STATE permission. + * <li>If the calling app has been granted any of READ_PRIVILEGED_PHONE_STATE, + * READ_PHONE_NUMBERS, or READ_SMS. + * <li>If the calling app has carrier privileges (see {@link + * TelephonyManager#hasCarrierPrivileges}). + * <li>If the calling app is the default SMS role holder. + * </ul> + * + * @return the number of this subscription, or an empty string if one of these requirements is + * not met */ public String getNumber() { return mNumber; @@ -670,12 +687,15 @@ public class SubscriptionInfo implements Parcelable { } /** - * Returns the card string if the calling app has been granted the READ_PRIVILEGED_PHONE_STATE - * permission, has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}), or - * is a device owner or profile owner on an organization owned device that has been granted the - * READ_PHONE_STATE permission. The profile owner is an app that owns a managed profile on the - * device; for more details see <a href="https://developer.android.com/work/managed-profiles"> - * Work profiles</a>. + * Returns the card string of the SIM card which contains the subscription. + * + * Starting with API level 30, returns the card string if the calling app has been granted the + * READ_PRIVILEGED_PHONE_STATE permission, has carrier privileges (see + * {@link TelephonyManager#hasCarrierPrivileges}), or is a device owner or profile owner that + * has been granted the READ_PHONE_STATE permission. The profile owner is an app that owns a + * managed profile on the device; for more details see <a + * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile + * owner access is deprecated and will be removed in a future release. * * @return the card string of the SIM card which contains the subscription or an empty string * if these requirements are not met. The card string is the ICCID for UICCs or the EID for diff --git a/tests/BlobStoreTestUtils/src/com/android/utils/blob/DummyBlobData.java b/tests/BlobStoreTestUtils/src/com/android/utils/blob/DummyBlobData.java index 4a0ca664049a..2df0024bdea9 100644 --- a/tests/BlobStoreTestUtils/src/com/android/utils/blob/DummyBlobData.java +++ b/tests/BlobStoreTestUtils/src/com/android/utils/blob/DummyBlobData.java @@ -153,7 +153,14 @@ public class DummyBlobData { public void writeToSession(BlobStoreManager.Session session, long offsetBytes, long lengthBytes) throws Exception { try (FileInputStream in = new FileInputStream(mFile)) { - Utils.writeToSession(session, in, offsetBytes, lengthBytes); + Utils.writeToSession(session, in, offsetBytes, lengthBytes, lengthBytes); + } + } + + public void writeToSession(BlobStoreManager.Session session, + long offsetBytes, long lengthBytes, long allocateBytes) throws Exception { + try (FileInputStream in = new FileInputStream(mFile)) { + Utils.writeToSession(session, in, offsetBytes, lengthBytes, allocateBytes); } } diff --git a/tests/BlobStoreTestUtils/src/com/android/utils/blob/Utils.java b/tests/BlobStoreTestUtils/src/com/android/utils/blob/Utils.java index b9bd661dfd67..ec859955694c 100644 --- a/tests/BlobStoreTestUtils/src/com/android/utils/blob/Utils.java +++ b/tests/BlobStoreTestUtils/src/com/android/utils/blob/Utils.java @@ -59,15 +59,15 @@ public class Utils { public static void writeToSession(BlobStoreManager.Session session, ParcelFileDescriptor input, long lengthBytes) throws IOException { try (FileInputStream in = new ParcelFileDescriptor.AutoCloseInputStream(input)) { - writeToSession(session, in, 0, lengthBytes); + writeToSession(session, in, 0, lengthBytes, lengthBytes); } } public static void writeToSession(BlobStoreManager.Session session, FileInputStream in, - long offsetBytes, long lengthBytes) throws IOException { + long offsetBytes, long lengthBytes, long allocateBytes) throws IOException { in.getChannel().position(offsetBytes); try (FileOutputStream out = new ParcelFileDescriptor.AutoCloseOutputStream( - session.openWrite(offsetBytes, lengthBytes))) { + session.openWrite(offsetBytes, allocateBytes))) { copy(in, out, lengthBytes); } } |