diff options
28 files changed, 262 insertions, 113 deletions
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 53e75d4548ba..ea4a2a0b8c35 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -8171,7 +8171,7 @@ public abstract class PackageManager { private static final PropertyInvalidatedCache<PackageInfoQuery, PackageInfo> sPackageInfoCache = new PropertyInvalidatedCache<PackageInfoQuery, PackageInfo>( - 16, PermissionManager.CACHE_KEY_PACKAGE_INFO) { + 32, PermissionManager.CACHE_KEY_PACKAGE_INFO) { @Override protected PackageInfo recompute(PackageInfoQuery query) { return getPackageInfoAsUserUncached( diff --git a/core/java/android/view/InsetsAnimationControlImpl.java b/core/java/android/view/InsetsAnimationControlImpl.java index 31da83ad5137..69220722fc05 100644 --- a/core/java/android/view/InsetsAnimationControlImpl.java +++ b/core/java/android/view/InsetsAnimationControlImpl.java @@ -308,7 +308,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll false /* isScreenRound */, false /* alwaysConsumeSystemBars */, null /* displayCutout */, LayoutParams.SOFT_INPUT_ADJUST_RESIZE /* legacySoftInputMode*/, - 0 /* legacySystemUiFlags */, typeSideMap) + 0 /* legacyWindowFlags */, 0 /* legacySystemUiFlags */, typeSideMap) .getInsets(mTypes); } diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java index a679b3740fd9..c383bc7a4d70 100644 --- a/core/java/android/view/InsetsController.java +++ b/core/java/android/view/InsetsController.java @@ -501,6 +501,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private PendingControlRequest mPendingImeControlRequest; private int mLastLegacySoftInputMode; + private int mLastLegacyWindowFlags; private int mLastLegacySystemUiFlags; private DisplayCutout mLastDisplayCutout; private boolean mStartingAnimation; @@ -569,8 +570,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation WindowInsets insets = state.calculateInsets(mFrame, mState /* ignoringVisibilityState*/, mLastInsets.isRound(), mLastInsets.shouldAlwaysConsumeSystemBars(), - mLastDisplayCutout, mLastLegacySoftInputMode, mLastLegacySystemUiFlags, - null /* typeSideMap */); + mLastDisplayCutout, mLastLegacySoftInputMode, mLastLegacyWindowFlags, + mLastLegacySystemUiFlags, null /* typeSideMap */); mHost.dispatchWindowInsetsAnimationProgress(insets, mUnmodifiableTmpRunningAnims); if (DEBUG) { for (WindowInsetsAnimation anim : mUnmodifiableTmpRunningAnims) { @@ -706,13 +707,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation @VisibleForTesting public WindowInsets calculateInsets(boolean isScreenRound, boolean alwaysConsumeSystemBars, DisplayCutout cutout, - int legacySoftInputMode, int legacySystemUiFlags) { + int legacySoftInputMode, int legacyWindowFlags, int legacySystemUiFlags) { mLastLegacySoftInputMode = legacySoftInputMode; + mLastLegacyWindowFlags = legacyWindowFlags; mLastLegacySystemUiFlags = legacySystemUiFlags; mLastDisplayCutout = cutout; mLastInsets = mState.calculateInsets(mFrame, null /* ignoringVisibilityState*/, isScreenRound, alwaysConsumeSystemBars, cutout, - legacySoftInputMode, legacySystemUiFlags, + legacySoftInputMode, legacyWindowFlags, legacySystemUiFlags, null /* typeSideMap */); return mLastInsets; } diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java index 91e7591193f1..6b0b509932a8 100644 --- a/core/java/android/view/InsetsState.java +++ b/core/java/android/view/InsetsState.java @@ -22,13 +22,14 @@ import static android.view.ViewRootImpl.NEW_INSETS_MODE_IME; import static android.view.ViewRootImpl.NEW_INSETS_MODE_NONE; import static android.view.ViewRootImpl.sNewInsetsMode; import static android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES; -import static android.view.WindowInsets.Type.SIZE; import static android.view.WindowInsets.Type.SYSTEM_GESTURES; import static android.view.WindowInsets.Type.displayCutout; import static android.view.WindowInsets.Type.ime; import static android.view.WindowInsets.Type.indexOf; import static android.view.WindowInsets.Type.isVisibleInsetsType; +import static android.view.WindowInsets.Type.statusBars; import static android.view.WindowInsets.Type.systemBars; +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST; @@ -38,7 +39,6 @@ import android.graphics.Insets; import android.graphics.Rect; import android.os.Parcel; import android.os.Parcelable; -import android.util.ArrayMap; import android.util.ArraySet; import android.util.SparseIntArray; import android.view.WindowInsets.Type; @@ -171,7 +171,7 @@ public class InsetsState implements Parcelable { */ public WindowInsets calculateInsets(Rect frame, @Nullable InsetsState ignoringVisibilityState, boolean isScreenRound, boolean alwaysConsumeSystemBars, DisplayCutout cutout, - int legacySoftInputMode, int legacySystemUiFlags, + int legacySoftInputMode, int legacyWindowFlags, int legacySystemUiFlags, @Nullable @InternalInsetsSide SparseIntArray typeSideMap) { Insets[] typeInsetsMap = new Insets[Type.SIZE]; Insets[] typeMaxInsetsMap = new Insets[Type.SIZE]; @@ -218,10 +218,17 @@ public class InsetsState implements Parcelable { } } final int softInputAdjustMode = legacySoftInputMode & SOFT_INPUT_MASK_ADJUST; + + @InsetsType int compatInsetsTypes = systemBars() | displayCutout(); + if (softInputAdjustMode == SOFT_INPUT_ADJUST_RESIZE) { + compatInsetsTypes |= ime(); + } + if ((legacyWindowFlags & FLAG_FULLSCREEN) != 0) { + compatInsetsTypes &= ~statusBars(); + } + return new WindowInsets(typeInsetsMap, typeMaxInsetsMap, typeVisibilityMap, isScreenRound, - alwaysConsumeSystemBars, cutout, softInputAdjustMode == SOFT_INPUT_ADJUST_RESIZE - ? systemBars() | displayCutout() | ime() - : systemBars() | displayCutout(), + alwaysConsumeSystemBars, cutout, compatInsetsTypes, sNewInsetsMode == NEW_INSETS_MODE_FULL && (legacySystemUiFlags & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0); } diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index fefe564787ca..7453f21d379b 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -2265,7 +2265,8 @@ public final class ViewRootImpl implements ViewParent, mLastWindowInsets = mInsetsController.calculateInsets( mContext.getResources().getConfiguration().isScreenRound(), mAttachInfo.mAlwaysConsumeSystemBars, mPendingDisplayCutout.get(), - mWindowAttributes.softInputMode, (mWindowAttributes.systemUiVisibility + mWindowAttributes.softInputMode, mWindowAttributes.flags, + (mWindowAttributes.systemUiVisibility | mWindowAttributes.subtreeSystemUiVisibility)); Rect visibleInsets = mInsetsController.calculateVisibleInsets( diff --git a/core/java/android/view/WindowInsets.java b/core/java/android/view/WindowInsets.java index 4d6b72f96aab..5e94758b003c 100644 --- a/core/java/android/view/WindowInsets.java +++ b/core/java/android/view/WindowInsets.java @@ -17,7 +17,6 @@ package android.view; -import static android.view.WindowInsets.Type.CAPTION_BAR; import static android.view.WindowInsets.Type.DISPLAY_CUTOUT; import static android.view.WindowInsets.Type.FIRST; import static android.view.WindowInsets.Type.IME; @@ -95,7 +94,7 @@ public final class WindowInsets { private final boolean mStableInsetsConsumed; private final boolean mDisplayCutoutConsumed; - private final int mCompatInsetTypes; + private final int mCompatInsetsTypes; private final boolean mCompatIgnoreVisibility; /** @@ -150,8 +149,8 @@ public final class WindowInsets { @Nullable Insets[] typeMaxInsetsMap, boolean[] typeVisibilityMap, boolean isRound, - boolean alwaysConsumeSystemBars, DisplayCutout displayCutout, int compatInsetTypes, - boolean compatIgnoreVisibility) { + boolean alwaysConsumeSystemBars, DisplayCutout displayCutout, + @InsetsType int compatInsetsTypes, boolean compatIgnoreVisibility) { mSystemWindowInsetsConsumed = typeInsetsMap == null; mTypeInsetsMap = mSystemWindowInsetsConsumed ? new Insets[SIZE] @@ -165,7 +164,7 @@ public final class WindowInsets { mTypeVisibilityMap = typeVisibilityMap; mIsRound = isRound; mAlwaysConsumeSystemBars = alwaysConsumeSystemBars; - mCompatInsetTypes = compatInsetTypes; + mCompatInsetsTypes = compatInsetsTypes; mCompatIgnoreVisibility = compatIgnoreVisibility; mDisplayCutoutConsumed = displayCutout == null; @@ -183,7 +182,7 @@ public final class WindowInsets { src.mStableInsetsConsumed ? null : src.mTypeMaxInsetsMap, src.mTypeVisibilityMap, src.mIsRound, src.mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(src), - src.mCompatInsetTypes, + src.mCompatInsetsTypes, src.mCompatIgnoreVisibility); } @@ -310,11 +309,11 @@ public final class WindowInsets { @NonNull public Insets getSystemWindowInsets() { Insets result = mCompatIgnoreVisibility - ? getInsetsIgnoringVisibility(mCompatInsetTypes & ~ime()) - : getInsets(mCompatInsetTypes); + ? getInsetsIgnoringVisibility(mCompatInsetsTypes & ~ime()) + : getInsets(mCompatInsetsTypes); // We can't query max insets for IME, so we need to add it manually after. - if ((mCompatInsetTypes & ime()) != 0 && mCompatIgnoreVisibility) { + if ((mCompatInsetsTypes & ime()) != 0 && mCompatIgnoreVisibility) { result = Insets.max(result, getInsets(ime())); } return result; @@ -503,7 +502,7 @@ public final class WindowInsets { mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, null /* displayCutout */, - mCompatInsetTypes, mCompatIgnoreVisibility); + mCompatInsetsTypes, mCompatIgnoreVisibility); } @@ -554,7 +553,7 @@ public final class WindowInsets { mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(this), - mCompatInsetTypes, mCompatIgnoreVisibility); + mCompatInsetsTypes, mCompatIgnoreVisibility); } // TODO(b/119190588): replace @code with @link below @@ -627,7 +626,7 @@ public final class WindowInsets { @Deprecated @NonNull public Insets getStableInsets() { - return getInsets(mTypeMaxInsetsMap, mCompatInsetTypes); + return getInsets(mTypeMaxInsetsMap, mCompatInsetsTypes); } /** @@ -939,7 +938,7 @@ public final class WindowInsets { : mDisplayCutout == null ? DisplayCutout.NO_CUTOUT : mDisplayCutout.inset(left, top, right, bottom), - mCompatInsetTypes, mCompatIgnoreVisibility); + mCompatInsetsTypes, mCompatIgnoreVisibility); } @Override diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java index 28a18da37b3e..2fe7c021bb21 100644 --- a/core/java/android/view/WindowManagerImpl.java +++ b/core/java/android/view/WindowManagerImpl.java @@ -276,7 +276,7 @@ public final class WindowManagerImpl implements WindowManager { if (ViewRootImpl.sNewInsetsMode == NEW_INSETS_MODE_FULL) { return insetsState.calculateInsets(bounds, null /* ignoringVisibilityState*/, isScreenRound, alwaysConsumeSystemBars, displayCutout.get(), - SOFT_INPUT_ADJUST_NOTHING, + SOFT_INPUT_ADJUST_NOTHING, attrs.flags, SYSTEM_UI_FLAG_VISIBLE, null /* typeSideMap */); } else { return new WindowInsets.Builder() diff --git a/core/java/com/android/internal/view/IInlineSuggestionsRequestCallback.aidl b/core/java/com/android/internal/view/IInlineSuggestionsRequestCallback.aidl index 03948a92bcab..6c97962ac057 100644 --- a/core/java/com/android/internal/view/IInlineSuggestionsRequestCallback.aidl +++ b/core/java/com/android/internal/view/IInlineSuggestionsRequestCallback.aidl @@ -22,41 +22,54 @@ import android.view.inputmethod.InlineSuggestionsRequest; import com.android.internal.view.IInlineSuggestionsResponseCallback; /** - * Binder interface for the IME service to send an inline suggestion request to the system. + * Binder interface for the IME service to send {@link InlineSuggestionsRequest} or notify other IME + * service events to the system. * {@hide} */ oneway interface IInlineSuggestionsRequestCallback { - // Indicates that the current IME does not support inline suggestion. + /** Indicates that the current IME does not support inline suggestion. */ void onInlineSuggestionsUnsupported(); - // Sends the inline suggestions request from IME to Autofill. Calling this method indicates - // that the IME input is started on the view corresponding to the request. + /** + * Sends the inline suggestions request from IME to Autofill. Calling this method indicates + * that the IME input is started on the view corresponding to the request. + */ void onInlineSuggestionsRequest(in InlineSuggestionsRequest request, in IInlineSuggestionsResponseCallback callback); - // Signals that {@link android.inputmethodservice.InputMethodService - // #onStartInput(EditorInfo, boolean)} is called on the given focused field. + /** + * Signals that {@link android.inputmethodservice.InputMethodService + * #onStartInput(EditorInfo, boolean)} is called on the given focused field. + */ void onInputMethodStartInput(in AutofillId imeFieldId); - // Signals that {@link android.inputmethodservice.InputMethodService - // #dispatchOnShowInputRequested(int, boolean)} is called and shares the call result. - // The true value of {@code requestResult} means the IME is about to be shown, while - // false value means the IME will not be shown. + /** + * Signals that {@link android.inputmethodservice.InputMethodService + * #dispatchOnShowInputRequested(int, boolean)} is called and shares the call result. + * The true value of {@code requestResult} means the IME is about to be shown, while + * false value means the IME will not be shown. + */ void onInputMethodShowInputRequested(boolean requestResult); - // Signals that {@link android.inputmethodservice.InputMethodService - // #onStartInputView(EditorInfo, boolean)} is called on the field specified by the earlier - // {@link #onInputMethodStartInput(AutofillId)}. + /** + * Signals that {@link android.inputmethodservice.InputMethodService + * #onStartInputView(EditorInfo, boolean)} is called on the field specified by the earlier + * {@link #onInputMethodStartInput(AutofillId)}. + */ void onInputMethodStartInputView(); - // Signals that {@link android.inputmethodservice.InputMethodService - // #onFinishInputView(boolean)} is called on the field specified by the earlier - // {@link #onInputMethodStartInput(AutofillId)}. + /** + * Signals that {@link android.inputmethodservice.InputMethodService + * #onFinishInputView(boolean)} is called on the field specified by the earlier + * {@link #onInputMethodStartInput(AutofillId)}. + */ void onInputMethodFinishInputView(); - // Signals that {@link android.inputmethodservice.InputMethodService - // #onFinishInput()} is called on the field specified by the earlier - // {@link #onInputMethodStartInput(AutofillId)}. + /** + * Signals that {@link android.inputmethodservice.InputMethodService + * #onFinishInput()} is called on the field specified by the earlier + * {@link #onInputMethodStartInput(AutofillId)}. + */ void onInputMethodFinishInput(); // Indicates that the current IME changes inline suggestion session. diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml index a2a4adc782c2..cc439ec69b04 100644 --- a/core/res/res/values-de/strings.xml +++ b/core/res/res/values-de/strings.xml @@ -932,7 +932,7 @@ <string name="save_password_label" msgid="9161712335355510035">"Bestätigen"</string> <string name="double_tap_toast" msgid="7065519579174882778">"Tipp: Zum Vergrößern und Verkleinern doppeltippen"</string> <string name="autofill_this_form" msgid="3187132440451621492">"AutoFill"</string> - <string name="setup_autofill" msgid="5431369130866618567">"AutoFill konfig."</string> + <string name="setup_autofill" msgid="5431369130866618567">"Autom.Ausfüll.konf."</string> <string name="autofill_window_title" msgid="4379134104008111961">"Mit <xliff:g id="SERVICENAME">%1$s</xliff:g> automatisch ausfüllen"</string> <string name="autofill_address_name_separator" msgid="8190155636149596125">" "</string> <string name="autofill_address_summary_name_format" msgid="3402882515222673691">"$1$2$3"</string> @@ -1101,7 +1101,7 @@ <string name="selectTextMode" msgid="3225108910999318778">"Text auswählen"</string> <string name="undo" msgid="3175318090002654673">"Rückgängig machen"</string> <string name="redo" msgid="7231448494008532233">"Wiederholen"</string> - <string name="autofill" msgid="511224882647795296">"AutoFill"</string> + <string name="autofill" msgid="511224882647795296">"Automatisches Ausfüllen"</string> <string name="textSelectionCABTitle" msgid="5151441579532476940">"Textauswahl"</string> <string name="addToDictionary" msgid="8041821113480950096">"Zum Wörterbuch hinzufügen"</string> <string name="deleteText" msgid="4200807474529938112">"Löschen"</string> @@ -1928,13 +1928,13 @@ <string name="time_picker_prompt_label" msgid="303588544656363889">"Uhrzeit eingeben"</string> <string name="time_picker_text_input_mode_description" msgid="4761160667516611576">"In den Texteingabemodus wechseln, um die Uhrzeit einzugeben."</string> <string name="time_picker_radial_mode_description" msgid="1222342577115016953">"In den Uhrzeitmodus wechseln, um die Uhrzeit einzugeben."</string> - <string name="autofill_picker_accessibility_title" msgid="4425806874792196599">"AutoFill-Optionen"</string> - <string name="autofill_save_accessibility_title" msgid="1523225776218450005">"Für AutoFill speichern"</string> + <string name="autofill_picker_accessibility_title" msgid="4425806874792196599">"Optionen für automatisches Ausfüllen"</string> + <string name="autofill_save_accessibility_title" msgid="1523225776218450005">"Für \"Automatisches Ausfüllen\" speichern"</string> <string name="autofill_error_cannot_autofill" msgid="6528827648643138596">"Inhalte können nicht automatisch ausgefüllt werden"</string> - <string name="autofill_picker_no_suggestions" msgid="1076022650427481509">"Keine AutoFill-Vorschläge"</string> + <string name="autofill_picker_no_suggestions" msgid="1076022650427481509">"Keine Vorschläge für automatisches Ausfüllen"</string> <plurals name="autofill_picker_some_suggestions" formatted="false" msgid="6651883186966959978"> - <item quantity="other"><xliff:g id="COUNT">%1$s</xliff:g> AutoFill-Vorschläge</item> - <item quantity="one">1 AutoFill-Vorschlag</item> + <item quantity="other"><xliff:g id="COUNT">%1$s</xliff:g> Vorschläge für automatisches Ausfüllen</item> + <item quantity="one">1 Vorschlag für automatisches Ausfüllen</item> </plurals> <string name="autofill_save_title" msgid="7719802414283739775">"In "<b>"<xliff:g id="LABEL">%1$s</xliff:g>"</b>" speichern?"</string> <string name="autofill_save_title_with_type" msgid="3002460014579799605">"<xliff:g id="TYPE">%1$s</xliff:g> in "<b>"<xliff:g id="LABEL">%2$s</xliff:g>"</b>" speichern?"</string> diff --git a/core/res/res/values-eu/strings.xml b/core/res/res/values-eu/strings.xml index 71958e88e99c..b265f4df0c0d 100644 --- a/core/res/res/values-eu/strings.xml +++ b/core/res/res/values-eu/strings.xml @@ -1926,7 +1926,7 @@ <string name="time_picker_header_text" msgid="9073802285051516688">"Ezarri ordua"</string> <string name="time_picker_input_error" msgid="8386271930742451034">"Idatzi balio duen ordu bat"</string> <string name="time_picker_prompt_label" msgid="303588544656363889">"Idatzi ordua"</string> - <string name="time_picker_text_input_mode_description" msgid="4761160667516611576">"Ordua idazteko, aldatu testua idazteko metodora."</string> + <string name="time_picker_text_input_mode_description" msgid="4761160667516611576">"Ordua idazteko, aldatu testua idazteko modura."</string> <string name="time_picker_radial_mode_description" msgid="1222342577115016953">"Aldatu erloju modura ordua zehazteko."</string> <string name="autofill_picker_accessibility_title" msgid="4425806874792196599">"Betetze automatikoaren aukerak"</string> <string name="autofill_save_accessibility_title" msgid="1523225776218450005">"Gorde betetze automatikoarekin erabiltzeko"</string> diff --git a/core/tests/coretests/src/android/view/ImeInsetsSourceConsumerTest.java b/core/tests/coretests/src/android/view/ImeInsetsSourceConsumerTest.java index bfcf52af80bf..eb695258142a 100644 --- a/core/tests/coretests/src/android/view/ImeInsetsSourceConsumerTest.java +++ b/core/tests/coretests/src/android/view/ImeInsetsSourceConsumerTest.java @@ -86,7 +86,7 @@ public class ImeInsetsSourceConsumerTest { false, new DisplayCutout( Insets.of(10, 10, 10, 10), rect, rect, rect, rect), - SOFT_INPUT_ADJUST_RESIZE, 0); + SOFT_INPUT_ADJUST_RESIZE, 0, 0); mImeConsumer = (ImeInsetsSourceConsumer) mController.getSourceConsumer(ITYPE_IME); }); } diff --git a/core/tests/coretests/src/android/view/InsetsControllerTest.java b/core/tests/coretests/src/android/view/InsetsControllerTest.java index c36f1067149e..801cd4ddb94e 100644 --- a/core/tests/coretests/src/android/view/InsetsControllerTest.java +++ b/core/tests/coretests/src/android/view/InsetsControllerTest.java @@ -165,7 +165,7 @@ public class InsetsControllerTest { false, new DisplayCutout( Insets.of(10, 10, 10, 10), rect, rect, rect, rect), - SOFT_INPUT_ADJUST_RESIZE, 0); + SOFT_INPUT_ADJUST_RESIZE, 0, 0); mController.onFrameChanged(new Rect(0, 0, 100, 100)); }); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); diff --git a/core/tests/coretests/src/android/view/InsetsStateTest.java b/core/tests/coretests/src/android/view/InsetsStateTest.java index 5260ef83cc4f..c7d835ca7c7e 100644 --- a/core/tests/coretests/src/android/view/InsetsStateTest.java +++ b/core/tests/coretests/src/android/view/InsetsStateTest.java @@ -29,6 +29,7 @@ import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE; import static android.view.WindowInsets.Type.ime; import static android.view.WindowInsets.Type.navigationBars; import static android.view.WindowInsets.Type.statusBars; +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; @@ -77,7 +78,7 @@ public class InsetsStateTest { mState.getSource(ITYPE_IME).setVisible(true); SparseIntArray typeSideMap = new SparseIntArray(); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, typeSideMap); + false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, 0, typeSideMap); assertEquals(Insets.of(0, 100, 0, 100), insets.getSystemWindowInsets()); assertEquals(Insets.of(0, 100, 0, 100), insets.getInsets(Type.all())); assertEquals(ISIDE_TOP, typeSideMap.get(ITYPE_STATUS_BAR)); @@ -96,7 +97,7 @@ public class InsetsStateTest { mState.getSource(ITYPE_IME).setFrame(new Rect(0, 100, 100, 300)); mState.getSource(ITYPE_IME).setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, null); + false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, 0, null); assertEquals(100, insets.getStableInsetBottom()); assertEquals(Insets.of(0, 0, 0, 100), insets.getInsetsIgnoringVisibility(Type.systemBars())); assertEquals(Insets.of(0, 0, 0, 200), insets.getSystemWindowInsets()); @@ -115,7 +116,7 @@ public class InsetsStateTest { mState.getSource(ITYPE_NAVIGATION_BAR).setFrame(new Rect(80, 0, 100, 300)); mState.getSource(ITYPE_NAVIGATION_BAR).setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, DisplayCutout.NO_CUTOUT, 0, 0, null); + false, DisplayCutout.NO_CUTOUT, 0, 0, 0, null); assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets()); assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(Type.statusBars())); assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(Type.navigationBars())); @@ -131,7 +132,7 @@ public class InsetsStateTest { mState.getSource(ITYPE_IME).setFrame(new Rect(0, 200, 100, 300)); mState.getSource(ITYPE_IME).setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, 0, null); + false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, 0, 0, null); assertEquals(0, insets.getSystemWindowInsetBottom()); assertEquals(100, insets.getInsets(ime()).bottom); assertTrue(insets.isVisible(ime())); @@ -147,11 +148,28 @@ public class InsetsStateTest { mState.getSource(ITYPE_IME).setFrame(new Rect(0, 200, 100, 300)); mState.getSource(ITYPE_IME).setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, + false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, 0, SYSTEM_UI_FLAG_LAYOUT_STABLE, null); assertEquals(100, insets.getSystemWindowInsetTop()); insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false, - DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, + DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, 0, + 0 /* legacySystemUiFlags */, null); + assertEquals(0, insets.getSystemWindowInsetTop()); + } + } + + @Test + public void testCalculateInsets_systemUiFlagLayoutStable_windowFlagFullscreen() { + try (final InsetsModeSession session = + new InsetsModeSession(ViewRootImpl.NEW_INSETS_MODE_FULL)) { + mState.getSource(ITYPE_STATUS_BAR).setFrame(new Rect(0, 0, 100, 100)); + mState.getSource(ITYPE_STATUS_BAR).setVisible(false); + WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, + false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, FLAG_FULLSCREEN, + SYSTEM_UI_FLAG_LAYOUT_STABLE, null); + assertEquals(0, insets.getSystemWindowInsetTop()); + insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false, + DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, 0, 0 /* legacySystemUiFlags */, null); assertEquals(0, insets.getSystemWindowInsetTop()); } @@ -195,7 +213,7 @@ public class InsetsStateTest { mState.getSource(ITYPE_EXTRA_NAVIGATION_BAR).setFrame(new Rect(80, 0, 100, 300)); mState.getSource(ITYPE_EXTRA_NAVIGATION_BAR).setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, DisplayCutout.NO_CUTOUT, 0, 0, null); + false, DisplayCutout.NO_CUTOUT, 0, 0, 0, null); assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets()); assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(Type.statusBars())); assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(Type.navigationBars())); @@ -211,7 +229,7 @@ public class InsetsStateTest { mState.getSource(ITYPE_NAVIGATION_BAR).setFrame(new Rect(80, 0, 100, 300)); mState.getSource(ITYPE_NAVIGATION_BAR).setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, DisplayCutout.NO_CUTOUT, 0, 0, null); + false, DisplayCutout.NO_CUTOUT, 0, 0, 0, null); assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets()); assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(Type.statusBars())); assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(Type.navigationBars())); @@ -226,7 +244,7 @@ public class InsetsStateTest { mState.getSource(ITYPE_IME).setVisible(true); mState.removeSource(ITYPE_IME); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false, - DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, null); + DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, 0, null); assertEquals(0, insets.getSystemWindowInsetBottom()); } diff --git a/location/java/android/location/GpsStatus.java b/location/java/android/location/GpsStatus.java index 496885cd1f37..6a689756a1c0 100644 --- a/location/java/android/location/GpsStatus.java +++ b/location/java/android/location/GpsStatus.java @@ -151,6 +151,15 @@ public final class GpsStatus { return status; } + /** + * Builds an empty GpsStatus. + * + * @hide + */ + static GpsStatus createEmpty() { + return new GpsStatus(); + } + private GpsStatus() { } diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index 241e9399be0a..2a2aaea035ff 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -1922,12 +1922,17 @@ public class LocationManager { GnssStatus gnssStatus = mGnssStatusListenerManager.getGnssStatus(); int ttff = mGnssStatusListenerManager.getTtff(); + + // even though this method is marked nullable, there are legacy applications that expect + // this to never return null, so avoid breaking those apps if (gnssStatus != null) { if (status == null) { status = GpsStatus.create(gnssStatus, ttff); } else { status.setStatus(gnssStatus, ttff); } + } else if (status == null) { + status = GpsStatus.createEmpty(); } return status; } diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java b/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java index 370f9a762402..570a4bb3cd12 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java @@ -197,7 +197,9 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, return; } mView.setHidden(mKeyguardStateController.isShowing()); - mImePositionProcessor.updateAdjustForIme(); + if (!mKeyguardStateController.isShowing()) { + mImePositionProcessor.updateAdjustForIme(); + } } @Override @@ -316,7 +318,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, } private void update(Configuration configuration) { - final boolean isDividerHidden = mView != null && mView.isHidden(); + final boolean isDividerHidden = mView != null && mKeyguardStateController.isShowing(); removeDivider(); addDivider(configuration); @@ -529,6 +531,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, updateVisibility(false /* visible */); mMinimized = false; removeDivider(); + mImePositionProcessor.reset(); } void ensureMinimizedSplit() { diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerImeController.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerImeController.java index 9db389eba3d8..5aeca5e07bdd 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerImeController.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerImeController.java @@ -117,6 +117,18 @@ class DividerImeController implements DisplayImeController.ImePositionProcessor && (imeSplit.asBinder() == mSplits.mSecondary.token.asBinder()); } + void reset() { + mPaused = true; + mPausedTargetAdjusted = false; + mAdjustedWhileHidden = false; + mAnimation = null; + mAdjusted = mTargetAdjusted = false; + mImeWasShown = mTargetShown = false; + mTargetPrimaryDim = mTargetSecondaryDim = mLastPrimaryDim = mLastSecondaryDim = 0.f; + mSecondaryHasFocus = false; + mLastAdjustTop = -1; + } + private void updateDimTargets() { final boolean splitIsVisible = !getView().isHidden(); mTargetPrimaryDim = (mSecondaryHasFocus && mTargetShown && splitIsVisible) @@ -126,18 +138,20 @@ class DividerImeController implements DisplayImeController.ImePositionProcessor } @Override - public void onImeStartPositioning(int displayId, int hiddenTop, int shownTop, - boolean imeShouldShow, SurfaceControl.Transaction t) { + @ImeAnimationFlags + public int onImeStartPositioning(int displayId, int hiddenTop, int shownTop, + boolean imeShouldShow, boolean imeIsFloating, SurfaceControl.Transaction t) { mHiddenTop = hiddenTop; mShownTop = shownTop; mTargetShown = imeShouldShow; if (!isDividerVisible()) { - return; + return 0; } final boolean splitIsVisible = !getView().isHidden(); mSecondaryHasFocus = getSecondaryHasFocus(displayId); final boolean targetAdjusted = splitIsVisible && imeShouldShow && mSecondaryHasFocus - && !getLayout().mDisplayLayout.isLandscape() && !mSplits.mDivider.isMinimized(); + && !imeIsFloating && !getLayout().mDisplayLayout.isLandscape() + && !mSplits.mDivider.isMinimized(); if (mLastAdjustTop < 0) { mLastAdjustTop = imeShouldShow ? hiddenTop : shownTop; } else if (mLastAdjustTop != (imeShouldShow ? mShownTop : mHiddenTop)) { @@ -155,7 +169,7 @@ class DividerImeController implements DisplayImeController.ImePositionProcessor if (mPaused) { mPausedTargetAdjusted = targetAdjusted; if (DEBUG) Slog.d(TAG, " ime starting but paused " + dumpState()); - return; + return (targetAdjusted || mAdjusted) ? IME_ANIMATION_NO_ALPHA : 0; } mTargetAdjusted = targetAdjusted; updateDimTargets(); @@ -174,6 +188,7 @@ class DividerImeController implements DisplayImeController.ImePositionProcessor } else { mAdjustedWhileHidden = true; } + return (mTargetAdjusted || mAdjusted) ? IME_ANIMATION_NO_ALPHA : 0; } private void updateImeAdjustState() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java index 8fcaa67e7614..23d03a4b225a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java @@ -80,6 +80,22 @@ public class KeyButtonDrawable extends Drawable { private final Paint mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); private final ShadowDrawableState mState; private AnimatedVectorDrawable mAnimatedDrawable; + private final Callback mAnimatedDrawableCallback = new Callback() { + @Override + public void invalidateDrawable(@NonNull Drawable who) { + invalidateSelf(); + } + + @Override + public void scheduleDrawable(@NonNull Drawable who, @NonNull Runnable what, long when) { + scheduleSelf(what, when); + } + + @Override + public void unscheduleDrawable(@NonNull Drawable who, @NonNull Runnable what) { + unscheduleSelf(what); + } + }; public KeyButtonDrawable(Drawable d, @ColorInt int lightColor, @ColorInt int darkColor, boolean horizontalFlip, Color ovalBackgroundColor) { @@ -97,6 +113,7 @@ public class KeyButtonDrawable extends Drawable { } if (canAnimate()) { mAnimatedDrawable = (AnimatedVectorDrawable) mState.mChildState.newDrawable().mutate(); + mAnimatedDrawable.setCallback(mAnimatedDrawableCallback); setDrawableBounds(mAnimatedDrawable); } } diff --git a/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java b/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java index 1ce98eb152c8..926f653153ee 100644 --- a/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java +++ b/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java @@ -19,6 +19,7 @@ package com.android.systemui.wm; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; +import android.annotation.IntDef; import android.content.Context; import android.content.res.Configuration; import android.graphics.Point; @@ -136,12 +137,16 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged } } - private void dispatchStartPositioning(int displayId, int hiddenTop, int shownTop, - boolean show, SurfaceControl.Transaction t) { + @ImePositionProcessor.ImeAnimationFlags + private int dispatchStartPositioning(int displayId, int hiddenTop, int shownTop, + boolean show, boolean isFloating, SurfaceControl.Transaction t) { synchronized (mPositionProcessors) { + int flags = 0; for (ImePositionProcessor pp : mPositionProcessors) { - pp.onImeStartPositioning(displayId, hiddenTop, shownTop, show, t); + flags |= pp.onImeStartPositioning( + displayId, hiddenTop, shownTop, show, isFloating, t); } + return flags; } } @@ -184,6 +189,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged int mRotation = Surface.ROTATION_0; boolean mImeShowing = false; final Rect mImeFrame = new Rect(); + boolean mAnimateAlpha = true; PerDisplay(int displayId, int initialRotation) { mDisplayId = displayId; @@ -268,15 +274,29 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged return mImeFrame.top + (int) surfaceOffset; } + private boolean calcIsFloating(InsetsSource imeSource) { + final Rect frame = imeSource.getFrame(); + if (frame.height() == 0) { + return true; + } + // Some Floating Input Methods will still report a frame, but the frame is actually + // a nav-bar inset created by WM and not part of the IME (despite being reported as + // an IME inset). For now, we assume that no non-floating IME will be <= this nav bar + // frame height so any reported frame that is <= nav-bar frame height is assumed to + // be floating. + return frame.height() <= mSystemWindows.mDisplayController.getDisplayLayout(mDisplayId) + .navBarFrameHeight(); + } + private void startAnimation(final boolean show, final boolean forceRestart) { final InsetsSource imeSource = mInsetsState.getSource(InsetsState.ITYPE_IME); if (imeSource == null || mImeSourceControl == null) { return; } final Rect newFrame = imeSource.getFrame(); - final boolean isFloating = newFrame.height() == 0 && show; + final boolean isFloating = calcIsFloating(imeSource) && show; if (isFloating) { - // This is likely a "floating" or "expanded" IME, so to get animations, just + // This is 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) ( @@ -329,7 +349,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; + final float alpha = (mAnimateAlpha || isFloating) + ? (value - hiddenY) / (shownY - hiddenY) : 1.f; t.setAlpha(mImeSourceControl.getLeash(), alpha); dispatchPositionChanged(mDisplayId, imeTop(value), t); t.apply(); @@ -342,16 +363,18 @@ 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) + " showing:" + (mAnimationDirection == DIRECTION_SHOW)); } - dispatchStartPositioning(mDisplayId, imeTop(hiddenY), - imeTop(shownY), mAnimationDirection == DIRECTION_SHOW, - t); + int flags = dispatchStartPositioning(mDisplayId, imeTop(hiddenY), + imeTop(shownY), mAnimationDirection == DIRECTION_SHOW, isFloating, t); + mAnimateAlpha = (flags & ImePositionProcessor.IME_ANIMATION_NO_ALPHA) == 0; + final float alpha = (mAnimateAlpha || isFloating) + ? (startY - hiddenY) / (shownY - hiddenY) + : 1.f; + t.setAlpha(mImeSourceControl.getLeash(), alpha); if (mAnimationDirection == DIRECTION_SHOW) { t.show(mImeSourceControl.getLeash()); } @@ -414,15 +437,33 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged */ public interface ImePositionProcessor { /** + * Indicates that ime shouldn't animate alpha. It will always be opaque. Used when stuff + * behind the IME shouldn't be visible (for example during split-screen adjustment where + * there is nothing behind the ime). + */ + int IME_ANIMATION_NO_ALPHA = 1; + + /** @hide */ + @IntDef(prefix = { "IME_ANIMATION_" }, value = { + IME_ANIMATION_NO_ALPHA, + }) + @interface ImeAnimationFlags {} + + /** * Called when the IME position is starting to animate. * * @param hiddenTop The y position of the top of the IME surface when it is hidden. * @param shownTop The y position of the top of the IME surface when it is shown. * @param showing {@code true} when we are animating from hidden to shown, {@code false} * when animating from shown to hidden. + * @param isFloating {@code true} when the ime is a floating ime (doesn't inset). + * @return flags that may alter how ime itself is animated (eg. no-alpha). */ - default void onImeStartPositioning(int displayId, int hiddenTop, int shownTop, - boolean showing, SurfaceControl.Transaction t) {} + @ImeAnimationFlags + default int onImeStartPositioning(int displayId, int hiddenTop, int shownTop, + boolean showing, boolean isFloating, SurfaceControl.Transaction t) { + return 0; + } /** * Called when the ime position changed. This is expected to be a synchronous call on the diff --git a/packages/SystemUI/src/com/android/systemui/wm/DisplayLayout.java b/packages/SystemUI/src/com/android/systemui/wm/DisplayLayout.java index cfec1c07ff1d..a341f3050ea6 100644 --- a/packages/SystemUI/src/com/android/systemui/wm/DisplayLayout.java +++ b/packages/SystemUI/src/com/android/systemui/wm/DisplayLayout.java @@ -79,6 +79,7 @@ public class DisplayLayout { private final Rect mStableInsets = new Rect(); private boolean mHasNavigationBar = false; private boolean mHasStatusBar = false; + private int mNavBarFrameHeight = 0; /** * Create empty layout. @@ -146,6 +147,7 @@ public class DisplayLayout { if (mHasStatusBar) { convertNonDecorInsetsToStableInsets(res, mStableInsets, mWidth, mHeight, mHasStatusBar); } + mNavBarFrameHeight = getNavigationBarFrameHeight(res, mWidth > mHeight); } /** @@ -214,6 +216,11 @@ public class DisplayLayout { return mWidth > mHeight; } + /** Get the navbar frame height (used by ime). */ + public int navBarFrameHeight() { + return mNavBarFrameHeight; + } + /** Gets the orientation of this layout */ public int getOrientation() { return (mWidth > mHeight) ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT; @@ -483,6 +490,7 @@ public class DisplayLayout { } else { return res.getDimensionPixelSize(R.dimen.navigation_bar_width_car_mode); } + } else { if (navBarSide == NAV_BAR_BOTTOM) { return res.getDimensionPixelSize(landscape @@ -493,4 +501,11 @@ public class DisplayLayout { } } } + + /** @see com.android.server.wm.DisplayPolicy#getNavigationBarFrameHeight */ + public static int getNavigationBarFrameHeight(Resources res, boolean landscape) { + return res.getDimensionPixelSize(landscape + ? R.dimen.navigation_bar_frame_height_landscape + : R.dimen.navigation_bar_frame_height); + } } diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java index d51ca6e9ab42..4fab067d1d3b 100644 --- a/services/core/java/com/android/server/AlarmManagerService.java +++ b/services/core/java/com/android/server/AlarmManagerService.java @@ -150,8 +150,6 @@ class AlarmManagerService extends SystemService { // TODO (b/157782538): Turn off once bug is fixed. static final boolean DEBUG_PER_UID_LIMIT = true; - // TODO (b/157782538): Turn off once bug is fixed. - static final boolean WARN_SYSTEM_ON_ALARM_LIMIT = true; static final boolean RECORD_ALARMS_IN_HISTORY = true; static final boolean RECORD_DEVICE_IDLE_ALARMS = false; @@ -1774,19 +1772,8 @@ class AlarmManagerService extends SystemService { "Maximum limit of concurrent alarms " + mConstants.MAX_ALARMS_PER_UID + " reached for uid: " + UserHandle.formatUid(callingUid) + ", callingPackage: " + callingPackage; - - if (WARN_SYSTEM_ON_ALARM_LIMIT && UserHandle.isCore(callingUid)) { - final StringWriter logWriter = new StringWriter(); - final PrintWriter pw = new PrintWriter(logWriter); - pw.println(errorMsg); - pw.println("Next 20 alarms for " + callingUid + ":"); - dumpUpcomingNAlarmsForUid(pw, callingUid, 20); - pw.flush(); - Slog.wtf(TAG, logWriter.toString()); - } else { - Slog.w(TAG, errorMsg); - } - if (DEBUG_PER_UID_LIMIT) { + Slog.w(TAG, errorMsg); + if (DEBUG_PER_UID_LIMIT && UserHandle.isCore(callingUid)) { logAllAlarmsForUidLocked(callingUid); } throw new IllegalStateException(errorMsg); diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index a2f76e99810c..9994f6647699 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -6058,7 +6058,7 @@ public class ActivityManagerService extends IActivityManager.Stub mPendingStartActivityUids.isPendingTopPid(pr.uid, pids[i]); states[i] = isPendingTop ? PROCESS_STATE_TOP : pr.getCurProcState(); if (scores != null) { - scores[i] = isPendingTop ? ProcessList.FOREGROUND_APP_ADJ : pr.curAdj; + scores[i] = isPendingTop ? (ProcessList.FOREGROUND_APP_ADJ - 1) : pr.curAdj; } } else { states[i] = PROCESS_STATE_NONEXISTENT; diff --git a/services/core/java/com/android/server/audio/SoundEffectsHelper.java b/services/core/java/com/android/server/audio/SoundEffectsHelper.java index 6d29b0e0078c..762f4d7dcab8 100644 --- a/services/core/java/com/android/server/audio/SoundEffectsHelper.java +++ b/services/core/java/com/android/server/audio/SoundEffectsHelper.java @@ -436,11 +436,12 @@ class SoundEffectsHelper { onUnloadSoundEffects(); break; case MSG_PLAY_EFFECT: + final int effect = msg.arg1, volume = msg.arg2; onLoadSoundEffects(new OnEffectsLoadCompleteHandler() { @Override public void run(boolean success) { if (success) { - onPlaySoundEffect(msg.arg1 /*effect*/, msg.arg2 /*volume*/); + onPlaySoundEffect(effect, volume); } } }); diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index f533eb2cf2be..b4ab57fa4dc8 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -7161,8 +7161,9 @@ public class PackageManagerService extends IPackageManager.Stub && ((!matchInstantApp && !isCallerInstantApp && isTargetInstantApp) || (matchVisibleToInstantAppOnly && isCallerInstantApp && isTargetHiddenFromInstantApp)); - final boolean blockNormalResolution = !isTargetInstantApp && !isCallerInstantApp - && shouldFilterApplicationLocked( + final boolean blockNormalResolution = + !resolveForStart && !isTargetInstantApp && !isCallerInstantApp + && shouldFilterApplicationLocked( getPackageSettingInternal(ai.applicationInfo.packageName, Process.SYSTEM_UID), filterCallingUid, userId); if (!blockInstantResolution && !blockNormalResolution) { @@ -7255,8 +7256,8 @@ public class PackageManagerService extends IPackageManager.Stub final PackageSetting setting = getPackageSettingInternal(pkgName, Process.SYSTEM_UID); result = null; - if (setting != null && setting.pkg != null - && !shouldFilterApplicationLocked(setting, filterCallingUid, userId)) { + if (setting != null && setting.pkg != null && (resolveForStart + || !shouldFilterApplicationLocked(setting, filterCallingUid, userId))) { result = filterIfNotSystemUser(mComponentResolver.queryActivities( intent, resolvedType, flags, setting.pkg.getActivities(), userId), userId); @@ -25538,7 +25539,8 @@ public class PackageManagerService extends IPackageManager.Stub private void applyMimeGroupChanges(String packageName, String mimeGroup) { if (mComponentResolver.updateMimeGroup(packageName, mimeGroup)) { - clearPackagePreferredActivities(packageName, UserHandle.USER_ALL); + Binder.withCleanCallingIdentity(() -> + clearPackagePreferredActivities(packageName, UserHandle.USER_ALL)); } mPmInternal.writeSettings(false); diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java index 936ba7f3b097..3de2dc2fdef3 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -1407,7 +1407,7 @@ public final class Settings { if (pa.mPref.getParseError() == null) { final PreferredIntentResolver resolver = editPreferredActivitiesLPw(userId); ArrayList<PreferredActivity> pal = resolver.findFilters(pa); - if (pal == null || pal.size() == 0) { + if (pal == null || pal.size() == 0 || pa.mPref.mAlways) { resolver.addFilter(pa); } } else { diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java index c2021303c11c..e85049cad2f4 100644 --- a/services/core/java/com/android/server/wm/TaskSnapshotController.java +++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java @@ -615,8 +615,9 @@ class TaskSnapshotController { static Rect getSystemBarInsets(Rect frame, InsetsState state) { return state.calculateInsets(frame, null /* ignoringVisibilityState */, false /* isScreenRound */, false /* alwaysConsumeSystemBars */, - null /* displayCutout */, 0 /* legacySoftInputMode */, 0 /* legacySystemUiFlags */, - null /* typeSideMap */).getInsets(WindowInsets.Type.systemBars()).toRect(); + null /* displayCutout */, 0 /* legacySoftInputMode */, 0 /* legacyWindowFlags */, + 0 /* legacySystemUiFlags */, null /* typeSideMap */).getInsets( + WindowInsets.Type.systemBars()).toRect(); } void dump(PrintWriter pw, String prefix) { diff --git a/services/incremental/IncrementalService.cpp b/services/incremental/IncrementalService.cpp index 3450c3ae9fb3..a5f0d045948c 100644 --- a/services/incremental/IncrementalService.cpp +++ b/services/incremental/IncrementalService.cpp @@ -1422,6 +1422,11 @@ static long elapsedMcs(Duration start, Duration end) { } // Extract lib files from zip, create new files in incfs and write data to them +// Lib files should be placed next to the APK file in the following matter: +// Example: +// /path/to/base.apk +// /path/to/lib/arm/first.so +// /path/to/lib/arm/second.so bool IncrementalService::configureNativeBinaries(StorageId storage, std::string_view apkFullPath, std::string_view libDirRelativePath, std::string_view abi, bool extractNativeLibs) { @@ -1433,9 +1438,13 @@ bool IncrementalService::configureNativeBinaries(StorageId storage, std::string_ return false; } + const auto targetLibPathRelativeToStorage = + path::join(path::dirname(normalizePathToStorage(*ifs, storage, apkFullPath)), + libDirRelativePath); + // First prepare target directories if they don't exist yet - if (auto res = makeDirs(*ifs, storage, libDirRelativePath, 0755)) { - LOG(ERROR) << "Failed to prepare target lib directory " << libDirRelativePath + if (auto res = makeDirs(*ifs, storage, targetLibPathRelativeToStorage, 0755)) { + LOG(ERROR) << "Failed to prepare target lib directory " << targetLibPathRelativeToStorage << " errno: " << res; return false; } @@ -1486,7 +1495,7 @@ bool IncrementalService::configureNativeBinaries(StorageId storage, std::string_ auto startFileTs = Clock::now(); const auto libName = path::basename(fileName); - auto targetLibPath = path::join(libDirRelativePath, libName); + auto targetLibPath = path::join(targetLibPathRelativeToStorage, libName); const auto targetLibPathAbsolute = normalizePathToStorage(*ifs, storage, targetLibPath); // If the extract file already exists, skip if (access(targetLibPathAbsolute.c_str(), F_OK) == 0) { diff --git a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java index bc987a6282c7..71a1964210b0 100644 --- a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java +++ b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java @@ -623,6 +623,10 @@ public final class TelephonyPermissions { } private static int getCarrierPrivilegeStatus(Context context, int subId, int uid) { + if (uid == Process.SYSTEM_UID || uid == Process.PHONE_UID) { + // Skip the check if it's one of these special uids + return TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS; + } final long identity = Binder.clearCallingIdentity(); try { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService( |