diff options
131 files changed, 1745 insertions, 721 deletions
diff --git a/api/test-current.txt b/api/test-current.txt index 1a912a1c69b1..be92106e119e 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -646,6 +646,7 @@ package android.content { method public void setContentCaptureOptions(@Nullable android.content.ContentCaptureOptions); field public static final String BUGREPORT_SERVICE = "bugreport"; field public static final String CONTENT_CAPTURE_MANAGER_SERVICE = "content_capture"; + field public static final String PERMISSION_SERVICE = "permission"; field public static final String ROLLBACK_SERVICE = "rollback"; field public static final String STATUS_BAR_SERVICE = "statusbar"; field public static final String TEST_NETWORK_SERVICE = "test_network"; @@ -2214,6 +2215,18 @@ package android.permission { method public abstract void onRevokeRuntimePermissions(@NonNull java.util.Map<java.lang.String,java.util.List<java.lang.String>>); } + public final class PermissionManager { + method @IntRange(from=0) @RequiresPermission("android.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY") public int getRuntimePermissionsVersion(); + method @NonNull public java.util.List<android.permission.PermissionManager.SplitPermissionInfo> getSplitPermissions(); + method @RequiresPermission("android.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY") public void setRuntimePermissionsVersion(@IntRange(from=0) int); + } + + public static final class PermissionManager.SplitPermissionInfo { + method @NonNull public java.util.List<java.lang.String> getNewPermissions(); + method @NonNull public String getSplitPermission(); + method public int getTargetSdk(); + } + public final class RuntimePermissionPresentationInfo implements android.os.Parcelable { ctor public RuntimePermissionPresentationInfo(@NonNull CharSequence, boolean, boolean); method public int describeContents(); diff --git a/cmds/statsd/src/metrics/MetricProducer.cpp b/cmds/statsd/src/metrics/MetricProducer.cpp index 0e3cde5364b1..92752b29ecda 100644 --- a/cmds/statsd/src/metrics/MetricProducer.cpp +++ b/cmds/statsd/src/metrics/MetricProducer.cpp @@ -174,7 +174,9 @@ void MetricProducer::loadActiveMetricLocked(const ActiveMetric& activeMetric, continue; } auto& activation = it->second; - if (activeEventActivation.state() == ActiveEventActivation::ACTIVE) { + // If the event activation does not have a state, assume it is active. + if (!activeEventActivation.has_state() || + activeEventActivation.state() == ActiveEventActivation::ACTIVE) { // We don't want to change the ttl for future activations, so we set the start_ns // such that start_ns + ttl_ns == currentTimeNs + remaining_ttl_nanos activation->start_ns = diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 2eb09020b428..dc52c52cca1f 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -2330,7 +2330,7 @@ public class Activity extends ContextThemeWrapper * calling {@link VoiceInteractor#notifyDirectActionsChanged()}. * * <p>To get the voice interactor you need to call {@link #getVoiceInteractor()} - * which would return non <code>null<c/ode> only if there is an ongoing voice + * which would return non <code>null</code> only if there is an ongoing voice * interaction session. You an also detect when the voice interactor is no * longer valid because the voice interaction session that is backing is finished * by calling {@link VoiceInteractor#registerOnDestroyedCallback(Executor, Runnable)}. @@ -2339,7 +2339,7 @@ public class Activity extends ContextThemeWrapper * before {@link #onStop()} is being called. * * <p>You should pass to the callback the currently supported direct actions which - * cannot be <code>null</code> or contain <code>null</null> elements. + * cannot be <code>null</code> or contain <code>null</code> elements. * * <p>You should return the action list as soon as possible to ensure the consumer, * for example the assistant, is as responsive as possible which would improve user diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 507e97e3df05..d082f33cdefe 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -16,6 +16,8 @@ package android.app.admin; +import static com.android.internal.util.function.pooled.PooledLambda.obtainMessage; + import android.Manifest.permission; import android.annotation.CallbackExecutor; import android.annotation.ColorInt; @@ -88,6 +90,7 @@ import android.util.Log; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.os.BackgroundThread; import com.android.internal.util.Preconditions; import com.android.org.conscrypt.TrustedCertificateStore; @@ -8810,6 +8813,11 @@ public class DevicePolicyManager { mService.setPermissionGrantState(admin, mContext.getPackageName(), packageName, permission, grantState, new RemoteCallback((b) -> result.complete(b != null))); + // Timeout + BackgroundThread.getHandler().sendMessageDelayed( + obtainMessage(CompletableFuture::complete, result, false), + 20_000); + return result.get(); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 941eda8bcf1f..529677aea653 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -4126,6 +4126,7 @@ public abstract class Context { * @see #getSystemService(String) * @hide */ + @TestApi @SystemApi public static final String PERMISSION_SERVICE = "permission"; diff --git a/core/java/android/net/DnsResolver.java b/core/java/android/net/DnsResolver.java index 7a85dcbfc830..0b1a84534e38 100644 --- a/core/java/android/net/DnsResolver.java +++ b/core/java/android/net/DnsResolver.java @@ -34,6 +34,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.os.CancellationSignal; import android.os.Looper; +import android.os.MessageQueue; import android.system.ErrnoException; import android.util.Log; @@ -466,10 +467,20 @@ public final class DnsResolver { private void registerFDListener(@NonNull Executor executor, @NonNull FileDescriptor queryfd, @NonNull Callback<? super byte[]> answerCallback, @Nullable CancellationSignal cancellationSignal, @NonNull Object lock) { - Looper.getMainLooper().getQueue().addOnFileDescriptorEventListener( + final MessageQueue mainThreadMessageQueue = Looper.getMainLooper().getQueue(); + mainThreadMessageQueue.addOnFileDescriptorEventListener( queryfd, FD_EVENTS, (fd, events) -> { + // b/134310704 + // Unregister fd event listener before resNetworkResult is called to prevent + // race condition caused by fd reused. + // For example when querying v4 and v6, it's possible that the first query ends + // and the fd is closed before the second request starts, which might return + // the same fd for the second request. By that time, the looper must have + // unregistered the fd, otherwise another event listener can't be registered. + mainThreadMessageQueue.removeOnFileDescriptorEventListener(fd); + executor.execute(() -> { DnsResponse resp = null; ErrnoException exception = null; @@ -490,7 +501,11 @@ public final class DnsResolver { } answerCallback.onAnswer(resp.answerbuf, resp.rcode); }); - // Unregister this fd listener + + // The file descriptor has already been unregistered, so it does not really + // matter what is returned here. In spirit 0 (meaning "unregister this FD") + // is still the closest to what the looper needs to do. When returning 0, + // Looper knows to ignore the fd if it has already been unregistered. return 0; }); } diff --git a/core/java/android/os/ExternalVibration.java b/core/java/android/os/ExternalVibration.java index b93bef8b33ef..37ca868598f5 100644 --- a/core/java/android/os/ExternalVibration.java +++ b/core/java/android/os/ExternalVibration.java @@ -114,6 +114,24 @@ public class ExternalVibration implements Parcelable { return true; } + /** + * Links a recipient to death against this external vibration token + */ + public void linkToDeath(IBinder.DeathRecipient recipient) { + try { + mToken.linkToDeath(recipient, 0); + } catch (RemoteException e) { + return; + } + } + + /** + * Unlinks a recipient to death against this external vibration token + */ + public void unlinkToDeath(IBinder.DeathRecipient recipient) { + mToken.unlinkToDeath(recipient, 0); + } + @Override public boolean equals(Object o) { if (o == null || !(o instanceof ExternalVibration)) { diff --git a/core/java/android/permission/PermissionManager.java b/core/java/android/permission/PermissionManager.java index e15659db90a8..182a2ffa5221 100644 --- a/core/java/android/permission/PermissionManager.java +++ b/core/java/android/permission/PermissionManager.java @@ -39,6 +39,7 @@ import java.util.Objects; * * @hide */ +@TestApi @SystemApi @SystemService(Context.PERMISSION_SERVICE) public final class PermissionManager { @@ -140,12 +141,13 @@ public final class PermissionManager { if (o == null || getClass() != o.getClass()) return false; SplitPermissionInfo that = (SplitPermissionInfo) o; return mTargetSdk == that.mTargetSdk - && Objects.equals(mSplitPerm, that.mSplitPerm); + && mSplitPerm.equals(that.mSplitPerm) + && mNewPerms.equals(that.mNewPerms); } @Override public int hashCode() { - return Objects.hash(mSplitPerm, mTargetSdk); + return Objects.hash(mSplitPerm, mNewPerms, mTargetSdk); } /** diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java index 9a11104b30c1..19dbc6a2ec00 100644 --- a/core/java/android/provider/DeviceConfig.java +++ b/core/java/android/provider/DeviceConfig.java @@ -48,6 +48,8 @@ import java.util.concurrent.Executor; /** * Device level configuration parameters which can be tuned by a separate configuration service. + * Namespaces that end in "_native" such as {@link #NAMESPACE_NETD_NATIVE} are intended to be used + * by native code and should be pushed to system properties to make them accessible. * * @hide */ diff --git a/core/java/android/view/accessibility/AccessibilityNodeIdManager.java b/core/java/android/view/accessibility/AccessibilityNodeIdManager.java index 0f5e950582dd..d78dadd294ca 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeIdManager.java +++ b/core/java/android/view/accessibility/AccessibilityNodeIdManager.java @@ -16,12 +16,11 @@ package android.view.accessibility; -import android.util.SparseArray; import android.view.View; /** @hide */ public final class AccessibilityNodeIdManager { - private SparseArray<View> mIdsToViews = new SparseArray<>(); + private WeakSparseArray<View> mIdsToViews = new WeakSparseArray<View>(); private static AccessibilityNodeIdManager sIdManager; /** diff --git a/core/java/android/view/accessibility/WeakSparseArray.java b/core/java/android/view/accessibility/WeakSparseArray.java new file mode 100644 index 000000000000..04a4cc7f062b --- /dev/null +++ b/core/java/android/view/accessibility/WeakSparseArray.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.view.accessibility; + +import android.util.SparseArray; + +import java.lang.ref.Reference; +import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; + + +final class WeakSparseArray<E> { + + private final ReferenceQueue<E> mRefQueue = new ReferenceQueue<>(); + private final SparseArray<WeakReferenceWithId<E>> mSparseArray = new SparseArray<>(); + + public void append(int key, E value) { + removeUnreachableValues(); + mSparseArray.append(key, new WeakReferenceWithId(value, mRefQueue, key)); + } + + public void remove(int key) { + removeUnreachableValues(); + mSparseArray.remove(key); + } + + public E get(int key) { + removeUnreachableValues(); + WeakReferenceWithId<E> ref = mSparseArray.get(key); + return ref != null ? ref.get() : null; + } + + private void removeUnreachableValues() { + for (Reference ref = mRefQueue.poll(); ref != null; ref = mRefQueue.poll()) { + mSparseArray.remove(((WeakReferenceWithId) ref).mId); + } + } + + private static class WeakReferenceWithId<E> extends WeakReference<E> { + + final int mId; + + WeakReferenceWithId(E referent, ReferenceQueue<? super E> q, int id) { + super(referent, q); + mId = id; + } + } +} + diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index 18c6abb3f5f1..50bb6883b903 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -38,6 +38,11 @@ import android.view.accessibility.AccessibilityNodeInfo; import android.view.inspector.InspectableProperty; import com.android.internal.R; +import com.android.internal.util.Preconditions; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; /** @@ -91,6 +96,10 @@ public abstract class AbsSeekBar extends ProgressBar { @UnsupportedAppUsage private boolean mIsDragging; + private List<Rect> mUserGestureExclusionRects = Collections.emptyList(); + private final List<Rect> mGestureExclusionRects = new ArrayList<>(); + private final Rect mThumbRect = new Rect(); + public AbsSeekBar(Context context) { super(context); } @@ -735,6 +744,27 @@ public abstract class AbsSeekBar extends ProgressBar { // Canvas will be translated, so 0,0 is where we start drawing thumb.setBounds(left, top, right, bottom); + updateGestureExclusionRects(); + } + + @Override + public void setSystemGestureExclusionRects(@NonNull List<Rect> rects) { + Preconditions.checkNotNull(rects, "rects must not be null"); + mUserGestureExclusionRects = rects; + updateGestureExclusionRects(); + } + + private void updateGestureExclusionRects() { + final Drawable thumb = mThumb; + if (thumb == null) { + super.setSystemGestureExclusionRects(mUserGestureExclusionRects); + return; + } + mGestureExclusionRects.clear(); + thumb.copyBounds(mThumbRect); + mGestureExclusionRects.add(mThumbRect); + mGestureExclusionRects.addAll(mUserGestureExclusionRects); + super.setSystemGestureExclusionRects(mGestureExclusionRects); } /** diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index c9ef038b78de..cac75cfd8432 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -134,6 +134,7 @@ import java.lang.annotation.RetentionPolicy; import java.text.BreakIterator; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; @@ -5097,6 +5098,12 @@ public class Editor { void onHandleMoved() {} public void onDetached() {} + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + setSystemGestureExclusionRects(Collections.singletonList(new Rect(0, 0, w, h))); + } } private class InsertionHandleView extends HandleView { diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 073965b35101..62598fce5947 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -1011,6 +1011,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ TypedArray a = theme.obtainStyledAttributes(attrs, com.android.internal.R.styleable.TextViewAppearance, defStyleAttr, defStyleRes); + saveAttributeDataForStyleable(context, com.android.internal.R.styleable.TextViewAppearance, + attrs, a, defStyleAttr, defStyleRes); TypedArray appearance = null; int ap = a.getResourceId( com.android.internal.R.styleable.TextViewAppearance_textAppearance, -1); @@ -1018,6 +1020,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener if (ap != -1) { appearance = theme.obtainStyledAttributes( ap, com.android.internal.R.styleable.TextAppearance); + saveAttributeDataForStyleable(context, com.android.internal.R.styleable.TextAppearance, + null, appearance, 0, ap); } if (appearance != null) { readTextAppearance(context, appearance, attributes, false /* styleArray */); diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java index dc3099de5015..5294714c05ae 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -110,6 +110,7 @@ import android.widget.Toast; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; +import com.android.internal.content.PackageMonitor; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.util.ImageUtils; @@ -125,8 +126,10 @@ import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; /** * The Chooser Activity handles intent resolution specifically for sharing intents - @@ -185,7 +188,6 @@ public class ChooserActivity extends ResolverActivity { private static final int SHARE_TARGET_QUERY_PACKAGE_LIMIT = 20; private static final int QUERY_TARGET_SERVICE_LIMIT = 5; - private static final int WATCHDOG_TIMEOUT_MILLIS = 5000; private static final int DEFAULT_SALT_EXPIRATION_DAYS = 7; private int mMaxHashSaltDays = DeviceConfig.getInt(DeviceConfig.NAMESPACE_SYSTEMUI, @@ -211,6 +213,8 @@ public class ChooserActivity extends ResolverActivity { private ChooserRowAdapter mChooserRowAdapter; private int mChooserRowServiceSpacing; + private int mCurrAvailableWidth = 0; + /** {@link ChooserActivity#getBaseScore} */ private static final float CALLER_TARGET_SCORE_BOOST = 900.f; /** {@link ChooserActivity#getBaseScore} */ @@ -220,12 +224,7 @@ public class ChooserActivity extends ResolverActivity { private static final int MAX_RANKED_TARGETS = 4; private final List<ChooserTargetServiceConnection> mServiceConnections = new ArrayList<>(); - - private static final int CHOOSER_TARGET_SERVICE_RESULT = 1; - private static final int CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT = 2; - private static final int SHORTCUT_MANAGER_SHARE_TARGET_RESULT = 3; - private static final int SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED = 4; - private static final int LIST_VIEW_UPDATE_MESSAGE = 5; + private final Set<ComponentName> mServicesRequested = new HashSet<>(); private static final int MAX_LOG_RANK_POSITION = 12; @@ -255,11 +254,13 @@ public class ChooserActivity extends ResolverActivity { private ContentPreviewCoordinator mPreviewCoord; private class ContentPreviewCoordinator { - private static final int IMAGE_LOAD_TIMEOUT_MILLIS = 300; private static final int IMAGE_FADE_IN_MILLIS = 150; private static final int IMAGE_LOAD_TIMEOUT = 1; private static final int IMAGE_LOAD_INTO_VIEW = 2; + private final int mImageLoadTimeoutMillis = + getResources().getInteger(R.integer.config_shortAnimTime); + private final View mParentView; private boolean mHideParentOnFail; private boolean mAtLeastOneLoaded = false; @@ -328,7 +329,7 @@ public class ChooserActivity extends ResolverActivity { private void loadUriIntoView(final int imageResourceId, final Uri uri, final int extraImages) { - mHandler.sendEmptyMessageDelayed(IMAGE_LOAD_TIMEOUT, IMAGE_LOAD_TIMEOUT_MILLIS); + mHandler.sendEmptyMessageDelayed(IMAGE_LOAD_TIMEOUT, mImageLoadTimeoutMillis); AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> { final Bitmap bmp = loadThumbnail(uri, new Size(200, 200)); @@ -347,7 +348,7 @@ public class ChooserActivity extends ResolverActivity { private void maybeHideContentPreview() { if (!mAtLeastOneLoaded && mHideParentOnFail) { Log.i(TAG, "Hiding image preview area. Timed out waiting for preview to load" - + " within " + IMAGE_LOAD_TIMEOUT_MILLIS + "ms."); + + " within " + mImageLoadTimeoutMillis + "ms."); collapseParentView(); if (mChooserRowAdapter != null) { mChooserRowAdapter.hideContentPreview(); @@ -369,7 +370,59 @@ public class ChooserActivity extends ResolverActivity { } } - private final Handler mChooserHandler = new Handler() { + private final ChooserHandler mChooserHandler = new ChooserHandler(); + + private class ChooserHandler extends Handler { + private static final int CHOOSER_TARGET_SERVICE_RESULT = 1; + private static final int CHOOSER_TARGET_SERVICE_WATCHDOG_MIN_TIMEOUT = 2; + private static final int CHOOSER_TARGET_SERVICE_WATCHDOG_MAX_TIMEOUT = 3; + private static final int SHORTCUT_MANAGER_SHARE_TARGET_RESULT = 4; + private static final int SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED = 5; + private static final int LIST_VIEW_UPDATE_MESSAGE = 6; + + private static final int WATCHDOG_TIMEOUT_MAX_MILLIS = 10000; + private static final int WATCHDOG_TIMEOUT_MIN_MILLIS = 3000; + + private boolean mMinTimeoutPassed = false; + + private void removeAllMessages() { + removeMessages(LIST_VIEW_UPDATE_MESSAGE); + removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_MIN_TIMEOUT); + removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_MAX_TIMEOUT); + removeMessages(CHOOSER_TARGET_SERVICE_RESULT); + removeMessages(SHORTCUT_MANAGER_SHARE_TARGET_RESULT); + removeMessages(SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED); + } + + private void restartServiceRequestTimer() { + mMinTimeoutPassed = false; + removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_MIN_TIMEOUT); + removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_MAX_TIMEOUT); + + if (DEBUG) { + Log.d(TAG, "queryTargets setting watchdog timer for " + + WATCHDOG_TIMEOUT_MIN_MILLIS + "-" + + WATCHDOG_TIMEOUT_MAX_MILLIS + "ms"); + } + + sendEmptyMessageDelayed(CHOOSER_TARGET_SERVICE_WATCHDOG_MIN_TIMEOUT, + WATCHDOG_TIMEOUT_MIN_MILLIS); + sendEmptyMessageDelayed(CHOOSER_TARGET_SERVICE_WATCHDOG_MAX_TIMEOUT, + WATCHDOG_TIMEOUT_MAX_MILLIS); + } + + private void maybeStopServiceRequestTimer() { + // Set a minimum timeout threshold, to ensure both apis, sharing shortcuts + // and older-style direct share services, have had time to load, otherwise + // just checking mServiceConnections could force us to end prematurely + if (mMinTimeoutPassed && mServiceConnections.isEmpty()) { + logDirectShareTargetReceived( + MetricsEvent.ACTION_DIRECT_SHARE_TARGETS_LOADED_CHOOSER_SERVICE); + sendVoiceChoicesIfNeeded(); + mChooserListAdapter.completeServiceTargetLoading(); + } + } + @Override public void handleMessage(Message msg) { if (mChooserListAdapter == null || isDestroyed()) { @@ -393,23 +446,17 @@ public class ChooserActivity extends ResolverActivity { unbindService(sri.connection); sri.connection.destroy(); mServiceConnections.remove(sri.connection); - if (mServiceConnections.isEmpty()) { - logDirectShareTargetReceived( - MetricsEvent.ACTION_DIRECT_SHARE_TARGETS_LOADED_CHOOSER_SERVICE); - sendVoiceChoicesIfNeeded(); - } + maybeStopServiceRequestTimer(); break; - case CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT: - if (DEBUG) { - Log.d(TAG, "CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT; unbinding services"); - } + case CHOOSER_TARGET_SERVICE_WATCHDOG_MIN_TIMEOUT: + mMinTimeoutPassed = true; + maybeStopServiceRequestTimer(); + break; + case CHOOSER_TARGET_SERVICE_WATCHDOG_MAX_TIMEOUT: unbindRemainingServices(); - logDirectShareTargetReceived( - MetricsEvent.ACTION_DIRECT_SHARE_TARGETS_LOADED_CHOOSER_SERVICE); - sendVoiceChoicesIfNeeded(); - mChooserListAdapter.completeServiceTargetLoading(); + maybeStopServiceRequestTimer(); break; case LIST_VIEW_UPDATE_MESSAGE: @@ -669,6 +716,17 @@ public class ChooserActivity extends ResolverActivity { .getUserInfo(UserHandle.myUserId()).isManagedProfile(); } + @Override + protected PackageMonitor createPackageMonitor() { + return new PackageMonitor() { + @Override + public void onSomePackagesChanged() { + mAdapter.handlePackagesChanged(); + bindProfileView(); + } + }; + } + private void onCopyButtonClicked(View v) { Intent targetIntent = getTargetIntent(); if (targetIntent == null) { @@ -1065,11 +1123,7 @@ public class ChooserActivity extends ResolverActivity { mRefinementResultReceiver = null; } unbindRemainingServices(); - mChooserHandler.removeMessages(LIST_VIEW_UPDATE_MESSAGE); - mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT); - mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_RESULT); - mChooserHandler.removeMessages(SHORTCUT_MANAGER_SHARE_TARGET_RESULT); - mChooserHandler.removeMessages(SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED); + mChooserHandler.removeAllMessages(); if (mPreviewCoord != null) mPreviewCoord.cancelLoads(); @@ -1307,6 +1361,7 @@ public class ChooserActivity extends ResolverActivity { final PackageManager pm = getPackageManager(); ShortcutManager sm = (ShortcutManager) getSystemService(ShortcutManager.class); int targetsToQuery = 0; + for (int i = 0, N = adapter.getDisplayResolveInfoCount(); i < N; i++) { final DisplayResolveInfo dri = adapter.getDisplayResolveInfo(i); if (adapter.getScore(dri) == 0) { @@ -1326,6 +1381,12 @@ public class ChooserActivity extends ResolverActivity { if (serviceName != null) { final ComponentName serviceComponent = new ComponentName( ai.packageName, serviceName); + + if (mServicesRequested.contains(serviceComponent)) { + continue; + } + mServicesRequested.add(serviceComponent); + final Intent serviceIntent = new Intent(ChooserTargetService.SERVICE_INTERFACE) .setComponent(serviceComponent); @@ -1376,16 +1437,7 @@ public class ChooserActivity extends ResolverActivity { } } - if (DEBUG) { - Log.d(TAG, "queryTargets setting watchdog timer for " - + WATCHDOG_TIMEOUT_MILLIS + "ms"); - } - mChooserHandler.sendEmptyMessageDelayed(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT, - WATCHDOG_TIMEOUT_MILLIS); - - if (mServiceConnections.isEmpty()) { - sendVoiceChoicesIfNeeded(); - } + mChooserHandler.restartServiceRequestTimer(); } private IntentFilter getTargetIntentFilter() { @@ -1493,7 +1545,7 @@ public class ChooserActivity extends ResolverActivity { continue; } final Message msg = Message.obtain(); - msg.what = SHORTCUT_MANAGER_SHARE_TARGET_RESULT; + msg.what = ChooserHandler.SHORTCUT_MANAGER_SHARE_TARGET_RESULT; msg.obj = new ServiceResultInfo(driList.get(i), chooserTargets, null); mChooserHandler.sendMessage(msg); resultMessageSent = true; @@ -1506,7 +1558,7 @@ public class ChooserActivity extends ResolverActivity { private void sendShortcutManagerShareTargetResultCompleted() { final Message msg = Message.obtain(); - msg.what = SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED; + msg.what = ChooserHandler.SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED; mChooserHandler.sendMessage(msg); } @@ -1574,6 +1626,7 @@ public class ChooserActivity extends ResolverActivity { unbindService(conn); conn.destroy(); } + mServicesRequested.clear(); mServiceConnections.clear(); } @@ -2198,10 +2251,12 @@ public class ChooserActivity extends ResolverActivity { return; } - int availableWidth = right - left - v.getPaddingLeft() - v.getPaddingRight(); + final int availableWidth = right - left - v.getPaddingLeft() - v.getPaddingRight(); if (mChooserRowAdapter.consumeLayoutRequest() || mChooserRowAdapter.calculateChooserTargetWidth(availableWidth) - || mAdapterView.getAdapter() == null) { + || mAdapterView.getAdapter() == null + || availableWidth != mCurrAvailableWidth) { + mCurrAvailableWidth = availableWidth; mAdapterView.setAdapter(mChooserRowAdapter); getMainThreadHandler().post(() -> { @@ -2282,7 +2337,6 @@ public class ChooserActivity extends ResolverActivity { private ChooserTargetInfo mPlaceHolderTargetInfo = new PlaceHolderTargetInfo(); private final List<ChooserTargetInfo> mServiceTargets = new ArrayList<>(); private final List<TargetInfo> mCallerTargets = new ArrayList<>(); - private boolean mTargetsNeedPruning = false; private final BaseChooserTargetComparator mBaseTargetComparator = new BaseChooserTargetComparator(); @@ -2351,9 +2405,21 @@ public class ChooserActivity extends ResolverActivity { } @Override + public void handlePackagesChanged() { + if (DEBUG) { + Log.d(TAG, "clearing queryTargets on package change"); + } + createPlaceHolders(); + mServicesRequested.clear(); + notifyDataSetChanged(); + + super.handlePackagesChanged(); + } + + @Override public void notifyDataSetChanged() { if (!mListViewDataChanged) { - mChooserHandler.sendEmptyMessageDelayed(LIST_VIEW_UPDATE_MESSAGE, + mChooserHandler.sendEmptyMessageDelayed(ChooserHandler.LIST_VIEW_UPDATE_MESSAGE, LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS); mListViewDataChanged = true; } @@ -2368,6 +2434,7 @@ public class ChooserActivity extends ResolverActivity { private void createPlaceHolders() { + mNumShortcutResults = 0; mServiceTargets.clear(); for (int i = 0; i < MAX_SERVICE_TARGETS; i++) { mServiceTargets.add(mPlaceHolderTargetInfo); @@ -2410,16 +2477,6 @@ public class ChooserActivity extends ResolverActivity { return; } - if (mServiceTargets != null) { - if (getDisplayResolveInfoCount() == 0) { - // b/109676071: When packages change, onListRebuilt() is called before - // ResolverActivity.mDisplayList is re-populated; pruning now would cause the - // list to disappear briefly, so instead we detect this case (the - // set of targets suddenly dropping to zero) and remember to prune later. - mTargetsNeedPruning = true; - } - } - if (USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS || USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS) { if (DEBUG) { @@ -2476,7 +2533,7 @@ public class ChooserActivity extends ResolverActivity { } public int getServiceTargetCount() { - if (isSendAction(getTargetIntent())) { + if (isSendAction(getTargetIntent()) && !ActivityManager.isLowRamDeviceStatic()) { return Math.min(mServiceTargets.size(), MAX_SERVICE_TARGETS); } @@ -2588,19 +2645,6 @@ public class ChooserActivity extends ResolverActivity { return; } - if (mTargetsNeedPruning) { - // First proper update since we got an onListRebuilt() with (transient) 0 items. - // Clear out the target list and rebuild. - createPlaceHolders(); - mTargetsNeedPruning = false; - - // Add back any app-supplied direct share targets that may have been - // wiped by this clear - if (mCallerChooserTargets != null) { - addServiceResults(null, Lists.newArrayList(mCallerChooserTargets), false); - } - } - final float baseScore = getBaseScore(origTarget, isShortcutResult); Collections.sort(targets, mBaseTargetComparator); @@ -3445,7 +3489,7 @@ public class ChooserActivity extends ResolverActivity { mChooserActivity.filterServiceTargets( mOriginalTarget.getResolveInfo().activityInfo.packageName, targets); final Message msg = Message.obtain(); - msg.what = CHOOSER_TARGET_SERVICE_RESULT; + msg.what = ChooserHandler.CHOOSER_TARGET_SERVICE_RESULT; msg.obj = new ServiceResultInfo(mOriginalTarget, targets, ChooserTargetServiceConnection.this); mChooserActivity.mChooserHandler.sendMessage(msg); diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index 9573ac0899f5..7cc812889e0a 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -146,19 +146,7 @@ public class ResolverActivity extends Activity { /** See {@link #setRetainInOnStop}. */ private boolean mRetainInOnStop; - private final PackageMonitor mPackageMonitor = new PackageMonitor() { - @Override public void onSomePackagesChanged() { - mAdapter.handlePackagesChanged(); - bindProfileView(); - } - - @Override - public boolean onPackageChanged(String packageName, int uid, String[] components) { - // We care about all package changes, not just the whole package itself which is - // default behavior. - return true; - } - }; + private final PackageMonitor mPackageMonitor = createPackageMonitor(); /** * Get the string resource to be used as a label for the link to the resolver activity for an @@ -234,6 +222,23 @@ public class ResolverActivity extends Activity { } } + protected PackageMonitor createPackageMonitor() { + return new PackageMonitor() { + @Override + public void onSomePackagesChanged() { + mAdapter.handlePackagesChanged(); + bindProfileView(); + } + + @Override + public boolean onPackageChanged(String packageName, int uid, String[] components) { + // We care about all package changes, not just the whole package itself which is + // default behavior. + return true; + } + }; + } + private Intent makeMyIntent() { Intent intent = new Intent(getIntent()); intent.setComponent(null); diff --git a/core/java/com/android/internal/colorextraction/ColorExtractor.java b/core/java/com/android/internal/colorextraction/ColorExtractor.java index d9fd3b5bd6d8..b27c11b524e5 100644 --- a/core/java/com/android/internal/colorextraction/ColorExtractor.java +++ b/core/java/com/android/internal/colorextraction/ColorExtractor.java @@ -53,11 +53,13 @@ public class ColorExtractor implements WallpaperManager.OnColorsChangedListener protected WallpaperColors mLockColors; public ColorExtractor(Context context) { - this(context, new Tonal(context), true /* immediately */); + this(context, new Tonal(context), true /* immediately */, + context.getSystemService(WallpaperManager.class)); } @VisibleForTesting - public ColorExtractor(Context context, ExtractionType extractionType, boolean immediately) { + public ColorExtractor(Context context, ExtractionType extractionType, boolean immediately, + WallpaperManager wallpaperManager) { mContext = context; mExtractionType = extractionType; @@ -72,7 +74,6 @@ public class ColorExtractor implements WallpaperManager.OnColorsChangedListener mOnColorsChangedListeners = new ArrayList<>(); - WallpaperManager wallpaperManager = mContext.getSystemService(WallpaperManager.class); if (wallpaperManager == null) { Log.w(TAG, "Can't listen to color changes!"); } else { @@ -110,7 +111,7 @@ public class ColorExtractor implements WallpaperManager.OnColorsChangedListener } } - private void extractWallpaperColors() { + protected void extractWallpaperColors() { GradientColors[] systemColors = mGradientColors.get(WallpaperManager.FLAG_SYSTEM); GradientColors[] lockColors = mGradientColors.get(WallpaperManager.FLAG_LOCK); extractInto(mSystemColors, diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java index 2736c6a7149f..ee81868da25b 100644 --- a/core/java/com/android/internal/os/Zygote.java +++ b/core/java/com/android/internal/os/Zygote.java @@ -519,6 +519,9 @@ public final class Zygote { try { sessionSocket = usapPoolSocket.accept(); + // Block SIGTERM so we won't be killed if the Zygote flushes the USAP pool. + blockSigTerm(); + BufferedReader usapReader = new BufferedReader(new InputStreamReader(sessionSocket.getInputStream())); usapOutputStream = @@ -537,87 +540,116 @@ public final class Zygote { } else { Log.e("USAP", "Truncated command received."); IoUtils.closeQuietly(sessionSocket); + + // Re-enable SIGTERM so the USAP can be flushed from the pool if necessary. + unblockSigTerm(); } } catch (Exception ex) { Log.e("USAP", ex.getMessage()); IoUtils.closeQuietly(sessionSocket); + + // Re-enable SIGTERM so the USAP can be flushed from the pool if necessary. + unblockSigTerm(); } } - applyUidSecurityPolicy(args, peerCredentials); - applyDebuggerSystemProperty(args); + try { + // SIGTERM is blocked on loop exit. This prevents a USAP that is specializing from + // being killed during a pool flush. - int[][] rlimits = null; + applyUidSecurityPolicy(args, peerCredentials); + applyDebuggerSystemProperty(args); - if (args.mRLimits != null) { - rlimits = args.mRLimits.toArray(INT_ARRAY_2D); - } + int[][] rlimits = null; - // This must happen before the SELinux policy for this process is - // changed when specializing. - try { - // Used by ZygoteProcess.zygoteSendArgsAndGetResult to fill in a - // Process.ProcessStartResult object. - usapOutputStream.writeInt(pid); - } catch (IOException ioEx) { - Log.e("USAP", "Failed to write response to session socket: " + ioEx.getMessage()); - System.exit(-1); - } finally { - IoUtils.closeQuietly(sessionSocket); + if (args.mRLimits != null) { + rlimits = args.mRLimits.toArray(INT_ARRAY_2D); + } + // This must happen before the SELinux policy for this process is + // changed when specializing. try { - // This socket is closed using Os.close due to an issue with the implementation of - // LocalSocketImp.close. Because the raw FD is created by init and then loaded from - // an environment variable (as opposed to being created by the LocalSocketImpl - // itself) the current implementation will not actually close the underlying FD. - // - // See b/130309968 for discussion of this issue. - Os.close(usapPoolSocket.getFileDescriptor()); - } catch (ErrnoException ex) { - Log.e("USAP", "Failed to close USAP pool socket: " + ex.getMessage()); + // Used by ZygoteProcess.zygoteSendArgsAndGetResult to fill in a + // Process.ProcessStartResult object. + usapOutputStream.writeInt(pid); + } catch (IOException ioEx) { + Log.e("USAP", "Failed to write response to session socket: " + + ioEx.getMessage()); + throw new RuntimeException(ioEx); + } finally { + IoUtils.closeQuietly(sessionSocket); + + try { + // This socket is closed using Os.close due to an issue with the implementation + // of LocalSocketImp.close(). Because the raw FD is created by init and then + // loaded from an environment variable (as opposed to being created by the + // LocalSocketImpl itself) the current implementation will not actually close + // the underlying FD. + // + // See b/130309968 for discussion of this issue. + Os.close(usapPoolSocket.getFileDescriptor()); + } catch (ErrnoException ex) { + Log.e("USAP", "Failed to close USAP pool socket"); + throw new RuntimeException(ex); + } } - } - try { - ByteArrayOutputStream buffer = - new ByteArrayOutputStream(Zygote.USAP_MANAGEMENT_MESSAGE_BYTES); - DataOutputStream outputStream = new DataOutputStream(buffer); - - // This is written as a long so that the USAP reporting pipe and USAP pool event FD - // handlers in ZygoteServer.runSelectLoop can be unified. These two cases should both - // send/receive 8 bytes. - outputStream.writeLong(pid); - outputStream.flush(); - - Os.write(writePipe, buffer.toByteArray(), 0, buffer.size()); - } catch (Exception ex) { - Log.e("USAP", - String.format("Failed to write PID (%d) to pipe (%d): %s", - pid, writePipe.getInt$(), ex.getMessage())); - System.exit(-1); - } finally { - IoUtils.closeQuietly(writePipe); - } + try { + ByteArrayOutputStream buffer = + new ByteArrayOutputStream(Zygote.USAP_MANAGEMENT_MESSAGE_BYTES); + DataOutputStream outputStream = new DataOutputStream(buffer); + + // This is written as a long so that the USAP reporting pipe and USAP pool event FD + // handlers in ZygoteServer.runSelectLoop can be unified. These two cases should + // both send/receive 8 bytes. + outputStream.writeLong(pid); + outputStream.flush(); + + Os.write(writePipe, buffer.toByteArray(), 0, buffer.size()); + } catch (Exception ex) { + Log.e("USAP", + String.format("Failed to write PID (%d) to pipe (%d): %s", + pid, writePipe.getInt$(), ex.getMessage())); + throw new RuntimeException(ex); + } finally { + IoUtils.closeQuietly(writePipe); + } + + specializeAppProcess(args.mUid, args.mGid, args.mGids, + args.mRuntimeFlags, rlimits, args.mMountExternal, + args.mSeInfo, args.mNiceName, args.mStartChildZygote, + args.mInstructionSet, args.mAppDataDir); - specializeAppProcess(args.mUid, args.mGid, args.mGids, - args.mRuntimeFlags, rlimits, args.mMountExternal, - args.mSeInfo, args.mNiceName, args.mStartChildZygote, - args.mInstructionSet, args.mAppDataDir); + disableExecuteOnly(args.mTargetSdkVersion); - disableExecuteOnly(args.mTargetSdkVersion); + if (args.mNiceName != null) { + Process.setArgV0(args.mNiceName); + } + + // End of the postFork event. + Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); - if (args.mNiceName != null) { - Process.setArgV0(args.mNiceName); + return ZygoteInit.zygoteInit(args.mTargetSdkVersion, + args.mRemainingArgs, + null /* classLoader */); + } finally { + // Unblock SIGTERM to restore the process to default behavior. + unblockSigTerm(); } + } - // End of the postFork event. - Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); + private static void blockSigTerm() { + nativeBlockSigTerm(); + } + + private static native void nativeBlockSigTerm(); - return ZygoteInit.zygoteInit(args.mTargetSdkVersion, - args.mRemainingArgs, - null /* classLoader */); + private static void unblockSigTerm() { + nativeUnblockSigTerm(); } + private static native void nativeUnblockSigTerm(); + private static final String USAP_ERROR_PREFIX = "Invalid command to USAP: "; /** diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java index 785256eb6351..e556dd4d8243 100644 --- a/core/java/com/android/internal/os/ZygoteConnection.java +++ b/core/java/com/android/internal/os/ZygoteConnection.java @@ -338,6 +338,7 @@ class ZygoteConnection { Runnable stateChangeCode) { try { if (zygoteServer.isUsapPoolEnabled()) { + Log.i(TAG, "Emptying USAP Pool due to state change."); Zygote.emptyUsapPool(); } @@ -351,6 +352,8 @@ class ZygoteConnection { if (fpResult != null) { zygoteServer.setForkChild(); return fpResult; + } else { + Log.i(TAG, "Finished refilling USAP Pool after state change."); } } diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index 585a27978c4f..2941a813fecb 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -1004,6 +1004,10 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind public void onWindowSystemUiVisibilityChanged(int visible) { updateColorViews(null /* insets */, true /* animate */); updateDecorCaptionStatus(getResources().getConfiguration()); + + if (mStatusGuard != null && mStatusGuard.getVisibility() == VISIBLE) { + updateStatusGuardColor(); + } } @Override @@ -1462,28 +1466,45 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } final Rect rect = mTempRect; - // If the parent doesn't consume the insets, manually - // apply the default system window insets. - mWindow.mContentParent.computeSystemWindowInsets(insets, rect); - final int newMargin = rect.top == 0 ? insets.getSystemWindowInsetTop() : 0; - if (mlp.topMargin != newMargin) { + // Apply the insets that have not been applied by the contentParent yet. + WindowInsets innerInsets = + mWindow.mContentParent.computeSystemWindowInsets(insets, rect); + int newTopMargin = innerInsets.getSystemWindowInsetTop(); + int newLeftMargin = innerInsets.getSystemWindowInsetLeft(); + int newRightMargin = innerInsets.getSystemWindowInsetRight(); + + // Must use root window insets for the guard, because the color views consume + // the navigation bar inset if the window does not request LAYOUT_HIDE_NAV - but + // the status guard is attached at the root. + WindowInsets rootInsets = getRootWindowInsets(); + int newGuardLeftMargin = rootInsets.getSystemWindowInsetLeft(); + int newGuardRightMargin = rootInsets.getSystemWindowInsetRight(); + + if (mlp.topMargin != newTopMargin || mlp.leftMargin != newLeftMargin + || mlp.rightMargin != newRightMargin) { mlpChanged = true; - mlp.topMargin = insets.getSystemWindowInsetTop(); - - if (mStatusGuard == null) { - mStatusGuard = new View(mContext); - mStatusGuard.setBackgroundColor(mContext.getColor( - R.color.decor_view_status_guard)); - addView(mStatusGuard, indexOfChild(mStatusColorViewState.view), - new LayoutParams(LayoutParams.MATCH_PARENT, - mlp.topMargin, Gravity.START | Gravity.TOP)); - } else { - final LayoutParams lp = (LayoutParams) - mStatusGuard.getLayoutParams(); - if (lp.height != mlp.topMargin) { - lp.height = mlp.topMargin; - mStatusGuard.setLayoutParams(lp); - } + mlp.topMargin = newTopMargin; + mlp.leftMargin = newLeftMargin; + mlp.rightMargin = newRightMargin; + } + + if (newTopMargin > 0 && mStatusGuard == null) { + mStatusGuard = new View(mContext); + mStatusGuard.setVisibility(GONE); + final LayoutParams lp = new LayoutParams(MATCH_PARENT, + mlp.topMargin, Gravity.LEFT | Gravity.TOP); + lp.leftMargin = newGuardLeftMargin; + lp.rightMargin = newGuardRightMargin; + addView(mStatusGuard, indexOfChild(mStatusColorViewState.view), lp); + } else if (mStatusGuard != null) { + final LayoutParams lp = (LayoutParams) + mStatusGuard.getLayoutParams(); + if (lp.height != mlp.topMargin || lp.leftMargin != newGuardLeftMargin + || lp.rightMargin != newGuardRightMargin) { + lp.height = mlp.topMargin; + lp.leftMargin = newGuardLeftMargin; + lp.rightMargin = newGuardRightMargin; + mStatusGuard.setLayoutParams(lp); } } @@ -1491,6 +1512,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind // always show the status guard above it if we have one. showStatusGuard = mStatusGuard != null; + if (showStatusGuard && mStatusGuard.getVisibility() != VISIBLE) { + // If it wasn't previously shown, the color may be stale + updateStatusGuardColor(); + } + // We only need to consume the insets if the action // mode is overlaid on the app content (e.g. it's // sitting in a FrameLayout, see @@ -1502,7 +1528,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } } else { // reset top margin - if (mlp.topMargin != 0) { + if (mlp.topMargin != 0 || mlp.leftMargin != 0 || mlp.rightMargin != 0) { mlpChanged = true; mlp.topMargin = 0; } @@ -1513,11 +1539,19 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } } if (mStatusGuard != null) { - mStatusGuard.setVisibility(showStatusGuard ? View.VISIBLE : View.GONE); + mStatusGuard.setVisibility(showStatusGuard ? VISIBLE : GONE); } return insets; } + private void updateStatusGuardColor() { + boolean lightStatusBar = + (getWindowSystemUiVisibility() & SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0; + mStatusGuard.setBackgroundColor(lightStatusBar + ? mContext.getColor(R.color.decor_view_status_guard_light) + : mContext.getColor(R.color.decor_view_status_guard)); + } + /** * Overrides the view outline when the activity enters picture-in-picture to ensure that it has * an opaque shadow even if the window background is completely transparent. This only applies @@ -2594,6 +2628,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } lastActionModeView.killMode(); mFadeAnim = null; + requestApplyInsets(); } } diff --git a/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java b/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java index 6be626a5134a..1bbd87cd3e59 100755 --- a/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java +++ b/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java @@ -24,6 +24,7 @@ import android.util.Pools; import com.android.internal.util.ArrayUtils; import com.android.internal.util.BitUtils; +import com.android.internal.util.Preconditions; import com.android.internal.util.function.HeptConsumer; import com.android.internal.util.function.HeptFunction; import com.android.internal.util.function.HeptPredicate; @@ -47,6 +48,7 @@ import com.android.internal.util.function.TriFunction; import com.android.internal.util.function.TriPredicate; import java.util.Arrays; +import java.util.Objects; import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.BiPredicate; @@ -432,13 +434,15 @@ final class PooledLambdaImpl<R> extends OmniFunction<Object, if (isConstSupplier()) { sb.append(getFuncTypeAsString()).append("(").append(doInvoke()).append(")"); } else { - if (mFunc instanceof PooledLambdaImpl) { - sb.append(mFunc); + Object func = mFunc; + if (func instanceof PooledLambdaImpl) { + sb.append(func); } else { - sb.append(getFuncTypeAsString()).append("@").append(hashCodeHex(mFunc)); + sb.append(getFuncTypeAsString()).append("@").append(hashCodeHex(func)); } sb.append("("); - sb.append(commaSeparateFirstN(mArgs, LambdaType.decodeArgCount(getFlags(MASK_FUNC_TYPE)))); + sb.append(commaSeparateFirstN(mArgs, + LambdaType.decodeArgCount(getFlags(MASK_FUNC_TYPE)))); sb.append(")"); } return sb.toString(); @@ -450,7 +454,7 @@ final class PooledLambdaImpl<R> extends OmniFunction<Object, } private static String hashCodeHex(Object o) { - return Integer.toHexString(o.hashCode()); + return Integer.toHexString(Objects.hashCode(o)); } private String getFuncTypeAsString() { @@ -490,7 +494,7 @@ final class PooledLambdaImpl<R> extends OmniFunction<Object, + ", i = " + i + ")"); } - r.mFunc = func; + r.mFunc = Preconditions.checkNotNull(func); r.setFlags(MASK_FUNC_TYPE, LambdaType.encode(fNumArgs, fReturnType)); r.setFlags(MASK_EXPOSED_AS, LambdaType.encode(numPlaceholders, fReturnType)); if (ArrayUtils.size(r.mArgs) < fNumArgs) r.mArgs = new Object[fNumArgs]; diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp index fc2b7f66e77a..686a91901b5f 100644 --- a/core/jni/android_media_AudioSystem.cpp +++ b/core/jni/android_media_AudioSystem.cpp @@ -2242,6 +2242,12 @@ android_media_AudioSystem_setAllowedCapturePolicy(JNIEnv *env, jobject thiz, jin return AudioSystem::setAllowedCapturePolicy(uid, flags); } +static jint +android_media_AudioSystem_setRttEnabled(JNIEnv *env, jobject thiz, jboolean enabled) +{ + return (jint) check_AudioSystem_Command(AudioSystem::setRttEnabled(enabled)); +} + // ---------------------------------------------------------------------------- static const JNINativeMethod gMethods[] = { @@ -2319,6 +2325,7 @@ static const JNINativeMethod gMethods[] = { {"getHwOffloadEncodingFormatsSupportedForA2DP", "(Ljava/util/ArrayList;)I", (void*)android_media_AudioSystem_getHwOffloadEncodingFormatsSupportedForA2DP}, {"setAllowedCapturePolicy", "(II)I", (void *)android_media_AudioSystem_setAllowedCapturePolicy}, + {"setRttEnabled", "(Z)I", (void *)android_media_AudioSystem_setRttEnabled}, }; static const JNINativeMethod gEventHandlerMethods[] = { diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp index 842679ec7d22..14dbabb1ce02 100644 --- a/core/jni/android_os_Debug.cpp +++ b/core/jni/android_os_Debug.cpp @@ -713,16 +713,20 @@ static bool dumpTraces(JNIEnv* env, jint pid, jstring fileName, jint timeoutSecs O_CREAT | O_WRONLY | O_NOFOLLOW | O_CLOEXEC | O_APPEND, 0666)); if (fd < 0) { - fprintf(stderr, "Can't open %s: %s\n", fileNameChars.c_str(), strerror(errno)); + PLOG(ERROR) << "Can't open " << fileNameChars.c_str(); return false; } - return (dump_backtrace_to_file_timeout(pid, dumpType, timeoutSecs, fd) == 0); + int res = dump_backtrace_to_file_timeout(pid, dumpType, timeoutSecs, fd); + if (fdatasync(fd.get()) != 0) { + PLOG(ERROR) << "Failed flushing trace."; + } + return res == 0; } static jboolean android_os_Debug_dumpJavaBacktraceToFileTimeout(JNIEnv* env, jobject clazz, jint pid, jstring fileName, jint timeoutSecs) { - const bool ret = dumpTraces(env, pid, fileName, timeoutSecs, kDebuggerdJavaBacktrace); + const bool ret = dumpTraces(env, pid, fileName, timeoutSecs, kDebuggerdJavaBacktrace); return ret ? JNI_TRUE : JNI_FALSE; } diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp index 8ff16912e932..4783a257755f 100644 --- a/core/jni/com_android_internal_os_Zygote.cpp +++ b/core/jni/com_android_internal_os_Zygote.cpp @@ -198,7 +198,7 @@ class UsapTableEntry { * PIDs don't match nothing will happen. * * @param pid The ID of the process who's entry we want to clear. - * @return True if the entry was cleared; false otherwise + * @return True if the entry was cleared by this call; false otherwise */ bool ClearForPID(int32_t pid) { EntryStorage storage = mStorage.load(); @@ -212,14 +212,16 @@ class UsapTableEntry { * 3) It fails and the new value isn't INVALID_ENTRY_VALUE, in which * case the entry has already been cleared and re-used. * - * In all three cases the goal of the caller has been met and we can - * return true. + * In all three cases the goal of the caller has been met, but only in + * the first case do we need to decrement the pool count. */ if (mStorage.compare_exchange_strong(storage, INVALID_ENTRY_VALUE)) { close(storage.read_pipe_fd); + return true; + } else { + return false; } - return true; } else { return false; } @@ -331,11 +333,24 @@ static void SigChldHandler(int /*signal_number*/) { if (WIFEXITED(status)) { async_safe_format_log(ANDROID_LOG_INFO, LOG_TAG, "Process %d exited cleanly (%d)", pid, WEXITSTATUS(status)); + + // Check to see if the PID is in the USAP pool and remove it if it is. + if (RemoveUsapTableEntry(pid)) { + ++usaps_removed; + } } else if (WIFSIGNALED(status)) { async_safe_format_log(ANDROID_LOG_INFO, LOG_TAG, "Process %d exited due to signal %d (%s)%s", pid, WTERMSIG(status), strsignal(WTERMSIG(status)), WCOREDUMP(status) ? "; core dumped" : ""); + + // If the process exited due to a signal other than SIGTERM, check to see + // if the PID is in the USAP pool and remove it if it is. If the process + // was closed by the Zygote using SIGTERM then the USAP pool entry will + // have already been removed (see nativeEmptyUsapPool()). + if (WTERMSIG(status) != SIGTERM && RemoveUsapTableEntry(pid)) { + ++usaps_removed; + } } // If the just-crashed process is the system_server, bring down zygote @@ -346,11 +361,6 @@ static void SigChldHandler(int /*signal_number*/) { "Exit zygote because system server (pid %d) has terminated", pid); kill(getpid(), SIGKILL); } - - // Check to see if the PID is in the USAP pool and remove it if it is. - if (RemoveUsapTableEntry(pid)) { - ++usaps_removed; - } } // Note that we shouldn't consider ECHILD an error because @@ -1648,7 +1658,13 @@ static void com_android_internal_os_Zygote_nativeEmptyUsapPool(JNIEnv* env, jcla auto entry_storage = entry.GetValues(); if (entry_storage.has_value()) { - kill(entry_storage.value().pid, SIGKILL); + kill(entry_storage.value().pid, SIGTERM); + + // Clean up the USAP table entry here. This avoids a potential race + // where a newly created USAP might not be able to find a valid table + // entry if signal handler (which would normally do the cleanup) doesn't + // run between now and when the new process is created. + close(entry_storage.value().read_pipe_fd); // Avoid a second atomic load by invalidating instead of clearing. @@ -1678,6 +1694,16 @@ static jboolean com_android_internal_os_Zygote_nativeDisableExecuteOnly(JNIEnv* return dl_iterate_phdr(disable_execute_only, nullptr) == 0; } +static void com_android_internal_os_Zygote_nativeBlockSigTerm(JNIEnv* env, jclass) { + auto fail_fn = std::bind(ZygoteFailure, env, "usap", nullptr, _1); + BlockSignal(SIGTERM, fail_fn); +} + +static void com_android_internal_os_Zygote_nativeUnblockSigTerm(JNIEnv* env, jclass) { + auto fail_fn = std::bind(ZygoteFailure, env, "usap", nullptr, _1); + UnblockSignal(SIGTERM, fail_fn); +} + static const JNINativeMethod gMethods[] = { { "nativeForkAndSpecialize", "(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;)I", @@ -1708,7 +1734,11 @@ static const JNINativeMethod gMethods[] = { { "nativeEmptyUsapPool", "()V", (void *) com_android_internal_os_Zygote_nativeEmptyUsapPool }, { "nativeDisableExecuteOnly", "()Z", - (void *) com_android_internal_os_Zygote_nativeDisableExecuteOnly } + (void *) com_android_internal_os_Zygote_nativeDisableExecuteOnly }, + { "nativeBlockSigTerm", "()V", + (void* ) com_android_internal_os_Zygote_nativeBlockSigTerm }, + { "nativeUnblockSigTerm", "()V", + (void* ) com_android_internal_os_Zygote_nativeUnblockSigTerm } }; int register_com_android_internal_os_Zygote(JNIEnv* env) { diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml index 3b282650d59e..1dcd389d9d8f 100644 --- a/core/res/res/values/colors.xml +++ b/core/res/res/values/colors.xml @@ -79,6 +79,7 @@ <drawable name="input_method_fullscreen_background">#fff9f9f9</drawable> <color name="decor_view_status_guard">#ff000000</color> + <color name="decor_view_status_guard_light">#ffffffff</color> <!-- For date picker widget --> <drawable name="selected_day_background">#ff0092f4</drawable> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 641f223c7a8f..9d75654d2a1b 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1962,6 +1962,7 @@ <java-symbol type="bool" name="show_ongoing_ime_switcher" /> <java-symbol type="color" name="config_defaultNotificationColor" /> <java-symbol type="color" name="decor_view_status_guard" /> + <java-symbol type="color" name="decor_view_status_guard_light" /> <java-symbol type="drawable" name="ic_notification_ime_default" /> <java-symbol type="drawable" name="ic_menu_refresh" /> <java-symbol type="drawable" name="ic_settings" /> @@ -3803,7 +3804,9 @@ <java-symbol type="string" name="chooser_all_apps_button_label" /> <java-symbol type="anim" name="resolver_launch_anim" /> <java-symbol type="style" name="Animation.DeviceDefault.Activity.Resolver" /> - + + <java-symbol type="color" name="decor_view_status_guard_light" /> + <java-symbol type="string" name="config_defaultSupervisionProfileOwnerComponent" /> <java-symbol type="bool" name="config_inflateSignalStrength" /> </resources> diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml index a640122f2b32..c023e85394f2 100644 --- a/data/etc/privapp-permissions-platform.xml +++ b/data/etc/privapp-permissions-platform.xml @@ -119,6 +119,8 @@ applications that come with the platform <permission name="android.permission.APPROVE_INCIDENT_REPORTS"/> <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE" /> <permission name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME" /> + <!-- This permission will be removed in R. --> + <permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND"/> </privapp-permissions> <privapp-permissions package="com.android.phone"> diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java index fde0e640d92c..53bc65d711b0 100644 --- a/media/java/android/media/AudioSystem.java +++ b/media/java/android/media/AudioSystem.java @@ -24,7 +24,6 @@ import android.content.Context; import android.content.pm.PackageManager; import android.media.audiofx.AudioEffect; import android.media.audiopolicy.AudioMix; -import android.os.Build; import android.util.Log; import java.util.ArrayList; @@ -981,6 +980,8 @@ public class AudioSystem public static native boolean getMasterMono(); /** @hide enables or disables the master mono mode. */ public static native int setMasterMono(boolean mono); + /** @hide enables or disables the RTT mode. */ + public static native int setRttEnabled(boolean enabled); /** @hide returns master balance value in range -1.f -> 1.f, where 0.f is dead center. */ @TestApi diff --git a/packages/InputDevices/res/values-hy/strings.xml b/packages/InputDevices/res/values-hy/strings.xml index c7523e391807..64ddf7ac1b20 100644 --- a/packages/InputDevices/res/values-hy/strings.xml +++ b/packages/InputDevices/res/values-hy/strings.xml @@ -40,7 +40,7 @@ <string name="keyboard_layout_hebrew" msgid="7241473985890173812">"Եբրայերեն"</string> <string name="keyboard_layout_lithuanian" msgid="6943110873053106534">"Լիտվերեն"</string> <string name="keyboard_layout_spanish_latin" msgid="5690539836069535697">"Իսպաներեն (Լատինական)"</string> - <string name="keyboard_layout_latvian" msgid="4405417142306250595">"լատիշերեն"</string> + <string name="keyboard_layout_latvian" msgid="4405417142306250595">"լատվիերեն"</string> <string name="keyboard_layout_persian" msgid="3920643161015888527">"պարսկերեն"</string> <string name="keyboard_layout_azerbaijani" msgid="7315895417176467567">"ադրբեջաներեն"</string> <string name="keyboard_layout_polish" msgid="1121588624094925325">"լեհերեն"</string> diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/InstallInstalling.java b/packages/PackageInstaller/src/com/android/packageinstaller/InstallInstalling.java index 93f24f7881a6..4f85eea13dca 100755 --- a/packages/PackageInstaller/src/com/android/packageinstaller/InstallInstalling.java +++ b/packages/PackageInstaller/src/com/android/packageinstaller/InstallInstalling.java @@ -130,18 +130,15 @@ public class InstallInstalling extends AlertActivity { } else { PackageInstaller.SessionParams params = new PackageInstaller.SessionParams( PackageInstaller.SessionParams.MODE_FULL_INSTALL); - params.installFlags = PackageManager.INSTALL_FULL_APP; - params.referrerUri = getIntent().getParcelableExtra(Intent.EXTRA_REFERRER); - params.originatingUri = getIntent() - .getParcelableExtra(Intent.EXTRA_ORIGINATING_URI); - params.originatingUid = getIntent().getIntExtra(Intent.EXTRA_ORIGINATING_UID, - UID_UNKNOWN); - params.installerPackageName = - getIntent().getStringExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME); - params.installReason = PackageManager.INSTALL_REASON_USER; - - // Whitelist all restricted permissions. - params.setWhitelistedRestrictedPermissions(null /*permissions*/); + params.setInstallAsInstantApp(false); + params.setReferrerUri(getIntent().getParcelableExtra(Intent.EXTRA_REFERRER)); + params.setOriginatingUri(getIntent() + .getParcelableExtra(Intent.EXTRA_ORIGINATING_URI)); + params.setOriginatingUid(getIntent().getIntExtra(Intent.EXTRA_ORIGINATING_UID, + UID_UNKNOWN)); + params.setInstallerPackageName(getIntent().getStringExtra( + Intent.EXTRA_INSTALLER_PACKAGE_NAME)); + params.setInstallReason(PackageManager.INSTALL_REASON_USER); File file = new File(mPackageURI.getPath()); try { diff --git a/packages/SettingsLib/res/values-de/strings.xml b/packages/SettingsLib/res/values-de/strings.xml index 0347f2d5a3a0..7c03afb30379 100644 --- a/packages/SettingsLib/res/values-de/strings.xml +++ b/packages/SettingsLib/res/values-de/strings.xml @@ -381,12 +381,12 @@ <string name="power_remaining_settings_home_page" msgid="4845022416859002011">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string> <string name="power_remaining_duration_only" msgid="6123167166221295462">"Noch etwa <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string> <string name="power_discharging_duration" msgid="8848256785736335185">"Noch etwa <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string> - <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Noch etwa <xliff:g id="TIME_REMAINING">%1$s</xliff:g>, basierend auf deiner Nutzung"</string> - <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Noch etwa <xliff:g id="TIME_REMAINING">%1$s</xliff:g>, basierend auf deiner Nutzung (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string> + <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Bei deinem Nutzungsmuster hast du noch ca. <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string> + <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Bei deinem Nutzungsmuster hast du noch ca. <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string> <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) --> <skip /> - <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Sollte basierend auf deiner Nutzung etwa bis <xliff:g id="TIME">%1$s</xliff:g> reichen (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string> - <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Sollte basierend auf deiner Nutzung etwa bis <xliff:g id="TIME">%1$s</xliff:g> reichen"</string> + <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Bei deinem Nutzungsmuster dürfte der Akku bis ca. <xliff:g id="TIME">%1$s</xliff:g> reichen (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string> + <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Bei deinem Nutzungsmuster dürfte der Akku bis ca. <xliff:g id="TIME">%1$s</xliff:g> reichen"</string> <string name="power_discharge_by" msgid="6453537733650125582">"Sollte etwa bis <xliff:g id="TIME">%1$s</xliff:g> reichen (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string> <string name="power_discharge_by_only" msgid="107616694963545745">"Sollte etwa bis <xliff:g id="TIME">%1$s</xliff:g> reichen"</string> <string name="power_discharge_by_only_short" msgid="1372817269546888804">"Bis <xliff:g id="TIME">%1$s</xliff:g>"</string> diff --git a/packages/SettingsLib/res/values-ru/strings.xml b/packages/SettingsLib/res/values-ru/strings.xml index db43c7562dbc..0401e7fd2d02 100644 --- a/packages/SettingsLib/res/values-ru/strings.xml +++ b/packages/SettingsLib/res/values-ru/strings.xml @@ -60,7 +60,7 @@ <string name="speed_label_medium" msgid="3175763313268941953">"Средняя"</string> <string name="speed_label_fast" msgid="7715732164050975057">"Быстрая"</string> <string name="speed_label_very_fast" msgid="2265363430784523409">"Очень быстрая"</string> - <string name="preference_summary_default_combination" msgid="8532964268242666060">"<xliff:g id="DESCRIPTION">%2$s</xliff:g>: <xliff:g id="STATE">%1$s</xliff:g>"</string> + <string name="preference_summary_default_combination" msgid="8532964268242666060">"<xliff:g id="STATE">%1$s</xliff:g> / <xliff:g id="DESCRIPTION">%2$s</xliff:g>"</string> <string name="bluetooth_disconnected" msgid="6557104142667339895">"Нет подключения"</string> <string name="bluetooth_disconnecting" msgid="8913264760027764974">"Отключение..."</string> <string name="bluetooth_connecting" msgid="8555009514614320497">"Подключение..."</string> diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java index e28c612453b4..ab174f47ab20 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java +++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java @@ -55,6 +55,7 @@ import android.util.ArraySet; import android.util.Log; import android.util.Pair; +import androidx.annotation.GuardedBy; import androidx.annotation.NonNull; import com.android.internal.annotations.VisibleForTesting; @@ -108,6 +109,14 @@ public class AccessPoint implements Comparable<AccessPoint> { /** The key which identifies this AccessPoint grouping. */ private String mKey; + /** + * Synchronization lock for managing concurrency between main and worker threads. + * + * <p>This lock should be held for all modifications to {@link #mScanResults} and + * {@link #mExtraScanResults}. + */ + private final Object mLock = new Object(); + @IntDef({Speed.NONE, Speed.SLOW, Speed.MODERATE, Speed.FAST, Speed.VERY_FAST}) @Retention(RetentionPolicy.SOURCE) public @interface Speed { @@ -134,12 +143,14 @@ public class AccessPoint implements Comparable<AccessPoint> { } /** The underlying set of scan results comprising this AccessPoint. */ + @GuardedBy("mLock") private final ArraySet<ScanResult> mScanResults = new ArraySet<>(); /** * Extra set of unused scan results corresponding to this AccessPoint for verbose logging * purposes, such as a set of Passpoint roaming scan results when home scans are available. */ + @GuardedBy("mLock") private final ArraySet<ScanResult> mExtraScanResults = new ArraySet<>(); /** @@ -489,8 +500,10 @@ public class AccessPoint implements Comparable<AccessPoint> { if (isVerboseLoggingEnabled()) { builder.append(",rssi=").append(mRssi); - builder.append(",scan cache size=").append(mScanResults.size() - + mExtraScanResults.size()); + synchronized (mLock) { + builder.append(",scan cache size=").append(mScanResults.size() + + mExtraScanResults.size()); + } } return builder.append(')').toString(); @@ -532,18 +545,20 @@ public class AccessPoint implements Comparable<AccessPoint> { */ private boolean updateScores(WifiNetworkScoreCache scoreCache, long maxScoreCacheAgeMillis) { long nowMillis = SystemClock.elapsedRealtime(); - for (ScanResult result : mScanResults) { - ScoredNetwork score = scoreCache.getScoredNetwork(result); - if (score == null) { - continue; - } - TimestampedScoredNetwork timedScore = mScoredNetworkCache.get(result.BSSID); - if (timedScore == null) { - mScoredNetworkCache.put( - result.BSSID, new TimestampedScoredNetwork(score, nowMillis)); - } else { - // Update data since the has been seen in the score cache - timedScore.update(score, nowMillis); + synchronized (mLock) { + for (ScanResult result : mScanResults) { + ScoredNetwork score = scoreCache.getScoredNetwork(result); + if (score == null) { + continue; + } + TimestampedScoredNetwork timedScore = mScoredNetworkCache.get(result.BSSID); + if (timedScore == null) { + mScoredNetworkCache.put( + result.BSSID, new TimestampedScoredNetwork(score, nowMillis)); + } else { + // Update data since the has been seen in the score cache + timedScore.update(score, nowMillis); + } } } @@ -619,12 +634,14 @@ public class AccessPoint implements Comparable<AccessPoint> { mIsScoredNetworkMetered |= score.meteredHint; } } else { - for (ScanResult result : mScanResults) { - ScoredNetwork score = scoreCache.getScoredNetwork(result); - if (score == null) { - continue; + synchronized (mLock) { + for (ScanResult result : mScanResults) { + ScoredNetwork score = scoreCache.getScoredNetwork(result); + if (score == null) { + continue; + } + mIsScoredNetworkMetered |= score.meteredHint; } - mIsScoredNetworkMetered |= score.meteredHint; } } return oldMetering == mIsScoredNetworkMetered; @@ -741,8 +758,10 @@ public class AccessPoint implements Comparable<AccessPoint> { */ public Set<ScanResult> getScanResults() { Set<ScanResult> allScans = new ArraySet<>(); - allScans.addAll(mScanResults); - allScans.addAll(mExtraScanResults); + synchronized (mLock) { + allScans.addAll(mScanResults); + allScans.addAll(mExtraScanResults); + } return allScans; } @@ -766,10 +785,12 @@ public class AccessPoint implements Comparable<AccessPoint> { ScanResult bestResult = null; int bestRssi = UNREACHABLE_RSSI; - for (ScanResult result : mScanResults) { - if (result.level > bestRssi) { - bestRssi = result.level; - bestResult = result; + synchronized (mLock) { + for (ScanResult result : mScanResults) { + if (result.level > bestRssi) { + bestRssi = result.level; + bestResult = result; + } } } @@ -999,8 +1020,7 @@ public class AccessPoint implements Comparable<AccessPoint> { summary.append(mContext.getString(R.string.tap_to_sign_up)); } } else if (isActive()) { - if (mConfig != null && getDetailedState() == DetailedState.CONNECTED - && mIsCarrierAp) { + if (getDetailedState() == DetailedState.CONNECTED && mIsCarrierAp) { // This is the active connection on a carrier AP summary.append(String.format(mContext.getString(R.string.connected_via_carrier), mCarrierName)); @@ -1211,9 +1231,11 @@ public class AccessPoint implements Comparable<AccessPoint> { savedState.putInt(KEY_EAPTYPE, mEapType); if (mConfig != null) savedState.putParcelable(KEY_CONFIG, mConfig); savedState.putParcelable(KEY_WIFIINFO, mInfo); - savedState.putParcelableArray(KEY_SCANRESULTS, - mScanResults.toArray(new Parcelable[mScanResults.size() - + mExtraScanResults.size()])); + synchronized (mLock) { + savedState.putParcelableArray(KEY_SCANRESULTS, + mScanResults.toArray(new Parcelable[mScanResults.size() + + mExtraScanResults.size()])); + } savedState.putParcelableArrayList(KEY_SCOREDNETWORKCACHE, new ArrayList<>(mScoredNetworkCache.values())); if (mNetworkInfo != null) { @@ -1292,8 +1314,10 @@ public class AccessPoint implements Comparable<AccessPoint> { } int oldLevel = getLevel(); - mScanResults.clear(); - mScanResults.addAll(scanResults); + synchronized (mLock) { + mScanResults.clear(); + mScanResults.addAll(scanResults); + } updateBestRssiInfo(); int newLevel = getLevel(); @@ -1324,16 +1348,18 @@ public class AccessPoint implements Comparable<AccessPoint> { void setScanResultsPasspoint( @Nullable Collection<ScanResult> homeScans, @Nullable Collection<ScanResult> roamingScans) { - mExtraScanResults.clear(); - if (!CollectionUtils.isEmpty(homeScans)) { - if (!CollectionUtils.isEmpty(roamingScans)) { - mExtraScanResults.addAll(roamingScans); + synchronized (mLock) { + mExtraScanResults.clear(); + if (!CollectionUtils.isEmpty(homeScans)) { + mIsRoaming = false; + if (!CollectionUtils.isEmpty(roamingScans)) { + mExtraScanResults.addAll(roamingScans); + } + setScanResults(homeScans); + } else if (!CollectionUtils.isEmpty(roamingScans)) { + mIsRoaming = true; + setScanResults(roamingScans); } - mIsRoaming = false; - setScanResults(homeScans); - } else if (!CollectionUtils.isEmpty(roamingScans)) { - mIsRoaming = true; - setScanResults(roamingScans); } } diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java index 79c691cf45e1..a7ccc3a49073 100644 --- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java @@ -323,7 +323,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD mColorExtractor = Dependency.get(SysuiColorExtractor.class); mColorExtractor.addOnColorsChangedListener(this); mUsingDarkText = mColorExtractor.getColors(ColorExtractor.TYPE_DARK, - WallpaperManager.FLAG_SYSTEM, true).supportsDarkText(); + WallpaperManager.FLAG_SYSTEM).supportsDarkText(); setTheme(mUsingDarkText ? R.style.RecentsTheme_Wallpaper_Light : R.style.RecentsTheme_Wallpaper); @@ -394,8 +394,6 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD @Override public void onColorsChanged(ColorExtractor colorExtractor, int which) { if ((which & WallpaperManager.FLAG_SYSTEM) != 0) { - // Recents doesn't care about the wallpaper being visible or not, it always - // wants to scrim with wallpaper colors ColorExtractor.GradientColors colors = mColorExtractor.getNeutralColors(); boolean darkText = colors.supportsDarkText(); if (darkText != mUsingDarkText) { diff --git a/packages/SystemUI/res-keyguard/values/styles.xml b/packages/SystemUI/res-keyguard/values/styles.xml index 9a042228435b..67c4458de2f2 100644 --- a/packages/SystemUI/res-keyguard/values/styles.xml +++ b/packages/SystemUI/res-keyguard/values/styles.xml @@ -111,7 +111,7 @@ <item name="android:colorBackground">@*android:color/background_material_dark</item> </style> - <style name="TextAppearance.Keyguard" parent="Theme.SystemUI"> + <style name="TextAppearance.Keyguard"> <item name="android:textSize">@dimen/widget_title_font_size</item> <item name="android:gravity">center</item> <item name="android:ellipsize">end</item> diff --git a/packages/SystemUI/res/values-be/strings.xml b/packages/SystemUI/res/values-be/strings.xml index 62d308c8a3cc..0612acb15b85 100644 --- a/packages/SystemUI/res/values-be/strings.xml +++ b/packages/SystemUI/res/values-be/strings.xml @@ -945,6 +945,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"Перамясціць лявей і ніжэй"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"Перамясціць правей і ніжэй"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"Адхіліць"</string> - <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"Сістэма навігацыі абноўлена. Каб унесці змяненні, перайдзіце ў Налады."</string> - <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"Перайдзіце ў Налады, каб абнавіць сістэму навігацыі"</string> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"Навігацыя ў сістэме абноўлена. Каб унесці змяненні, перайдзіце ў Налады."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"Перайдзіце ў Налады, каб абнавіць параметры навігацыі ў сістэме"</string> </resources> diff --git a/packages/SystemUI/res/values-ca/strings.xml b/packages/SystemUI/res/values-ca/strings.xml index e29908f128dc..da625facaa20 100644 --- a/packages/SystemUI/res/values-ca/strings.xml +++ b/packages/SystemUI/res/values-ca/strings.xml @@ -412,10 +412,10 @@ <string name="interruption_level_none_twoline" msgid="3957581548190765889">"Silenci\ntotal"</string> <string name="interruption_level_priority_twoline" msgid="1564715335217164124">"Només\ninterr. prior."</string> <string name="interruption_level_alarms_twoline" msgid="3266909566410106146">"Només\nalarmes"</string> - <string name="keyguard_indication_charging_time_wireless" msgid="6959284458466962592">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • S\'està carregant sense fil (temps restant: <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g>)"</string> - <string name="keyguard_indication_charging_time" msgid="2056340799276374421">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • S\'està carregant (temps restant: <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g>)"</string> + <string name="keyguard_indication_charging_time_wireless" msgid="6959284458466962592">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • S\'està carregant sense fil (<xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> per completar la càrrega)"</string> + <string name="keyguard_indication_charging_time" msgid="2056340799276374421">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • S\'està carregant (<xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> per completar la càrrega)"</string> <string name="keyguard_indication_charging_time_fast" msgid="7767562163577492332">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Carregant ràpidament (temps restant: <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g>)"</string> - <string name="keyguard_indication_charging_time_slowly" msgid="3769655133567307069">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Carregant lentament (temps restant: <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g>)"</string> + <string name="keyguard_indication_charging_time_slowly" msgid="3769655133567307069">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Carregant lentament (<xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> per completar la càrrega)"</string> <string name="accessibility_multi_user_switch_switcher" msgid="7305948938141024937">"Canvia d\'usuari"</string> <string name="accessibility_multi_user_switch_switcher_with_current" msgid="8434880595284601601">"Canvia d\'usuari. Usuari actual: <xliff:g id="CURRENT_USER_NAME">%s</xliff:g>"</string> <string name="accessibility_multi_user_switch_inactive" msgid="1424081831468083402">"Usuari actual: <xliff:g id="CURRENT_USER_NAME">%s</xliff:g>"</string> diff --git a/packages/SystemUI/res/values-de/strings.xml b/packages/SystemUI/res/values-de/strings.xml index b1f8e7dabf5f..f495c43db5fa 100644 --- a/packages/SystemUI/res/values-de/strings.xml +++ b/packages/SystemUI/res/values-de/strings.xml @@ -26,7 +26,7 @@ <string name="status_bar_latest_events_title" msgid="6594767438577593172">"Benachrichtigungen"</string> <string name="battery_low_title" msgid="9187898087363540349">"Der Akku ist fast leer"</string> <string name="battery_low_percent_format" msgid="2900940511201380775">"<xliff:g id="PERCENTAGE">%s</xliff:g> verbleibend"</string> - <string name="battery_low_percent_format_hybrid" msgid="6838677459286775617">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> ausstehend; noch ca. <xliff:g id="TIME">%2$s</xliff:g>, basierend auf deiner Nutzung"</string> + <string name="battery_low_percent_format_hybrid" msgid="6838677459286775617">"Noch <xliff:g id="PERCENTAGE">%1$s</xliff:g> übrig; bei deinem Nutzungsmuster hast du noch ca. <xliff:g id="TIME">%2$s</xliff:g>"</string> <string name="battery_low_percent_format_hybrid_short" msgid="9025795469949145586">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> ausstehend; noch ca. <xliff:g id="TIME">%2$s</xliff:g>"</string> <string name="battery_low_percent_format_saver_started" msgid="7879389868952879166">"Noch <xliff:g id="PERCENTAGE">%s</xliff:g>. Der Energiesparmodus ist aktiviert."</string> <string name="invalid_charger" msgid="2741987096648693172">"Aufladen über USB nicht möglich. Verwende das mit dem Gerät gelieferte Ladegerät."</string> @@ -199,7 +199,7 @@ <!-- String.format failed for translation --> <!-- no translation found for accessibility_battery_level (7451474187113371965) --> <skip /> - <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Akku bei <xliff:g id="PERCENTAGE">%1$s</xliff:g> %, noch etwa <xliff:g id="TIME">%2$s</xliff:g>, basierend auf deiner Nutzung"</string> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Akku bei <xliff:g id="PERCENTAGE">%1$s</xliff:g> %, bei deinem Nutzungsmuster hast du noch ca. <xliff:g id="TIME">%2$s</xliff:g>"</string> <!-- String.format failed for translation --> <!-- no translation found for accessibility_battery_level_charging (1147587904439319646) --> <skip /> @@ -937,6 +937,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"Nach unten links verschieben"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"Nach unten rechts verschieben"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"Schließen"</string> - <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"Systemsteuerung wurde aktualisiert. Änderungen kannst du in den \"Einstellungen\" vornehmen."</string> - <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"Gehe zu den Einstellungen, um die Systemsteuerung zu aktualisieren"</string> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"Systemsteuerungseinstellungen wurden angepasst. Änderungen kannst du in den Einstellungen vornehmen."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"Gehe zu den Einstellungen, um die Systemsteuerung anzupassen"</string> </resources> diff --git a/packages/SystemUI/res/values-fr/strings.xml b/packages/SystemUI/res/values-fr/strings.xml index d02a3c8eab6c..4aedbcd992e5 100644 --- a/packages/SystemUI/res/values-fr/strings.xml +++ b/packages/SystemUI/res/values-fr/strings.xml @@ -197,8 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"Modification du réseau de l\'opérateur"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"Ouvrir les détails de la batterie"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"Batterie : <xliff:g id="NUMBER">%d</xliff:g> pour cent"</string> - <!-- no translation found for accessibility_battery_level_with_estimate (9033100930684311630) --> - <skip /> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> pour cent de batterie : il reste environ <xliff:g id="TIME">%2$s</xliff:g>, en fonction de votre utilisation"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"Batterie en charge : <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g> %%."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"Paramètres système"</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"Notifications"</string> @@ -934,8 +933,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"Déplacer en bas à gauche"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"Déplacer en bas à droite"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"Ignorer"</string> - <!-- no translation found for notification_content_system_nav_changed (7218093915747788444) --> - <skip /> - <!-- no translation found for notification_content_gesture_nav_available (8111130443656460792) --> - <skip /> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"Navigation système mise à jour. Pour apporter des modifications, accédez aux paramètres."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"Accédez aux paramètres pour mettre à jour la navigation système"</string> </resources> diff --git a/packages/SystemUI/res/values-gl/strings.xml b/packages/SystemUI/res/values-gl/strings.xml index c96ca9f6f7f7..9bbb170b7001 100644 --- a/packages/SystemUI/res/values-gl/strings.xml +++ b/packages/SystemUI/res/values-gl/strings.xml @@ -197,8 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"Cambio de rede do operador"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"Abrir os detalles da batería"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"Carga da batería: <xliff:g id="NUMBER">%d</xliff:g> por cento."</string> - <!-- no translation found for accessibility_battery_level_with_estimate (9033100930684311630) --> - <skip /> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Batería: <xliff:g id="PERCENTAGE">%1$s</xliff:g> %, durará <xliff:g id="TIME">%2$s</xliff:g> co uso que adoitas darlle"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"A batería está cargando. Nivel: <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g> %%."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"Configuración do sistema"</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"Notificacións"</string> @@ -934,8 +933,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"Mover á parte infer. esquerda"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"Mover á parte inferior dereita"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"Ignorar"</string> - <!-- no translation found for notification_content_system_nav_changed (7218093915747788444) --> - <skip /> - <!-- no translation found for notification_content_gesture_nav_available (8111130443656460792) --> - <skip /> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"Actualizouse a navegación do sistema. Para facer cambios, vai a Configuración."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"Para actualizar a navegación do sistema, vai a Configuración"</string> </resources> diff --git a/packages/SystemUI/res/values-gu/strings.xml b/packages/SystemUI/res/values-gu/strings.xml index 0019f284ebb0..2319ad837b82 100644 --- a/packages/SystemUI/res/values-gu/strings.xml +++ b/packages/SystemUI/res/values-gu/strings.xml @@ -197,8 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"કૅરીઅર નેટવર્કમાં ફેરફાર થઈ રહ્યો છે"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"બૅટરીની વિગતો ખોલો"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"બૅટરી <xliff:g id="NUMBER">%d</xliff:g> ટકા."</string> - <!-- no translation found for accessibility_battery_level_with_estimate (9033100930684311630) --> - <skip /> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"તમારા વપરાશના આધારે બૅટરી <xliff:g id="PERCENTAGE">%1$s</xliff:g> ટકા, જે લગભગ <xliff:g id="TIME">%2$s</xliff:g> સુધી ચાલે તેટલી બચી છે"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"બૅટરી ચાર્જ થઈ રહી છે, <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g>%%."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"સિસ્ટમ સેટિંગ્સ."</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"નોટિફિકેશનો."</string> @@ -934,8 +933,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"નીચે ડાબે ખસેડો"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"નીચે જમણે ખસેડો"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"છોડી દો"</string> - <!-- no translation found for notification_content_system_nav_changed (7218093915747788444) --> - <skip /> - <!-- no translation found for notification_content_gesture_nav_available (8111130443656460792) --> - <skip /> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"સિસ્ટમ નૅવિગેશન અપડેટ કર્યું. ફેરફારો કરવા માટે, સેટિંગ પર જાઓ."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"સિસ્ટમ નૅવિગેશનને અપડેટ કરવા માટે સેટિંગ પર જાઓ"</string> </resources> diff --git a/packages/SystemUI/res/values-hi/strings.xml b/packages/SystemUI/res/values-hi/strings.xml index 8c64a2ca24cd..7fd092638572 100644 --- a/packages/SystemUI/res/values-hi/strings.xml +++ b/packages/SystemUI/res/values-hi/strings.xml @@ -197,8 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"मोबाइल और इंटरनेट सेवा देने वाली कंपनी का नेटवर्क बदल रहा है"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"बैटरी का विवरण खोलें"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"<xliff:g id="NUMBER">%d</xliff:g> प्रतिशत बैटरी."</string> - <!-- no translation found for accessibility_battery_level_with_estimate (9033100930684311630) --> - <skip /> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> प्रतिशत बैटरी बची है और आपके इस्तेमाल के हिसाब से यह <xliff:g id="TIME">%2$s</xliff:g> में खत्म हो जाएगी"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"बैटरी चार्ज हो रही है, <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g>%%."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"सिस्टम सेटिंग."</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"सूचनाएं."</string> @@ -934,8 +933,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"बाईं ओर सबसे नीचे ले जाएं"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"सबसे नीचे दाईं ओर ले जाएं"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"खारिज करें"</string> - <!-- no translation found for notification_content_system_nav_changed (7218093915747788444) --> - <skip /> - <!-- no translation found for notification_content_gesture_nav_available (8111130443656460792) --> - <skip /> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"सिस्टम नेविगेशन अपडेट हो गया. बदलाव करने के लिए \'सेटिंग\' पर जाएं."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"सिस्टम नेविगेशन अपडेट करने के लिए \'सेटिंग\' में जाएं"</string> </resources> diff --git a/packages/SystemUI/res/values-hy/strings.xml b/packages/SystemUI/res/values-hy/strings.xml index 96a5b6da3e32..7d31eca43faa 100644 --- a/packages/SystemUI/res/values-hy/strings.xml +++ b/packages/SystemUI/res/values-hy/strings.xml @@ -197,8 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"Օպերատորի ցանցի փոփոխություն"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"Բացել մարտկոցի տվյալները"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"Մարտկոցը <xliff:g id="NUMBER">%d</xliff:g> տոկոս է:"</string> - <!-- no translation found for accessibility_battery_level_with_estimate (9033100930684311630) --> - <skip /> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Մարտկոցի լիցքը <xliff:g id="PERCENTAGE">%1$s</xliff:g> տոկոս է և կբավարարի մոտ <xliff:g id="TIME">%2$s</xliff:g>՝ կախված օգտագործման եղանակից:"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"Մարտկոցը լիցքավորվում է: Լիցքը <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g> տոկոս է:"</string> <string name="accessibility_settings_button" msgid="799583911231893380">"Համակարգի կարգավորումներ:"</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"Ծանուցումներ:"</string> @@ -934,8 +933,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"Տեղափոխել ներքև՝ ձախ"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"Տեղափոխել ներքև՝ աջ"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"Փակել"</string> - <!-- no translation found for notification_content_system_nav_changed (7218093915747788444) --> - <skip /> - <!-- no translation found for notification_content_gesture_nav_available (8111130443656460792) --> - <skip /> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"Համակարգի նավիգացիան թարմացվեց: Փոփոխություններ անելու համար անցեք կարգավորումներ:"</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"Թարմացրեք համակարգի նավիգացիան կարգավորումներում"</string> </resources> diff --git a/packages/SystemUI/res/values-it/strings.xml b/packages/SystemUI/res/values-it/strings.xml index 8f70cbd3f4c9..81670848f203 100644 --- a/packages/SystemUI/res/values-it/strings.xml +++ b/packages/SystemUI/res/values-it/strings.xml @@ -197,7 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"Cambio della rete dell\'operatore"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"Visualizza i dettagli relativi alla batteria"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"Batteria: <xliff:g id="NUMBER">%d</xliff:g> percento."</string> - <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Batteria al <xliff:g id="PERCENTAGE">%1$s</xliff:g> percento. Tempo rimanente in base al tuo utilizzo: <xliff:g id="TIME">%2$s</xliff:g>"</string> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Livello della batteria: <xliff:g id="PERCENTAGE">%1$s</xliff:g> percento. Tempo rimanente in base al tuo utilizzo: <xliff:g id="TIME">%2$s</xliff:g>"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"Batteria in carica, <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g>%%."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"Impostazioni di sistema."</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"Notifiche."</string> diff --git a/packages/SystemUI/res/values-kk/strings.xml b/packages/SystemUI/res/values-kk/strings.xml index 8e2631a5f7e5..bdb03bc9bb1f 100644 --- a/packages/SystemUI/res/values-kk/strings.xml +++ b/packages/SystemUI/res/values-kk/strings.xml @@ -197,8 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"Оператор желісін өзгерту"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"Батарея мәліметтерін ашу"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"Батарея <xliff:g id="NUMBER">%d</xliff:g> пайыз."</string> - <!-- no translation found for accessibility_battery_level_with_estimate (9033100930684311630) --> - <skip /> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Батарея заряды: <xliff:g id="PERCENTAGE">%1$s</xliff:g> пайыз. Пайдалануға байланысты шамамен <xliff:g id="TIME">%2$s</xliff:g> уақытқа жетеді."</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"Батарея зарядталуда, <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g> %%."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"Жүйе параметрлері."</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"Хабарлар."</string> @@ -934,8 +933,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"Төменгі сол жаққа жылжыту"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"Төменгі оң жаққа жылжыту"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"Жабу"</string> - <!-- no translation found for notification_content_system_nav_changed (7218093915747788444) --> - <skip /> - <!-- no translation found for notification_content_gesture_nav_available (8111130443656460792) --> - <skip /> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"Жүйе навигациясы жаңартылды. Өзгерту енгізу үшін \"Параметрлер\" бөліміне өтіңіз."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"Жүйе навигациясын жаңарту үшін \"Параметрлер\" бөліміне өтіңіз."</string> </resources> diff --git a/packages/SystemUI/res/values-ml/strings.xml b/packages/SystemUI/res/values-ml/strings.xml index fdeed95f5ffe..7367fa545727 100644 --- a/packages/SystemUI/res/values-ml/strings.xml +++ b/packages/SystemUI/res/values-ml/strings.xml @@ -197,8 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"കാരിയർ നെറ്റ്വർക്ക് മാറ്റൽ"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"ബാറ്ററി വിശദാംശങ്ങൾ തുറക്കുക"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"ബാറ്ററി <xliff:g id="NUMBER">%d</xliff:g> ശതമാനം."</string> - <!-- no translation found for accessibility_battery_level_with_estimate (9033100930684311630) --> - <skip /> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"ബാറ്ററി <xliff:g id="PERCENTAGE">%1$s</xliff:g> ശതമാനം, നിങ്ങളുടെ ഉപയോഗത്തിൻ്റെ അടിസ്ഥാനത്തിൽ ഏകദേശം <xliff:g id="TIME">%2$s</xliff:g> സമയം കൂടി ശേഷിക്കുന്നു"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"ബാറ്ററി ചാർജുചെയ്യുന്നു, <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g>%%."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"സിസ്റ്റം ക്രമീകരണങ്ങൾ."</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"അറിയിപ്പുകൾ."</string> @@ -934,8 +933,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"ചുവടെ ഇടതുഭാഗത്തേക്ക് നീക്കുക"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"ചുവടെ വലതുഭാഗത്തേക്ക് നീക്കുക"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"ഡിസ്മിസ് ചെയ്യുക"</string> - <!-- no translation found for notification_content_system_nav_changed (7218093915747788444) --> - <skip /> - <!-- no translation found for notification_content_gesture_nav_available (8111130443656460792) --> - <skip /> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"സിസ്റ്റം നാവിഗേഷൻ അപ്ഡേറ്റ് ചെയ്തു. മാറ്റങ്ങൾ വരുത്താൻ ക്രമീകരണത്തിലേക്ക് പോവുക."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"സിസ്റ്റം നാവിഗേഷൻ അപ്ഡേറ്റ് ചെയ്യാൻ ക്രമീകരണത്തിലേക്ക് പോവുക"</string> </resources> diff --git a/packages/SystemUI/res/values-mr/strings.xml b/packages/SystemUI/res/values-mr/strings.xml index 6feaa9677a73..48966f06ebe0 100644 --- a/packages/SystemUI/res/values-mr/strings.xml +++ b/packages/SystemUI/res/values-mr/strings.xml @@ -197,8 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"वाहक नेटवर्क बदलत आहे"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"बॅटरी तपशील उघडा"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"बॅटरी <xliff:g id="NUMBER">%d</xliff:g> टक्के."</string> - <!-- no translation found for accessibility_battery_level_with_estimate (9033100930684311630) --> - <skip /> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"बॅटरी <xliff:g id="PERCENTAGE">%1$s</xliff:g> टक्के, तुमच्या वापराच्या आधारावर सुमारे <xliff:g id="TIME">%2$s</xliff:g> शिल्लक आहे"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"बॅटरी चार्ज होत आहे, <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g> टक्के."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"सिस्टम सेटिंग्ज."</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"सूचना."</string> @@ -934,8 +933,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"तळाशी डावीकडे हलवा"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"तळाशी उजवीकडे हलवा"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"डिसमिस करा"</string> - <!-- no translation found for notification_content_system_nav_changed (7218093915747788444) --> - <skip /> - <!-- no translation found for notification_content_gesture_nav_available (8111130443656460792) --> - <skip /> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"सिस्टम नेव्हिगेशन अपडेट केले. बदल करण्यासाठी, सेटिंग्जवर जा."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"सिस्टम नेव्हिगेशन अपडेट करण्यासाठी सेटिंग्जवर जा"</string> </resources> diff --git a/packages/SystemUI/res/values-nb/strings.xml b/packages/SystemUI/res/values-nb/strings.xml index 7b373fc10590..c24fee530afe 100644 --- a/packages/SystemUI/res/values-nb/strings.xml +++ b/packages/SystemUI/res/values-nb/strings.xml @@ -197,7 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"Bytting av operatørnettverk"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"Åpne informasjon om batteriet"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"Batteri – <xliff:g id="NUMBER">%d</xliff:g> prosent."</string> - <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Batteri <xliff:g id="PERCENTAGE">%1$s</xliff:g> prosent, omtrent <xliff:g id="TIME">%2$s</xliff:g> gjenstår basert på bruken din"</string> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Batterinivået er <xliff:g id="PERCENTAGE">%1$s</xliff:g> prosent – omtrent <xliff:g id="TIME">%2$s</xliff:g> gjenstår basert på bruken din"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"Batteriet lades – <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g> prosent."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"Systeminnstillinger."</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"Varsler."</string> @@ -933,6 +933,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"Flytt til nederst til venstre"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"Flytt til nederst til høyre"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"Avvis"</string> - <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"Systemnavigering er oppdatert. For å gjøre endringer, gå til Innstillinger."</string> - <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"Gå til Innstillinger for å oppdatere systemnavigering"</string> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"Systemnavigeringen er oppdatert. For å gjøre endringer, gå til Innstillinger."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"Gå til Innstillinger for å oppdatere systemnavigeringen"</string> </resources> diff --git a/packages/SystemUI/res/values-or/strings.xml b/packages/SystemUI/res/values-or/strings.xml index b77c4ba3cb6c..71eca7465981 100644 --- a/packages/SystemUI/res/values-or/strings.xml +++ b/packages/SystemUI/res/values-or/strings.xml @@ -197,8 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"କେରିଅର୍ ନେଟ୍ୱର୍କ ବଦଳୁଛି"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"ବ୍ୟାଟେରୀ ବିବରଣୀ ଖୋଲନ୍ତୁ"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"ବ୍ୟାଟେରୀ <xliff:g id="NUMBER">%d</xliff:g> ଶତକଡ଼ା ଅଛି।"</string> - <!-- no translation found for accessibility_battery_level_with_estimate (9033100930684311630) --> - <skip /> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"ବ୍ୟାଟେରୀ <xliff:g id="PERCENTAGE">%1$s</xliff:g> ଶତକଡା, ଆପଣଙ୍କର ବ୍ୟବହାରକୁ ଆଧାର କରି ପାଖାପାଖି <xliff:g id="TIME">%2$s</xliff:g> ବାକି ଅଛି"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"ବ୍ୟାଟେରୀ ଚାର୍ଜ ହେଉଛି, <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g> ଶତକଡ଼ା।"</string> <string name="accessibility_settings_button" msgid="799583911231893380">"ସିଷ୍ଟମ୍ ସେଟିଙ୍ଗ।"</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"ବିଜ୍ଞପ୍ତି"</string> @@ -934,8 +933,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"ତଳ ବାମକୁ ନିଅନ୍ତୁ"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"ତଳ ଡାହାଣକୁ ନିଅନ୍ତୁ"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"ଖାରଜ କରନ୍ତୁ"</string> - <!-- no translation found for notification_content_system_nav_changed (7218093915747788444) --> - <skip /> - <!-- no translation found for notification_content_gesture_nav_available (8111130443656460792) --> - <skip /> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"ସିଷ୍ଟମ୍ ନାଭିଗେସନ୍ ଅପ୍ଡେଟ୍ ହୋଇଛି। ପରିବର୍ତ୍ତନ କରିବା ପାଇଁ, ସେଟିଂସ୍କୁ ଯାଆନ୍ତୁ।"</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"ସିଷ୍ଟମ୍ ନାଭିଗେସନ୍ ଅପ୍ଡେଟ୍ କରିବା ପାଇଁ ସେଟିଂସ୍କୁ ଯାଆନ୍ତୁ"</string> </resources> diff --git a/packages/SystemUI/res/values-ro/strings.xml b/packages/SystemUI/res/values-ro/strings.xml index c74df0a4f7d1..5fa5233b5104 100644 --- a/packages/SystemUI/res/values-ro/strings.xml +++ b/packages/SystemUI/res/values-ro/strings.xml @@ -197,8 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"Se schimbă rețeaua operatorului"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"Deschideți detaliile privind bateria"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"Baterie: <xliff:g id="NUMBER">%d</xliff:g> la sută."</string> - <!-- no translation found for accessibility_battery_level_with_estimate (9033100930684311630) --> - <skip /> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Procentul rămas din baterie este <xliff:g id="PERCENTAGE">%1$s</xliff:g>. În baza utilizării, timpul rămas este de aproximativ <xliff:g id="TIME">%2$s</xliff:g>"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"Se încarcă bateria, <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g>%%."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"Setări de sistem."</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"Notificări."</string> @@ -939,8 +938,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"Mutați în stânga jos"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"Mutați în dreapta jos"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"Închideți"</string> - <!-- no translation found for notification_content_system_nav_changed (7218093915747788444) --> - <skip /> - <!-- no translation found for notification_content_gesture_nav_available (8111130443656460792) --> - <skip /> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"Navigarea în sistem a fost actualizată. Pentru a face modificări, accesați Setările."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"Accesați Setările pentru a actualiza navigarea în sistem"</string> </resources> diff --git a/packages/SystemUI/res/values-sq/strings.xml b/packages/SystemUI/res/values-sq/strings.xml index 3aacb9be3e6b..a2694b8d3106 100644 --- a/packages/SystemUI/res/values-sq/strings.xml +++ b/packages/SystemUI/res/values-sq/strings.xml @@ -197,7 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"Rrjeti i operatorit celular po ndryshohet"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"Hap detajet e baterisë"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"Bateria ka edhe <xliff:g id="NUMBER">%d</xliff:g> për qind."</string> - <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Bateria <xliff:g id="PERCENTAGE">%1$s</xliff:g> përqind, mbeten <xliff:g id="TIME">%2$s</xliff:g> bazuar në përdorimin tënd"</string> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Bateria <xliff:g id="PERCENTAGE">%1$s</xliff:g> përqind, rreth <xliff:g id="TIME">%2$s</xliff:g> të mbetura bazuar në përdorimin tënd"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"Bateria po karikohet, <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g>%%."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"Cilësimet e sistemit."</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"Njoftimet."</string> diff --git a/packages/SystemUI/res/values-ta/strings.xml b/packages/SystemUI/res/values-ta/strings.xml index fdee175ce600..600c7671c016 100644 --- a/packages/SystemUI/res/values-ta/strings.xml +++ b/packages/SystemUI/res/values-ta/strings.xml @@ -197,8 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"மொபைல் நிறுவன நெட்வொர்க்கை மாற்றும்"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"பேட்டரி விவரங்களைத் திறக்கும்"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"பேட்டரி சக்தி <xliff:g id="NUMBER">%d</xliff:g> சதவிகிதம் உள்ளது."</string> - <!-- no translation found for accessibility_battery_level_with_estimate (9033100930684311630) --> - <skip /> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"பேட்டரி: <xliff:g id="PERCENTAGE">%1$s</xliff:g> சதவீதம், உபயோகத்தின் அடிப்படையில் <xliff:g id="TIME">%2$s</xliff:g> மீதமுள்ளது"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"பேட்டரி சார்ஜ் செய்யப்படுகிறது, <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g> சதவீதம்."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"கணினி அமைப்பு."</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"அறிவிப்புகள்."</string> @@ -934,8 +933,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"கீழே இடப்புறமாக நகர்த்து"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"கீழே வலதுபுறமாக நகர்த்து"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"மூடுக"</string> - <!-- no translation found for notification_content_system_nav_changed (7218093915747788444) --> - <skip /> - <!-- no translation found for notification_content_gesture_nav_available (8111130443656460792) --> - <skip /> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"சிஸ்டம் நேவிகேஷன் மாற்றப்பட்டது. மாற்றங்களைச் செய்ய ‘அமைப்புகளுக்குச்’ செல்லவும்."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"சிஸ்டம் நேவிகேஷனை மாற்ற ’அமைப்புகளுக்குச்’ செல்லவும்"</string> </resources> diff --git a/packages/SystemUI/res/values-tr/strings.xml b/packages/SystemUI/res/values-tr/strings.xml index 347f6452f648..63d9f102d017 100644 --- a/packages/SystemUI/res/values-tr/strings.xml +++ b/packages/SystemUI/res/values-tr/strings.xml @@ -197,8 +197,7 @@ <string name="carrier_network_change_mode" msgid="8149202439957837762">"Operatör ağı değiştiriliyor"</string> <string name="accessibility_battery_details" msgid="7645516654955025422">"Pil ayrıntılarını aç"</string> <string name="accessibility_battery_level" msgid="7451474187113371965">"Pil yüzdesi: <xliff:g id="NUMBER">%d</xliff:g>"</string> - <!-- no translation found for accessibility_battery_level_with_estimate (9033100930684311630) --> - <skip /> + <string name="accessibility_battery_level_with_estimate" msgid="9033100930684311630">"Pil yüzde <xliff:g id="PERCENTAGE">%1$s</xliff:g> dolu. Kullanımınıza göre yaklaşık <xliff:g id="TIME">%2$s</xliff:g> süresi kaldı"</string> <string name="accessibility_battery_level_charging" msgid="1147587904439319646">"Pil şarj oluyor, yüzde <xliff:g id="BATTERY_PERCENTAGE">%d</xliff:g>."</string> <string name="accessibility_settings_button" msgid="799583911231893380">"Sistem ayarları."</string> <string name="accessibility_notifications_button" msgid="4498000369779421892">"Bildirimler."</string> @@ -934,8 +933,6 @@ <string name="bubble_accessibility_action_move_bottom_left" msgid="206369104473183217">"Sol alta taşı"</string> <string name="bubble_accessibility_action_move_bottom_right" msgid="8705660152384312329">"Sağ alta taşı"</string> <string name="bubble_dismiss_text" msgid="8028337712674081668">"Kapat"</string> - <!-- no translation found for notification_content_system_nav_changed (7218093915747788444) --> - <skip /> - <!-- no translation found for notification_content_gesture_nav_available (8111130443656460792) --> - <skip /> + <string name="notification_content_system_nav_changed" msgid="7218093915747788444">"Sistemde gezinme yöntemi güncellendi. Değişiklik yapmak için Ayarlar\'a gidin."</string> + <string name="notification_content_gesture_nav_available" msgid="8111130443656460792">"Sistemde gezinme yöntemini güncellemek için Ayarlar\'a gidin"</string> </resources> diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java index 6b07ed8e8edc..a2abb4b1695c 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java @@ -64,6 +64,7 @@ import com.android.systemui.shared.recents.model.ThumbnailData; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.Future; import java.util.function.Consumer; public class ActivityManagerWrapper { @@ -380,8 +381,8 @@ public class ActivityManagerWrapper { /** * Requests that the system close any open system windows (including other SystemUI). */ - public void closeSystemWindows(final String reason) { - mBackgroundExecutor.submit(new Runnable() { + public Future<?> closeSystemWindows(final String reason) { + return mBackgroundExecutor.submit(new Runnable() { @Override public void run() { try { diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java index 0bb9e744f2b6..7ec1bda26cf8 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java @@ -374,7 +374,7 @@ public class KeyguardClockSwitch extends RelativeLayout { private void updateColors() { ColorExtractor.GradientColors colors = mSysuiColorExtractor.getColors( - WallpaperManager.FLAG_LOCK, true); + WallpaperManager.FLAG_LOCK); mSupportsDarkText = colors.supportsDarkText(); mColorPalette = colors.getColorPalette(); if (mClockPlugin != null) { diff --git a/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java index f468ecaae4c1..558ac4b564d1 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java @@ -130,7 +130,7 @@ public class AnalogClockController implements ClockPlugin { setDarkAmount(1f); setTextColor(Color.WHITE); ColorExtractor.GradientColors colors = mColorExtractor.getColors( - WallpaperManager.FLAG_LOCK, true); + WallpaperManager.FLAG_LOCK); setColorPalette(colors.supportsDarkText(), colors.getColorPalette()); onTimeTick(); diff --git a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java index 61a6952cacac..bdf9dc4865b2 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java @@ -130,7 +130,7 @@ public class BubbleClockController implements ClockPlugin { setDarkAmount(1f); setTextColor(Color.WHITE); ColorExtractor.GradientColors colors = mColorExtractor.getColors( - WallpaperManager.FLAG_LOCK, true); + WallpaperManager.FLAG_LOCK); setColorPalette(colors.supportsDarkText(), colors.getColorPalette()); onTimeTick(); diff --git a/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java index ce1f09c9355c..98679ade1022 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java @@ -124,7 +124,7 @@ public class DefaultClockController implements ClockPlugin { setDarkAmount(1f); setTextColor(Color.WHITE); ColorExtractor.GradientColors colors = mColorExtractor.getColors( - WallpaperManager.FLAG_LOCK, true); + WallpaperManager.FLAG_LOCK); setColorPalette(colors.supportsDarkText(), colors.getColorPalette()); onTimeTick(); diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java index 305558fd9efa..7d36469bb905 100644 --- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java +++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java @@ -911,6 +911,7 @@ public class ScreenDecorations extends SystemUI implements Tunable, if (shouldDrawCutout(getContext()) && hasCutout()) { mBounds.addAll(mInfo.displayCutout.getBoundingRects()); localBounds(mBoundingRect); + updateGravity(); updateBoundingPath(); invalidate(); newVisible = VISIBLE; @@ -961,6 +962,18 @@ public class ScreenDecorations extends SystemUI implements Tunable, } } + private void updateGravity() { + LayoutParams lp = getLayoutParams(); + if (lp instanceof FrameLayout.LayoutParams) { + FrameLayout.LayoutParams flp = (FrameLayout.LayoutParams) lp; + int newGravity = getGravity(mInfo.displayCutout); + if (flp.gravity != newGravity) { + flp.gravity = newGravity; + setLayoutParams(flp); + } + } + } + private boolean hasCutout() { final DisplayCutout displayCutout = mInfo.displayCutout; if (displayCutout == null) { @@ -1007,21 +1020,25 @@ public class ScreenDecorations extends SystemUI implements Tunable, } private void localBounds(Rect out) { - final DisplayCutout displayCutout = mInfo.displayCutout; + DisplayCutout displayCutout = mInfo.displayCutout; + boundsFromDirection(displayCutout, getGravity(displayCutout), out); + } + private int getGravity(DisplayCutout displayCutout) { if (mStart) { if (displayCutout.getSafeInsetLeft() > 0) { - boundsFromDirection(displayCutout, Gravity.LEFT, out); + return Gravity.LEFT; } else if (displayCutout.getSafeInsetTop() > 0) { - boundsFromDirection(displayCutout, Gravity.TOP, out); + return Gravity.TOP; } } else { if (displayCutout.getSafeInsetRight() > 0) { - boundsFromDirection(displayCutout, Gravity.RIGHT, out); + return Gravity.RIGHT; } else if (displayCutout.getSafeInsetBottom() > 0) { - boundsFromDirection(displayCutout, Gravity.BOTTOM, out); + return Gravity.BOTTOM; } } + return Gravity.NO_GRAVITY; } @Override diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java index b747998514ed..002d4f34be11 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java @@ -243,12 +243,12 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac return; } - mHandlesShowing = false; - mHandlesLastHiddenAt = SystemClock.elapsedRealtime(); ScreenDecorations screenDecorations = mScreenDecorationsSupplier.get(); if (screenDecorations == null) { Log.w(TAG, "Couldn't hide handles, ScreenDecorations unavailable"); } else { + mHandlesShowing = false; + mHandlesLastHiddenAt = SystemClock.elapsedRealtime(); screenDecorations.setAssistHintVisible(false); } } diff --git a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java index 835ffc976e9f..6f56a53c1c49 100644 --- a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java +++ b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java @@ -16,18 +16,11 @@ package com.android.systemui.colorextraction; -import android.annotation.ColorInt; import android.app.WallpaperColors; import android.app.WallpaperManager; import android.content.Context; -import android.os.Handler; -import android.os.RemoteException; +import android.graphics.Color; import android.os.UserHandle; -import android.util.Log; -import android.view.Display; -import android.view.IWallpaperVisibilityListener; -import android.view.IWindowManager; -import android.view.WindowManagerGlobal; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.colorextraction.ColorExtractor; @@ -52,46 +45,28 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable, ConfigurationController.ConfigurationListener { private static final String TAG = "SysuiColorExtractor"; private final Tonal mTonal; - private boolean mWallpaperVisible; - private boolean mHasBackdrop; - // Colors to return when the wallpaper isn't visible - private final GradientColors mWpHiddenColors; + private boolean mHasMediaArtwork; + private final GradientColors mNeutralColorsLock; + private final GradientColors mBackdropColors; @Inject public SysuiColorExtractor(Context context, ConfigurationController configurationController) { - this(context, new Tonal(context), configurationController, true); + this(context, new Tonal(context), configurationController, + context.getSystemService(WallpaperManager.class), false /* immediately */); } @VisibleForTesting public SysuiColorExtractor(Context context, ExtractionType type, - ConfigurationController configurationController, boolean registerVisibility) { - super(context, type, false /* immediately */); + ConfigurationController configurationController, + WallpaperManager wallpaperManager, boolean immediately) { + super(context, type, immediately, wallpaperManager); mTonal = type instanceof Tonal ? (Tonal) type : new Tonal(context); - mWpHiddenColors = new GradientColors(); + mNeutralColorsLock = new GradientColors(); configurationController.addCallback(this); - WallpaperColors systemColors = getWallpaperColors(WallpaperManager.FLAG_SYSTEM); - updateDefaultGradients(systemColors); - - if (registerVisibility) { - try { - IWindowManager windowManagerService = WindowManagerGlobal.getWindowManagerService(); - Handler handler = Handler.getMain(); - boolean visible = windowManagerService.registerWallpaperVisibilityListener( - new IWallpaperVisibilityListener.Stub() { - @Override - public void onWallpaperVisibilityChanged(boolean newVisibility, - int displayId) throws RemoteException { - handler.post(() -> setWallpaperVisible(newVisibility)); - } - }, Display.DEFAULT_DISPLAY); - setWallpaperVisible(visible); - } catch (RemoteException e) { - Log.w(TAG, "Can't listen to wallpaper visibility changes", e); - } - } + mBackdropColors = new GradientColors(); + mBackdropColors.setMainColor(Color.BLACK); - WallpaperManager wallpaperManager = context.getSystemService(WallpaperManager.class); if (wallpaperManager != null) { // Listen to all users instead of only the current one. wallpaperManager.removeOnColorsChangedListener(this); @@ -100,8 +75,14 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable, } } - private void updateDefaultGradients(WallpaperColors colors) { - mTonal.applyFallback(colors, mWpHiddenColors); + @Override + protected void extractWallpaperColors() { + super.extractWallpaperColors(); + // mTonal is final but this method will be invoked by the base class during its ctor. + if (mTonal == null) { + return; + } + mTonal.applyFallback(mLockColors == null ? mSystemColors : mLockColors, mNeutralColorsLock); } @Override @@ -110,27 +91,28 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable, // Colors do not belong to current user, ignoring. return; } - - super.onColorsChanged(colors, which); - - if ((which & WallpaperManager.FLAG_SYSTEM) != 0) { - @ColorInt int oldColor = mWpHiddenColors.getMainColor(); - updateDefaultGradients(colors); - if (oldColor != mWpHiddenColors.getMainColor()) { - triggerColorsChanged(WallpaperManager.FLAG_SYSTEM); - } + if ((which & WallpaperManager.FLAG_LOCK) != 0) { + mTonal.applyFallback(colors, mNeutralColorsLock); } + super.onColorsChanged(colors, which); } @Override public void onUiModeChanged() { - WallpaperColors systemColors = getWallpaperColors(WallpaperManager.FLAG_SYSTEM); - updateDefaultGradients(systemColors); - triggerColorsChanged(WallpaperManager.FLAG_SYSTEM); + extractWallpaperColors(); + triggerColorsChanged(WallpaperManager.FLAG_SYSTEM | WallpaperManager.FLAG_LOCK); + } + + @Override + public GradientColors getColors(int which, int type) { + if (mHasMediaArtwork && (which & WallpaperManager.FLAG_LOCK) != 0) { + return mBackdropColors; + } + return super.getColors(which, type); } /** - * Colors the should be using for scrims. + * Colors that should be using for scrims. * * They will be: * - A light gray if the wallpaper is light @@ -138,81 +120,12 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable, * - Black otherwise */ public GradientColors getNeutralColors() { - return mWpHiddenColors; - } - - /** - * Get TYPE_NORMAL colors when wallpaper is visible, or fallback otherwise. - * - * @param which FLAG_LOCK or FLAG_SYSTEM - * @return colors - */ - @Override - public GradientColors getColors(int which) { - return getColors(which, TYPE_DARK); - } - - /** - * Wallpaper colors when the wallpaper is visible, fallback otherwise. - * - * @param which FLAG_LOCK or FLAG_SYSTEM - * @param type TYPE_NORMAL, TYPE_DARK or TYPE_EXTRA_DARK - * @return colors - */ - @Override - public GradientColors getColors(int which, int type) { - return getColors(which, type, false /* ignoreVisibility */); - } - - /** - * Get TYPE_NORMAL colors, possibly ignoring wallpaper visibility. - * - * @param which FLAG_LOCK or FLAG_SYSTEM - * @param ignoreWallpaperVisibility whether you want fallback colors or not if the wallpaper - * isn't visible - * @return - */ - public GradientColors getColors(int which, boolean ignoreWallpaperVisibility) { - return getColors(which, TYPE_NORMAL, ignoreWallpaperVisibility); - } - - /** - * - * @param which FLAG_LOCK or FLAG_SYSTEM - * @param type TYPE_NORMAL, TYPE_DARK or TYPE_EXTRA_DARK - * @param ignoreWallpaperVisibility true if true wallpaper colors should be returning - * if it's visible or not - * @return colors - */ - public GradientColors getColors(int which, int type, boolean ignoreWallpaperVisibility) { - // mWallpaperVisible only handles the "system wallpaper" and will be always set to false - // if we have different lock and system wallpapers. - if (which == WallpaperManager.FLAG_SYSTEM) { - if (mWallpaperVisible || ignoreWallpaperVisibility) { - return super.getColors(which, type); - } else { - return mWpHiddenColors; - } - } else { - if (mHasBackdrop) { - return mWpHiddenColors; - } else { - return super.getColors(which, type); - } - } - } - - @VisibleForTesting - void setWallpaperVisible(boolean visible) { - if (mWallpaperVisible != visible) { - mWallpaperVisible = visible; - triggerColorsChanged(WallpaperManager.FLAG_SYSTEM); - } + return mHasMediaArtwork ? mBackdropColors : mNeutralColorsLock; } - public void setHasBackdrop(boolean hasBackdrop) { - if (mHasBackdrop != hasBackdrop) { - mHasBackdrop = hasBackdrop; + public void setHasMediaArtwork(boolean hasBackdrop) { + if (mHasMediaArtwork != hasBackdrop) { + mHasMediaArtwork = hasBackdrop; triggerColorsChanged(WallpaperManager.FLAG_LOCK); } } @@ -230,7 +143,8 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable, pw.println(" Gradients:"); pw.println(" system: " + Arrays.toString(system)); pw.println(" lock: " + Arrays.toString(lock)); - pw.println(" Default scrim: " + mWpHiddenColors); + pw.println(" Neutral colors: " + mNeutralColorsLock); + pw.println(" Has media backdrop: " + mHasMediaArtwork); } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index b0f77ceccd58..88a8b31dc361 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -53,7 +53,6 @@ import android.view.MotionEvent; import android.view.accessibility.AccessibilityManager; import com.android.internal.policy.ScreenDecorationsUtils; -import com.android.systemui.Dependency; import com.android.systemui.Dumpable; import com.android.systemui.SysUiServiceProvider; import com.android.systemui.recents.OverviewProxyService.OverviewProxyListener; @@ -100,6 +99,8 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis private final Context mContext; private final Handler mHandler; + private final NavigationBarController mNavBarController; + private final StatusBarWindowController mStatusBarWinController; private final Runnable mConnectionRunnable = this::internalConnectToCurrentUser; private final ComponentName mRecentsComponentName; private final DeviceProvisionedController mDeviceProvisionedController; @@ -446,9 +447,13 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis = this::cleanupAfterDeath; @Inject - public OverviewProxyService(Context context, DeviceProvisionedController provisionController) { + public OverviewProxyService(Context context, DeviceProvisionedController provisionController, + NavigationBarController navBarController, NavigationModeController navModeController, + StatusBarWindowController statusBarWinController) { mContext = context; mHandler = new Handler(); + mNavBarController = navBarController; + mStatusBarWinController = statusBarWinController; mDeviceProvisionedController = provisionController; mConnectionBackoffAttempts = 0; mRecentsComponentName = ComponentName.unflattenFromString(context.getString( @@ -463,7 +468,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis mBackButtonAlpha = 1.0f; // Listen for nav bar mode changes - mNavBarMode = Dependency.get(NavigationModeController.class).addListener(this); + mNavBarMode = navModeController.addListener(this); // Listen for device provisioned/user setup updateEnabledState(); @@ -513,11 +518,10 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } private void updateSystemUiStateFlags() { - final NavigationBarController navBar = Dependency.get(NavigationBarController.class); - final NavigationBarFragment navBarFragment = navBar.getDefaultNavigationBarFragment(); - final NavigationBarView navBarView = navBar.getNavigationBarView(mContext.getDisplayId()); - final StatusBarWindowController statusBarController = - Dependency.get(StatusBarWindowController.class); + final NavigationBarFragment navBarFragment = + mNavBarController.getDefaultNavigationBarFragment(); + final NavigationBarView navBarView = + mNavBarController.getNavigationBarView(mContext.getDisplayId()); mSysUiStateFlags = 0; if (navBarFragment != null) { @@ -526,8 +530,8 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis if (navBarView != null) { navBarView.updateSystemUiStateFlags(); } - if (statusBarController != null) { - statusBarController.updateSystemUiStateFlags(); + if (mStatusBarWinController != null) { + mStatusBarWinController.updateSystemUiStateFlags(); } notifySystemUiStateFlags(mSysUiStateFlags); } diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 341461bf7202..11ca94f6f4e6 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -92,6 +92,11 @@ import java.io.OutputStream; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + + /** * POD used in the AsyncTask which saves an image in the background. @@ -446,6 +451,8 @@ class GlobalScreenshot { static final String EXTRA_CANCEL_NOTIFICATION = "android:screenshot_cancel_notification"; static final String EXTRA_DISALLOW_ENTER_PIP = "android:screenshot_disallow_enter_pip"; + private static final String TAG = "GlobalScreenshot"; + private static final int SCREENSHOT_FLASH_TO_PEAK_DURATION = 130; private static final int SCREENSHOT_DROP_IN_DURATION = 430; private static final int SCREENSHOT_DROP_OUT_DELAY = 500; @@ -902,11 +909,19 @@ class GlobalScreenshot { * appropriate signals to the system (ie. to dismiss the keyguard if necessary). */ public static class ActionProxyReceiver extends BroadcastReceiver { + static final int CLOSE_WINDOWS_TIMEOUT_MILLIS = 3000; + @Override public void onReceive(Context context, final Intent intent) { Runnable startActivityRunnable = () -> { - ActivityManagerWrapper.getInstance().closeSystemWindows( - SYSTEM_DIALOG_REASON_SCREENSHOT); + try { + ActivityManagerWrapper.getInstance().closeSystemWindows( + SYSTEM_DIALOG_REASON_SCREENSHOT).get( + CLOSE_WINDOWS_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); + } catch (TimeoutException | InterruptedException | ExecutionException e) { + Slog.e(TAG, "Unable to share screenshot", e); + return; + } Intent actionIntent = intent.getParcelableExtra(EXTRA_ACTION_INTENT); if (intent.getBooleanExtra(EXTRA_CANCEL_NOTIFICATION, false)) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java index 75ef18545fdf..6c36ab95f923 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java @@ -488,6 +488,7 @@ public class NotificationMediaManager implements Dumpable { if (bmp != null) { artworkDrawable = new BitmapDrawable(mBackdropBack.getResources(), bmp); } + boolean hasMediaArtwork = artworkDrawable != null; boolean allowWhenShade = false; if (ENABLE_LOCKSCREEN_WALLPAPER && artworkDrawable == null) { Bitmap lockWallpaper = @@ -506,7 +507,7 @@ public class NotificationMediaManager implements Dumpable { boolean hideBecauseOccluded = shadeController != null && shadeController.isOccluded(); final boolean hasArtwork = artworkDrawable != null; - mColorExtractor.setHasBackdrop(hasArtwork); + mColorExtractor.setHasMediaArtwork(hasMediaArtwork); if (mScrimController != null) { mScrimController.setHasBackdrop(hasArtwork); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index fc2705f054e0..312ea473d9e6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -929,7 +929,6 @@ public class NotificationShelf extends ActivatableNotificationView implements public void setAnimationsEnabled(boolean enabled) { mAnimationsEnabled = enabled; - mCollapsedIcons.setAnimationsEnabled(enabled); if (!enabled) { // we need to wait with enabling the animations until the first frame has passed mShelfIcons.setAnimationsEnabled(false); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt index 5378f907e95a..8e6822770694 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt @@ -29,6 +29,7 @@ import android.graphics.drawable.Drawable import android.graphics.drawable.ColorDrawable import android.util.Log import android.view.Gravity +import android.view.View import android.view.ViewGroup.LayoutParams.MATCH_PARENT import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import android.view.Window @@ -86,13 +87,17 @@ class ChannelEditorDialogController @Inject constructor( internal val groupNameLookup = hashMapOf<String, CharSequence>() private val channelGroupList = mutableListOf<NotificationChannelGroup>() + /** + * Give the controller all of the information it needs to present the dialog + * for a given app. Does a bunch of querying of NoMan, but won't present anything yet + */ fun prepareDialogForApp( appName: String, packageName: String, uid: Int, channels: Set<NotificationChannel>, appIcon: Drawable, - onSettingsClickListener: NotificationInfo.OnSettingsClickListener + onSettingsClickListener: NotificationInfo.OnSettingsClickListener? ) { this.appName = appName this.packageName = packageName @@ -156,6 +161,13 @@ class ChannelEditorDialogController @Inject constructor( dialog.show() } + /** + * Close the dialog without saving. For external callers + */ + fun close() { + done() + } + private fun done() { resetState() dialog.dismiss() @@ -235,6 +247,11 @@ class ChannelEditorDialogController @Inject constructor( } } + @VisibleForTesting + fun launchSettings(sender: View) { + onSettingsClickListener?.onClick(sender, null, appUid!!) + } + private fun initDialog() { dialog = Dialog(context) @@ -257,7 +274,7 @@ class ChannelEditorDialogController @Inject constructor( } findViewById<TextView>(R.id.see_more_button)?.setOnClickListener { - onSettingsClickListener?.onClick(it, null, appUid!!) + launchSettings(it) done() } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorListView.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorListView.kt index 6fe14777e41f..6faf77ec60c7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorListView.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorListView.kt @@ -24,6 +24,7 @@ import android.content.Context import android.graphics.drawable.Drawable import android.text.TextUtils import android.transition.AutoTransition +import android.transition.Transition import android.transition.TransitionManager import android.util.AttributeSet import android.view.LayoutInflater @@ -62,6 +63,23 @@ class ChannelEditorListView(c: Context, attrs: AttributeSet) : LinearLayout(c, a val transition = AutoTransition() transition.duration = 200 + transition.addListener(object : Transition.TransitionListener { + override fun onTransitionEnd(p0: Transition?) { + notifySubtreeAccessibilityStateChangedIfNeeded() + } + + override fun onTransitionResume(p0: Transition?) { + } + + override fun onTransitionPause(p0: Transition?) { + } + + override fun onTransitionCancel(p0: Transition?) { + } + + override fun onTransitionStart(p0: Transition?) { + } + }) TransitionManager.beginDelayedTransition(this, transition) // Remove any rows diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java index fe890fb3b471..b5a8aadf651f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java @@ -41,12 +41,14 @@ import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto; import com.android.systemui.Dependency; import com.android.systemui.Dumpable; +import com.android.systemui.SysUiServiceProvider; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationLifetimeExtender; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.StatusBarState; +import com.android.systemui.statusbar.StatusBarStateControllerImpl; import com.android.systemui.statusbar.notification.NotificationActivityStarter; import com.android.systemui.statusbar.notification.VisualStabilityManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -97,6 +99,8 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx @VisibleForTesting protected String mKeyToRemoveOnGutsClosed; + private StatusBar mStatusBar; + @Inject public NotificationGutsManager( Context context, @@ -114,6 +118,7 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx mListContainer = listContainer; mCheckSaveListener = checkSave; mOnSettingsClickListener = onSettingsClick; + mStatusBar = SysUiServiceProvider.getComponent(mContext, StatusBar.class); } public void setNotificationActivityStarter( @@ -376,6 +381,34 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx int x, int y, NotificationMenuRowPlugin.MenuItem menuItem) { + if (menuItem.getGutsView() instanceof NotificationInfo) { + if (mStatusBarStateController instanceof StatusBarStateControllerImpl) { + ((StatusBarStateControllerImpl) mStatusBarStateController) + .setLeaveOpenOnKeyguardHide(true); + } + + Runnable r = () -> Dependency.get(Dependency.MAIN_HANDLER).post( + () -> openGutsInternal(view, x, y, menuItem)); + + mStatusBar.executeRunnableDismissingKeyguard( + r, + null /* cancelAction */, + false /* dismissShade */, + true /* afterKeyguardGone */, + true /* deferred */); + + return true; + } + return openGutsInternal(view, x, y, menuItem); + } + + @VisibleForTesting + boolean openGutsInternal( + View view, + int x, + int y, + NotificationMenuRowPlugin.MenuItem menuItem) { + if (!(view instanceof ExpandableNotificationRow)) { return false; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java index 7c6c556b5241..148d83b5ab5c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java @@ -118,6 +118,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G private int mStartingChannelImportance; private boolean mWasShownHighPriority; private boolean mPressedApply; + private boolean mPresentingChannelEditorDialog = false; /** * The last importance level chosen by the user. Null if the user has not chosen an importance @@ -447,11 +448,15 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G private OnClickListener getTurnOffNotificationsClickListener() { return ((View view) -> { - if (mChannelEditorDialogController != null) { + if (!mPresentingChannelEditorDialog && mChannelEditorDialogController != null) { + mPresentingChannelEditorDialog = true; + mChannelEditorDialogController.prepareDialogForApp(mAppName, mPackageName, mAppUid, mUniqueChannelsInRow, mPkgIcon, mOnSettingsClickListener); - mChannelEditorDialogController.setOnFinishListener( - () -> closeControls(this, false)); + mChannelEditorDialogController.setOnFinishListener(() -> { + mPresentingChannelEditorDialog = false; + closeControls(this, false); + }); mChannelEditorDialogController.show(); } }); @@ -772,6 +777,13 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G @Override public boolean handleCloseControls(boolean save, boolean force) { + if (mPresentingChannelEditorDialog && mChannelEditorDialogController != null) { + mPresentingChannelEditorDialog = false; + // No need for the finish listener because we're closing + mChannelEditorDialogController.setOnFinishListener(null); + mChannelEditorDialogController.close(); + } + // Save regardless of the importance so we can lock the importance field if the user wants // to keep getting notifications if (save) { 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 b53fe3a795fc..c21443128d13 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 @@ -20,7 +20,7 @@ import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME import static com.android.systemui.statusbar.notification.ActivityLaunchAnimator.ExpandAnimationParameters; import static com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm.ANCHOR_SCROLLING; import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_SWIPE; -import static com.android.systemui.statusbar.phone.NotificationIconAreaController.LOW_PRIORITY; +import static com.android.systemui.statusbar.phone.NotificationIconAreaController.HIGH_PRIORITY; import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT; import static java.lang.annotation.RetentionPolicy.SOURCE; @@ -187,7 +187,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private int mCurrentStackHeight = Integer.MAX_VALUE; private final Paint mBackgroundPaint = new Paint(); private final boolean mShouldDrawNotificationBackground; - private boolean mLowPriorityBeforeSpeedBump; + private boolean mHighPriorityBeforeSpeedBump; private final boolean mAllowLongPress; private boolean mDismissRtl; @@ -584,12 +584,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd TunerService tunerService = Dependency.get(TunerService.class); tunerService.addTunable((key, newValue) -> { - if (key.equals(LOW_PRIORITY)) { - mLowPriorityBeforeSpeedBump = "1".equals(newValue); + if (key.equals(HIGH_PRIORITY)) { + mHighPriorityBeforeSpeedBump = "1".equals(newValue); } else if (key.equals(Settings.Secure.NOTIFICATION_DISMISS_RTL)) { updateDismissRtlSetting("1".equals(newValue)); } - }, LOW_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL); + }, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL); mEntryManager.addNotificationEntryListener(new NotificationEntryListener() { @Override @@ -654,15 +654,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @Override @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void onThemeChanged() { - int which; - if (mStatusBarState == StatusBarState.KEYGUARD - || mStatusBarState == StatusBarState.SHADE_LOCKED) { - which = WallpaperManager.FLAG_LOCK; - } else { - which = WallpaperManager.FLAG_SYSTEM; - } - final boolean useDarkText = mColorExtractor.getColors(which, - true /* ignoreVisibility */).supportsDarkText(); + final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText(); updateDecorViews(useDarkText); updateFooter(); @@ -868,8 +860,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd int backgroundRectTop = top; int lastSectionBottom = mSections[0].getCurrentBounds().bottom + animationYOffset; - int previousLeft = left; - int previousRight = right; + int currentLeft = left; + int currentRight = right; boolean first = true; for (NotificationSection section : mSections) { if (section.getFirstVisibleChild() == null) { @@ -882,23 +874,23 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd // as separate roundrects, as the rounded corners right next to each other look // bad. if (sectionTop - lastSectionBottom > DISTANCE_BETWEEN_ADJACENT_SECTIONS_PX - || (previousLeft != ownLeft && !first)) { - canvas.drawRoundRect(ownLeft, + || ((currentLeft != ownLeft || currentRight != ownRight) && !first)) { + canvas.drawRoundRect(currentLeft, backgroundRectTop, - ownRight, + currentRight, lastSectionBottom, mCornerRadius, mCornerRadius, mBackgroundPaint); backgroundRectTop = sectionTop; } - previousLeft = ownLeft; - previousRight = ownRight; + currentLeft = ownLeft; + currentRight = ownRight; lastSectionBottom = section.getCurrentBounds().bottom + animationYOffset; first = false; } - canvas.drawRoundRect(previousLeft, + canvas.drawRoundRect(currentLeft, backgroundRectTop, - previousRight, + currentRight, lastSectionBottom, mCornerRadius, mCornerRadius, mBackgroundPaint); } @@ -3223,6 +3215,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private void updateNotificationAnimationStates() { boolean running = mAnimationsEnabled || hasPulsingNotifications(); mShelf.setAnimationsEnabled(running); + mIconAreaController.setAnimationsEnabled(running); int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View child = getChildAt(i); @@ -5764,10 +5757,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd ExpandableNotificationRow row = (ExpandableNotificationRow) view; currentIndex++; boolean beforeSpeedBump; - if (mLowPriorityBeforeSpeedBump) { - beforeSpeedBump = !row.getEntry().ambient; - } else { + if (mHighPriorityBeforeSpeedBump) { beforeSpeedBump = row.getEntry().isHighPriority(); + } else { + beforeSpeedBump = !row.getEntry().ambient; } if (beforeSpeedBump) { speedBumpIndex = currentIndex; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java index 61a394092761..3d0c9e88ac9e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java @@ -60,8 +60,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener, UnlockMethodCache.OnUnlockMethodChangedListener { - private static final int FP_DRAW_OFF_TIMEOUT = 800; - private static final int STATE_LOCKED = 0; private static final int STATE_LOCK_OPEN = 1; private static final int STATE_SCANNING_FACE = 2; @@ -77,8 +75,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange private int mLastState = 0; private boolean mTransientBiometricsError; - private boolean mScreenOn; - private boolean mLastScreenOn; private boolean mIsFaceUnlockState; private boolean mSimLocked; private int mDensity; @@ -105,7 +101,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange update(false /* force */); } }; - private final Runnable mDrawOffTimeout = () -> update(true /* forceUpdate */); private final DockManager.DockEventListener mDockEventListener = new DockManager.DockEventListener() { @Override @@ -122,18 +117,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() { @Override - public void onScreenTurnedOn() { - mScreenOn = true; - update(); - } - - @Override - public void onScreenTurnedOff() { - mScreenOn = false; - update(); - } - - @Override public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { boolean oldSimLocked = mSimLocked; @@ -246,7 +229,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange int state = getState(); mIsFaceUnlockState = state == STATE_SCANNING_FACE; if (state != mLastState || mLastDozing != mDozing || mLastPulsing != mPulsing - || mLastScreenOn != mScreenOn || mLastBouncerVisible != mBouncerVisible || force) { + || mLastBouncerVisible != mBouncerVisible || force) { int iconAnimRes = getAnimationResForTransition(mLastState, state, mLastPulsing, mPulsing, mLastDozing, mDozing, mBouncerVisible); boolean isAnim = iconAnimRes != -1; @@ -285,15 +268,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange } updateDarkTint(); - if (isAnim && !mLastScreenOn) { - removeCallbacks(mDrawOffTimeout); - postDelayed(mDrawOffTimeout, FP_DRAW_OFF_TIMEOUT); - } else { - removeCallbacks(mDrawOffTimeout); - } - mLastState = state; - mLastScreenOn = mScreenOn; mLastDozing = mDozing; mLastPulsing = mPulsing; mLastBouncerVisible = mBouncerVisible; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java index d94a33556a43..79976d0e104d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java @@ -136,6 +136,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback protected final AssistManager mAssistManager; private final MetricsLogger mMetricsLogger; private final DeviceProvisionedController mDeviceProvisionedController; + private final StatusBarStateController mStatusBarStateController; protected NavigationBarView mNavigationBarView = null; @@ -244,9 +245,11 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback public NavigationBarFragment(AccessibilityManagerWrapper accessibilityManagerWrapper, DeviceProvisionedController deviceProvisionedController, MetricsLogger metricsLogger, AssistManager assistManager, OverviewProxyService overviewProxyService, - NavigationModeController navigationModeController) { + NavigationModeController navigationModeController, + StatusBarStateController statusBarStateController) { mAccessibilityManagerWrapper = accessibilityManagerWrapper; mDeviceProvisionedController = deviceProvisionedController; + mStatusBarStateController = statusBarStateController; mMetricsLogger = metricsLogger; mAssistManager = assistManager; mAssistantAvailable = mAssistManager.getAssistInfoForUser(UserHandle.USER_CURRENT) != null; @@ -951,7 +954,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback public void touchAutoDim() { getBarTransitions().setAutoDim(false); mHandler.removeCallbacks(mAutoDim); - int state = Dependency.get(StatusBarStateController.class).getState(); + int state = mStatusBarStateController.getState(); if (state != StatusBarState.KEYGUARD && state != StatusBarState.SHADE_LOCKED) { mHandler.postDelayed(mAutoDim, AUTODIM_TIMEOUT_MS); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java index 7cd8f7b6687f..77eb469c4b29 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java @@ -24,6 +24,9 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVE import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY; +import android.app.Notification; +import android.app.NotificationManager; +import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; @@ -38,13 +41,16 @@ import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; import android.provider.Settings.Secure; +import android.text.TextUtils; import android.util.Log; import android.util.SparseBooleanArray; import com.android.systemui.Dumpable; +import com.android.systemui.R; import com.android.systemui.UiOffloadThread; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.statusbar.policy.DeviceProvisionedController; +import com.android.systemui.util.NotificationChannels; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -63,6 +69,9 @@ public class NavigationModeController implements Dumpable { private static final String TAG = NavigationModeController.class.getSimpleName(); private static final boolean DEBUG = false; + static final String SHARED_PREFERENCES_NAME = "navigation_mode_controller_preferences"; + static final String PREFS_SWITCHED_FROM_GESTURE_NAV_KEY = "switched_from_gesture_nav"; + public interface ModeChangedListener { void onNavigationModeChanged(int mode); } @@ -78,6 +87,8 @@ public class NavigationModeController implements Dumpable { private int mMode = NAV_BAR_MODE_3BUTTON; private ArrayList<ModeChangedListener> mListeners = new ArrayList<>(); + private String mLastDefaultLauncher; + private BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -92,7 +103,13 @@ public class NavigationModeController implements Dumpable { if (DEBUG) { Log.d(TAG, "ACTION_PREFERRED_ACTIVITY_CHANGED"); } - switchFromGestureNavModeIfNotSupportedByDefaultLauncher(); + final String launcher = getDefaultLauncherPackageName(mCurrentUserContext); + // Check if it is a default launcher change + if (!TextUtils.equals(mLastDefaultLauncher, launcher)) { + switchFromGestureNavModeIfNotSupportedByDefaultLauncher(); + showNotificationIfDefaultLauncherSupportsGestureNav(); + mLastDefaultLauncher = launcher; + } break; } } @@ -157,6 +174,8 @@ public class NavigationModeController implements Dumpable { IntentFilter preferredActivityFilter = new IntentFilter(ACTION_PREFERRED_ACTIVITY_CHANGED); mContext.registerReceiverAsUser(mReceiver, UserHandle.ALL, preferredActivityFilter, null, null); + // We are only interested in launcher changes, so keeping track of the current default. + mLastDefaultLauncher = getDefaultLauncherPackageName(mContext); updateCurrentInteractionMode(false /* notify */); switchFromGestureNavModeIfNotSupportedByDefaultLauncher(); @@ -287,6 +306,84 @@ public class NavigationModeController implements Dumpable { }); } + private void switchFromGestureNavModeIfNotSupportedByDefaultLauncher() { + if (getCurrentInteractionMode(mCurrentUserContext) != NAV_BAR_MODE_GESTURAL) { + return; + } + final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext); + if (supported == null || supported) { + return; + } + + setModeOverlay(NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT); + showNotification(mCurrentUserContext, R.string.notification_content_system_nav_changed); + mCurrentUserContext.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) + .edit().putBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, true).apply(); + } + + private void showNotificationIfDefaultLauncherSupportsGestureNav() { + boolean previouslySwitchedFromGestureNav = mCurrentUserContext + .getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) + .getBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false); + if (!previouslySwitchedFromGestureNav) { + return; + } + if (getCurrentInteractionMode(mCurrentUserContext) == NAV_BAR_MODE_GESTURAL) { + return; + } + final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext); + if (supported == null || !supported) { + return; + } + + showNotification(mCurrentUserContext, R.string.notification_content_gesture_nav_available); + mCurrentUserContext.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) + .edit().putBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false).apply(); + } + + /** + * Returns null if there is no default launcher set for the current user. Returns true if the + * current default launcher supports Gesture Navigation. Returns false otherwise. + */ + private Boolean isGestureNavSupportedByDefaultLauncher(Context context) { + final String defaultLauncherPackageName = getDefaultLauncherPackageName(context); + if (DEBUG) { + Log.d(TAG, "isGestureNavSupportedByDefaultLauncher:" + + " defaultLauncher=" + defaultLauncherPackageName + + " contextUser=" + context.getUserId()); + } + if (defaultLauncherPackageName == null) { + return null; + } + ComponentName recentsComponentName = ComponentName.unflattenFromString( + context.getString(com.android.internal.R.string.config_recentsComponentName)); + return recentsComponentName.getPackageName().equals(defaultLauncherPackageName); + } + + private String getDefaultLauncherPackageName(Context context) { + final ComponentName cn = context.getPackageManager().getHomeActivities(new ArrayList<>()); + if (cn == null) { + return null; + } + return cn.getPackageName(); + } + + private void showNotification(Context context, int resId) { + final CharSequence message = context.getResources().getString(resId); + if (DEBUG) { + Log.d(TAG, "showNotification: message=" + message); + } + + final Notification.Builder builder = + new Notification.Builder(mContext, NotificationChannels.ALERTS) + .setContentText(message) + .setStyle(new Notification.BigTextStyle()) + .setSmallIcon(R.drawable.ic_info) + .setAutoCancel(true) + .setContentIntent(PendingIntent.getActivity(context, 0, new Intent(), 0)); + context.getSystemService(NotificationManager.class).notify(TAG, 0, builder.build()); + } + @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("NavigationModeController:"); @@ -299,6 +396,12 @@ public class NavigationModeController implements Dumpable { } pw.println(" defaultOverlays=" + defaultOverlays); dumpAssetPaths(mCurrentUserContext); + + pw.println(" defaultLauncher=" + mLastDefaultLauncher); + boolean previouslySwitchedFromGestureNav = mCurrentUserContext + .getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) + .getBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false); + pw.println(" previouslySwitchedFromGestureNav=" + previouslySwitchedFromGestureNav); } private void dumpAssetPaths(Context context) { @@ -308,27 +411,4 @@ public class NavigationModeController implements Dumpable { Log.d(TAG, " " + a.getAssetPath()); } } - - private void switchFromGestureNavModeIfNotSupportedByDefaultLauncher() { - if (getCurrentInteractionMode(mCurrentUserContext) == NAV_BAR_MODE_GESTURAL - && !isGestureNavSupportedByDefaultLauncher(mCurrentUserContext)) { - setModeOverlay(NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT); - } - } - - private boolean isGestureNavSupportedByDefaultLauncher(Context context) { - final ComponentName cn = context.getPackageManager().getHomeActivities(new ArrayList<>()); - if (cn == null) { - // There is no default home app set for the current user, don't make any changes yet. - return true; - } - if (DEBUG) { - Log.d(TAG, "isGestureNavSupportedByDefaultLauncher: launcher=" + cn.getPackageName() - + " contextUser=" + context.getUserId()); - } - - ComponentName recentsComponentName = ComponentName.unflattenFromString(context.getString( - com.android.internal.R.string.config_recentsComponentName)); - return recentsComponentName.getPackageName().equals(cn.getPackageName()); - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java index e8ca3eef24de..98505cf38afa 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java @@ -24,6 +24,7 @@ import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.StatusBarIconView; +import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -40,7 +41,7 @@ import java.util.function.Function; public class NotificationIconAreaController implements DarkReceiver, StatusBarStateController.StateListener { - public static final String LOW_PRIORITY = "low_priority"; + public static final String HIGH_PRIORITY = "high_priority"; private final ContrastColorUtil mContrastColorUtil; private final NotificationEntryManager mEntryManager; @@ -78,6 +79,7 @@ public class NotificationIconAreaController implements DarkReceiver, private Context mContext; private boolean mFullyDark; private boolean mShowLowPriority = true; + private boolean mAnimationsEnabled; /** * Ratio representing being awake or in ambient mode, where 1 is dark and 0 awake. @@ -283,6 +285,25 @@ public class NotificationIconAreaController implements DarkReceiver, false /* hide centered icon */); } + /** + * If icons of the status bar should animate when they are added or removed. + */ + public void setAnimationsEnabled(boolean enabled) { + mAnimationsEnabled = enabled; + updateAnimations(); + } + + @Override + public void onStateChanged(int newState) { + updateAnimations(); + } + + private void updateAnimations() { + boolean inShade = mStatusBarStateController.getState() == StatusBarState.SHADE; + mCenteredIcon.setAnimationsEnabled(mAnimationsEnabled && inShade); + mNotificationIcons.setAnimationsEnabled(mAnimationsEnabled && inShade); + } + @VisibleForTesting boolean shouldShouldLowPriorityIcons() { return mShowLowPriority; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java index 009afca5b034..f458618a43f2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java @@ -315,7 +315,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { @Override public void onViewRemoved(View child) { super.onViewRemoved(child); - if (child instanceof StatusBarIconView) { + if (mAnimationsEnabled && child instanceof StatusBarIconView) { boolean isReplacingIcon = isReplacingIcon(child); final StatusBarIconView icon = (StatusBarIconView) child; if (icon.getVisibleState() != StatusBarIconView.STATE_HIDDEN diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 5fff054b3bc2..80fbda0809ba 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3222,8 +3222,7 @@ public class StatusBar extends SystemUI implements DemoMode, // Lock wallpaper defines the color of the majority of the views, hence we'll use it // to set our default theme. - final boolean lockDarkText = mColorExtractor.getColors(WallpaperManager.FLAG_LOCK, true - /* ignoreVisibility */).supportsDarkText(); + final boolean lockDarkText = mColorExtractor.getNeutralColors().supportsDarkText(); final int themeResId = lockDarkText ? R.style.Theme_SystemUI_Light : R.style.Theme_SystemUI; if (mContext.getThemeResId() != themeResId) { mContext.setTheme(themeResId); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java index 891bb35127ee..c73ed60f161d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java @@ -25,7 +25,6 @@ import static com.android.systemui.statusbar.NotificationRemoteInputManager.ENAB import android.app.ActivityManager; import android.app.IActivityManager; -import android.app.WallpaperManager; import android.content.Context; import android.content.pm.ActivityInfo; import android.content.res.Resources; @@ -556,17 +555,7 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat return; } - StatusBarStateController state = Dependency.get(StatusBarStateController.class); - int which; - if (state.getState() == StatusBarState.KEYGUARD - || state.getState() == StatusBarState.SHADE_LOCKED) { - which = WallpaperManager.FLAG_LOCK; - } else { - which = WallpaperManager.FLAG_SYSTEM; - } - final boolean useDarkText = mColorExtractor.getColors(which, - true /* ignoreVisibility */).supportsDarkText(); - + final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText(); // Make sure we have the correct navbar/statusbar colors. setKeyguardDark(useDarkText); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java b/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java index 9c2c82257173..41747f407546 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java +++ b/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java @@ -40,6 +40,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mock; import org.mockito.MockitoAnnotations; /** @@ -57,6 +58,8 @@ public class SysuiColorExtractorTests extends SysuiTestCase { ColorExtractor.TYPE_DARK, ColorExtractor.TYPE_EXTRA_DARK}; + @Mock + private WallpaperManager mWallpaperManager; private ColorExtractor.GradientColors mColors; private SysuiColorExtractor mColorExtractor; @@ -72,32 +75,15 @@ public class SysuiColorExtractorTests extends SysuiTestCase { outGradientColorsNormal.set(mColors); outGradientColorsDark.set(mColors); outGradientColorsExtraDark.set(mColors); - }, mock(ConfigurationController.class), false); + }, mock(ConfigurationController.class), mWallpaperManager, true /* immediately */); } @Test - public void getColors_usesGreyIfWallpaperNotVisible() { - simulateEvent(mColorExtractor); - mColorExtractor.setWallpaperVisible(false); - - ColorExtractor.GradientColors fallbackColors = mColorExtractor.getNeutralColors(); - - for (int type : sTypes) { - assertEquals("Not using fallback!", - mColorExtractor.getColors(WallpaperManager.FLAG_SYSTEM, type), fallbackColors); - assertNotEquals("Wallpaper visibility event should not affect lock wallpaper.", - mColorExtractor.getColors(WallpaperManager.FLAG_LOCK, type), fallbackColors); - } - } - - @Test - public void getColors_doesntUseFallbackIfVisible() { + public void getColors() { mColors.setMainColor(Color.RED); mColors.setSecondaryColor(Color.RED); simulateEvent(mColorExtractor); - mColorExtractor.setWallpaperVisible(true); - for (int which : sWhich) { for (int type : sTypes) { assertEquals("Not using extracted colors!", @@ -109,8 +95,7 @@ public class SysuiColorExtractorTests extends SysuiTestCase { @Test public void getColors_fallbackWhenMediaIsVisible() { simulateEvent(mColorExtractor); - mColorExtractor.setWallpaperVisible(true); - mColorExtractor.setHasBackdrop(true); + mColorExtractor.setHasMediaArtwork(true); ColorExtractor.GradientColors fallbackColors = mColorExtractor.getNeutralColors(); @@ -127,7 +112,7 @@ public class SysuiColorExtractorTests extends SysuiTestCase { Tonal tonal = mock(Tonal.class); ConfigurationController configurationController = mock(ConfigurationController.class); SysuiColorExtractor sysuiColorExtractor = new SysuiColorExtractor(getContext(), - tonal, configurationController, false /* registerVisibility */); + tonal, configurationController, mWallpaperManager, true /* immediately */); verify(configurationController).addCallback(eq(sysuiColorExtractor)); reset(tonal); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogControllerTest.kt index 76326303ff96..8b81a7a29f84 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogControllerTest.kt @@ -109,7 +109,7 @@ class ChannelEditorDialogControllerTest : SysuiTestCase() { } @Test - fun testPrepareDialogForApp_retrievesUpto4Channels() { + fun testPrepareDialogForApp_retrievesUpTo4Channels() { val channel3 = NotificationChannel("test_channel_3", "Test channel 3", IMPORTANCE_DEFAULT) val channel4 = NotificationChannel("test_channel_4", "Test channel 4", IMPORTANCE_DEFAULT) @@ -169,6 +169,16 @@ class ChannelEditorDialogControllerTest : SysuiTestCase() { eq(TEST_PACKAGE_NAME), eq(TEST_UID), eq(true)) } + @Test + fun testSettingsClickListenerNull_noCrash() { + group.channels = listOf(channel1, channel2) + controller.prepareDialogForApp(TEST_APP_NAME, TEST_PACKAGE_NAME, TEST_UID, + setOf(channel1, channel2), appIcon, null) + + // Pass in any old view, it should never actually be used + controller.launchSettings(View(context)) + } + private val clickListener = object : NotificationInfo.OnSettingsClickListener { override fun onClick(v: View, c: NotificationChannel, appUid: Int) { } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java index 025296d14da4..06ff0478a804 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java @@ -101,7 +101,7 @@ public class NotificationContentInflaterTest extends SysuiTestCase { mNotificationInflater.setUsesIncreasedHeadsUpHeight(true); Notification.Builder builder = spy(mBuilder); mNotificationInflater.inflateNotificationViews( - false /* inflateSynchronously */, + true /* inflateSynchronously */, FLAG_CONTENT_VIEW_ALL, builder, mContext); @@ -113,7 +113,7 @@ public class NotificationContentInflaterTest extends SysuiTestCase { mNotificationInflater.setUsesIncreasedHeight(true); Notification.Builder builder = spy(mBuilder); mNotificationInflater.inflateNotificationViews( - false /* inflateSynchronously */, + true /* inflateSynchronously */, FLAG_CONTENT_VIEW_ALL, builder, mContext); @@ -161,6 +161,7 @@ public class NotificationContentInflaterTest extends SysuiTestCase { @Test public void testRemovedNotInflated() throws Exception { mRow.setRemoved(); + mNotificationInflater.setInflateSynchronously(true); mNotificationInflater.inflateNotificationViews(); Assert.assertNull(mRow.getEntry().getRunningTask()); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java index ef13b61162c5..795948470295 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java @@ -67,6 +67,7 @@ import com.android.systemui.statusbar.notification.VisualStabilityManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.NotificationGutsManager.OnSettingsClickListener; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; +import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.util.Assert; @@ -105,6 +106,7 @@ public class NotificationGutsManagerTest extends SysuiTestCase { @Mock private NotificationInfo.CheckSaveListener mCheckSaveListener; @Mock private OnSettingsClickListener mOnSettingsClickListener; @Mock private DeviceProvisionedController mDeviceProvisionedController; + @Mock private StatusBar mStatusBar; @Before public void setUp() { @@ -115,7 +117,7 @@ public class NotificationGutsManagerTest extends SysuiTestCase { mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger); mDependency.injectTestDependency(VisualStabilityManager.class, mVisualStabilityManager); mHandler = Handler.createAsync(mTestableLooper.getLooper()); - + mContext.putComponent(StatusBar.class, mStatusBar); mHelper = new NotificationTestHelper(mContext); mGutsManager = new NotificationGutsManager(mContext, mVisualStabilityManager); @@ -150,7 +152,7 @@ public class NotificationGutsManagerTest extends SysuiTestCase { when(row.getWindowToken()).thenReturn(new Binder()); when(row.getGuts()).thenReturn(guts); - assertTrue(mGutsManager.openGuts(row, 0, 0, menuItem)); + assertTrue(mGutsManager.openGutsInternal(row, 0, 0, menuItem)); assertEquals(View.INVISIBLE, guts.getVisibility()); mTestableLooper.processAllMessages(); verify(guts).openControls( @@ -198,7 +200,7 @@ public class NotificationGutsManagerTest extends SysuiTestCase { when(entry.getRow()).thenReturn(row); when(entry.getGuts()).thenReturn(guts); - assertTrue(mGutsManager.openGuts(row, 0, 0, menuItem)); + assertTrue(mGutsManager.openGutsInternal(row, 0, 0, menuItem)); mTestableLooper.processAllMessages(); verify(guts).openControls( eq(true), diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java index 56265d08c131..d42598209545 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java @@ -70,6 +70,7 @@ import com.android.systemui.statusbar.notification.row.FooterView; import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.NotificationGroupManager; +import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; @@ -110,6 +111,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Mock private NotificationData mNotificationData; @Mock private NotificationRemoteInputManager mRemoteInputManager; @Mock private RemoteInputController mRemoteInputController; + @Mock private NotificationIconAreaController mNotificationIconAreaController; @Mock private MetricsLogger mMetricsLogger; @Mock private NotificationRoundnessManager mNotificationRoundnessManager; private TestableNotificationEntryManager mEntryManager; @@ -162,6 +164,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { mStackScroller.setHeadsUpManager(mHeadsUpManager); mStackScroller.setGroupManager(mGroupManager); mStackScroller.setEmptyShadeView(mEmptyShadeView); + mStackScroller.setIconAreaController(mNotificationIconAreaController); // Stub out functionality that isn't necessary to test. doNothing().when(mBar) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java index faf5a9706735..3da9a4bdf759 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java @@ -56,6 +56,7 @@ import com.android.systemui.Dependency; import com.android.systemui.SysuiBaseFragmentTest; import com.android.systemui.SysuiTestableContext; import com.android.systemui.assist.AssistManager; +import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.recents.Recents; import com.android.systemui.stackdivider.Divider; @@ -215,7 +216,8 @@ public class NavigationBarFragmentTest extends SysuiBaseFragmentTest { new MetricsLogger(), mock(AssistManager.class), mOverviewProxyService, - mock(NavigationModeController.class)); + mock(NavigationModeController.class), + mock(StatusBarStateController.class)); } private class HostCallbacksForExternalDisplay extends diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index af9b0e2aa7b1..3764ca4b7906 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -569,12 +569,13 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState @GuardedBy("mLock") private void requestNewFillResponseLocked(@NonNull ViewState viewState, int newState, int flags) { - if (mForAugmentedAutofillOnly) { + if (mForAugmentedAutofillOnly || mRemoteFillService == null) { if (sVerbose) { Slog.v(TAG, "requestNewFillResponse(): triggering augmented autofill instead " + "(mForAugmentedAutofillOnly=" + mForAugmentedAutofillOnly + ", flags=" + flags + ")"); } + mForAugmentedAutofillOnly = true; triggerAugmentedAutofillLocked(); return; } diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java index b9679133b739..e2a874ea0f26 100644 --- a/services/core/java/com/android/server/AlarmManagerService.java +++ b/services/core/java/com/android/server/AlarmManagerService.java @@ -1767,8 +1767,7 @@ class AlarmManagerService extends SystemService { + ", callingPackage: " + callingPackage; mHandler.obtainMessage(AlarmHandler.UNREGISTER_CANCEL_LISTENER, operation).sendToTarget(); - // STOPSHIP (b/128866264): Just to catch breakages. Remove before final release. - Slog.wtf(TAG, errorMsg); + Slog.w(TAG, errorMsg); throw new IllegalStateException(errorMsg); } setImplLocked(type, triggerAtTime, triggerElapsed, windowLength, maxElapsed, diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java index 78f0603c5359..8a639c543366 100644 --- a/services/core/java/com/android/server/LocationManagerService.java +++ b/services/core/java/com/android/server/LocationManagerService.java @@ -2361,7 +2361,7 @@ public class LocationManagerService extends ILocationManager.Stub { mRealRequest, mReceiver.isListener(), mReceiver.isPendingIntent(), - /* radius= */ 0, + /* geofence= */ null, mActivityManager.getPackageImportance(packageName)); // remove from mRecordsByProvider @@ -2541,7 +2541,7 @@ public class LocationManagerService extends ILocationManager.Stub { LocationStatsEnums.USAGE_STARTED, LocationStatsEnums.API_REQUEST_LOCATION_UPDATES, packageName, request, listener != null, intent != null, - /* radius= */ 0, + /* geofence= */ null, mActivityManager.getPackageImportance(packageName)); Receiver receiver; @@ -2844,7 +2844,7 @@ public class LocationManagerService extends ILocationManager.Stub { request, /* hasListener= */ false, intent != null, - geofence.getRadius(), + geofence, mActivityManager.getPackageImportance(packageName)); } @@ -2876,7 +2876,7 @@ public class LocationManagerService extends ILocationManager.Stub { /* LocationRequest= */ null, /* hasListener= */ false, intent != null, - geofence.getRadius(), + geofence, mActivityManager.getPackageImportance(packageName)); } mGeofenceManager.removeFence(geofence, intent); @@ -2973,7 +2973,7 @@ public class LocationManagerService extends ILocationManager.Stub { /* LocationRequest= */ null, /* hasListener= */ true, /* hasIntent= */ false, - /* radius */ 0, + /* geofence= */ null, mActivityManager.getPackageImportance(packageName)); } if (isThrottlingExemptLocked(callerIdentity) @@ -3014,7 +3014,7 @@ public class LocationManagerService extends ILocationManager.Stub { /* LocationRequest= */ null, /* hasListener= */ true, /* hasIntent= */ false, - /* radius= */ 0, + /* geofence= */ null, mActivityManager.getPackageImportance( linkedListener.mCallerIdentity.mPackageName)); } diff --git a/services/core/java/com/android/server/LocationUsageLogger.java b/services/core/java/com/android/server/LocationUsageLogger.java index c5030351f69d..4ca74bf3aa91 100644 --- a/services/core/java/com/android/server/LocationUsageLogger.java +++ b/services/core/java/com/android/server/LocationUsageLogger.java @@ -17,6 +17,7 @@ package com.android.server; import android.app.ActivityManager; +import android.location.Geofence; import android.location.LocationManager; import android.location.LocationRequest; import android.os.SystemClock; @@ -180,13 +181,14 @@ class LocationUsageLogger { public void logLocationApiUsage(int usageType, int apiInUse, String packageName, LocationRequest locationRequest, boolean hasListener, boolean hasIntent, - float radius, int activityImportance) { + Geofence geofence, int activityImportance) { try { if (!checkApiUsageLogCap()) { return; } boolean isLocationRequestNull = locationRequest == null; + boolean isGeofenceNull = geofence == null; if (D) { Log.d(TAG, "log API Usage to statsd. usageType: " + usageType + ", apiInUse: " + apiInUse + ", packageName: " + (packageName == null ? "" : packageName) @@ -194,7 +196,8 @@ class LocationUsageLogger { + (isLocationRequestNull ? "" : locationRequest.toString()) + ", hasListener: " + hasListener + ", hasIntent: " + hasIntent - + ", radius: " + radius + + ", geofence: " + + (isGeofenceNull ? "" : geofence.toString()) + ", importance: " + activityImportance); } @@ -219,7 +222,9 @@ class LocationUsageLogger { ? LocationStatsEnums.EXPIRATION_UNKNOWN : getBucketizedExpireIn(locationRequest.getExpireAt()), getCallbackType(apiInUse, hasListener, hasIntent), - bucketizeRadiusToStatsdEnum(radius), + isGeofenceNull + ? LocationStatsEnums.RADIUS_UNKNOWN + : bucketizeRadiusToStatsdEnum(geofence.getRadius()), categorizeActivityImportance(activityImportance)); } catch (Exception e) { // Swallow exceptions to avoid crashing LMS. diff --git a/services/core/java/com/android/server/VibratorService.java b/services/core/java/com/android/server/VibratorService.java index 0d19a67e86e9..6eb9f0c7a6bc 100644 --- a/services/core/java/com/android/server/VibratorService.java +++ b/services/core/java/com/android/server/VibratorService.java @@ -620,7 +620,6 @@ public class VibratorService extends IVibratorService.Stub linkVibration(vib); long ident = Binder.clearCallingIdentity(); try { - doCancelVibrateLocked(); startVibrationLocked(vib); addToPreviousVibrationsLocked(vib); @@ -1437,6 +1436,8 @@ public class VibratorService extends IVibratorService.Stub } final class ExternalVibratorService extends IExternalVibratorService.Stub { + ExternalVibrationDeathRecipient mCurrentExternalDeathRecipient; + @Override public int onExternalVibrationStart(ExternalVibration vib) { if (!mSupportsExternalControl) { @@ -1470,6 +1471,8 @@ public class VibratorService extends IVibratorService.Stub // Note that this doesn't support multiple concurrent external controls, as we // would need to mute the old one still if it came from a different controller. mCurrentExternalVibration = vib; + mCurrentExternalDeathRecipient = new ExternalVibrationDeathRecipient(); + mCurrentExternalVibration.linkToDeath(mCurrentExternalDeathRecipient); if (mPreviousExternalVibrations.size() > mPreviousVibrationsLimit) { mPreviousExternalVibrations.removeFirst(); } @@ -1514,6 +1517,8 @@ public class VibratorService extends IVibratorService.Stub public void onExternalVibrationStop(ExternalVibration vib) { synchronized (mLock) { if (vib.equals(mCurrentExternalVibration)) { + mCurrentExternalVibration.unlinkToDeath(mCurrentExternalDeathRecipient); + mCurrentExternalDeathRecipient = null; mCurrentExternalVibration = null; setVibratorUnderExternalControl(false); if (DEBUG) { @@ -1522,6 +1527,14 @@ public class VibratorService extends IVibratorService.Stub } } } + + private class ExternalVibrationDeathRecipient implements IBinder.DeathRecipient { + public void binderDied() { + synchronized (mLock) { + onExternalVibrationStop(mCurrentExternalVibration); + } + } + } } private final class VibratorShellCommand extends ShellCommand { diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index c5fc5c89cce1..f14a3fdda8db 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -547,6 +547,7 @@ public class ActivityManagerService extends IActivityManager.Stub private static final int MAX_BUGREPORT_TITLE_SIZE = 50; private static final int NATIVE_DUMP_TIMEOUT_MS = 2000; // 2 seconds; + private static final int JAVA_DUMP_MINIMUM_SIZE = 100; // 100 bytes. OomAdjuster mOomAdjuster; final LowMemDetector mLowMemDetector; @@ -3805,9 +3806,28 @@ public class ActivityManagerService extends IActivityManager.Stub */ private static long dumpJavaTracesTombstoned(int pid, String fileName, long timeoutMs) { final long timeStart = SystemClock.elapsedRealtime(); - if (!Debug.dumpJavaBacktraceToFileTimeout(pid, fileName, (int) (timeoutMs / 1000))) { - Debug.dumpNativeBacktraceToFileTimeout(pid, fileName, - (NATIVE_DUMP_TIMEOUT_MS / 1000)); + boolean javaSuccess = Debug.dumpJavaBacktraceToFileTimeout(pid, fileName, + (int) (timeoutMs / 1000)); + if (javaSuccess) { + // Check that something is in the file, actually. Try-catch should not be necessary, + // but better safe than sorry. + try { + long size = new File(fileName).length(); + if (size < JAVA_DUMP_MINIMUM_SIZE) { + Slog.w(TAG, "Successfully created Java ANR file is empty!"); + javaSuccess = false; + } + } catch (Exception e) { + Slog.w(TAG, "Unable to get ANR file size", e); + javaSuccess = false; + } + } + if (!javaSuccess) { + Slog.w(TAG, "Dumping Java threads failed, initiating native stack dump."); + if (!Debug.dumpNativeBacktraceToFileTimeout(pid, fileName, + (NATIVE_DUMP_TIMEOUT_MS / 1000))) { + Slog.w(TAG, "Native stack dump failed!"); + } } return SystemClock.elapsedRealtime() - timeStart; @@ -5375,34 +5395,13 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public void registerIntentSenderCancelListener(IIntentSender sender, IResultReceiver receiver) { - if (!(sender instanceof PendingIntentRecord)) { - return; - } - boolean isCancelled; - synchronized(this) { - PendingIntentRecord pendingIntent = (PendingIntentRecord) sender; - isCancelled = pendingIntent.canceled; - if (!isCancelled) { - pendingIntent.registerCancelListenerLocked(receiver); - } - } - if (isCancelled) { - try { - receiver.send(Activity.RESULT_CANCELED, null); - } catch (RemoteException e) { - } - } + mPendingIntentController.registerIntentSenderCancelListener(sender, receiver); } @Override public void unregisterIntentSenderCancelListener(IIntentSender sender, IResultReceiver receiver) { - if (!(sender instanceof PendingIntentRecord)) { - return; - } - synchronized(this) { - ((PendingIntentRecord)sender).unregisterCancelListenerLocked(receiver); - } + mPendingIntentController.unregisterIntentSenderCancelListener(sender, receiver); } @Override @@ -17679,13 +17678,8 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public void setPendingIntentWhitelistDuration(IIntentSender target, IBinder whitelistToken, long duration) { - if (!(target instanceof PendingIntentRecord)) { - Slog.w(TAG, "markAsSentFromNotification(): not a PendingIntentRecord: " + target); - return; - } - synchronized (ActivityManagerService.this) { - ((PendingIntentRecord) target).setWhitelistDurationLocked(whitelistToken, duration); - } + mPendingIntentController.setPendingIntentWhitelistDuration(target, whitelistToken, + duration); } @Override diff --git a/services/core/java/com/android/server/am/BroadcastDispatcher.java b/services/core/java/com/android/server/am/BroadcastDispatcher.java index d029482ac528..f8a3d1eefd50 100644 --- a/services/core/java/com/android/server/am/BroadcastDispatcher.java +++ b/services/core/java/com/android/server/am/BroadcastDispatcher.java @@ -725,6 +725,14 @@ public class BroadcastDispatcher { final Dumper dumper = new Dumper(pw, queueName, dumpPackage, sdf); boolean printed = false; + dumper.setHeading("Currently in flight"); + dumper.setLabel("In-Flight Ordered Broadcast"); + if (mCurrentBroadcast != null) { + dumper.dump(mCurrentBroadcast); + } else { + pw.println(" (null)"); + } + dumper.setHeading("Active ordered broadcasts"); dumper.setLabel("Active Ordered Broadcast"); for (Deferrals d : mAlarmBroadcasts) { diff --git a/services/core/java/com/android/server/am/PendingIntentController.java b/services/core/java/com/android/server/am/PendingIntentController.java index a5d47386afb5..d75591cc7432 100644 --- a/services/core/java/com/android/server/am/PendingIntentController.java +++ b/services/core/java/com/android/server/am/PendingIntentController.java @@ -17,6 +17,7 @@ package com.android.server.am; import static android.content.pm.PackageManager.MATCH_DEBUG_TRIAGED_MISSING; + import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_MU; import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_MU; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; @@ -39,6 +40,7 @@ import android.os.RemoteException; import android.os.UserHandle; import android.util.ArrayMap; import android.util.Slog; + import com.android.internal.os.IResultReceiver; import com.android.internal.util.function.pooled.PooledLambda; import com.android.server.LocalServices; @@ -242,6 +244,47 @@ public class PendingIntentController { } } + void registerIntentSenderCancelListener(IIntentSender sender, IResultReceiver receiver) { + if (!(sender instanceof PendingIntentRecord)) { + return; + } + boolean isCancelled; + synchronized (mLock) { + PendingIntentRecord pendingIntent = (PendingIntentRecord) sender; + isCancelled = pendingIntent.canceled; + if (!isCancelled) { + pendingIntent.registerCancelListenerLocked(receiver); + } + } + if (isCancelled) { + try { + receiver.send(Activity.RESULT_CANCELED, null); + } catch (RemoteException e) { + } + } + } + + void unregisterIntentSenderCancelListener(IIntentSender sender, + IResultReceiver receiver) { + if (!(sender instanceof PendingIntentRecord)) { + return; + } + synchronized (mLock) { + ((PendingIntentRecord) sender).unregisterCancelListenerLocked(receiver); + } + } + + void setPendingIntentWhitelistDuration(IIntentSender target, IBinder whitelistToken, + long duration) { + if (!(target instanceof PendingIntentRecord)) { + Slog.w(TAG, "markAsSentFromNotification(): not a PendingIntentRecord: " + target); + return; + } + synchronized (mLock) { + ((PendingIntentRecord) target).setWhitelistDurationLocked(whitelistToken, duration); + } + } + private void makeIntentSenderCanceled(PendingIntentRecord rec) { rec.canceled = true; final RemoteCallbackList<IResultReceiver> callbacks = rec.detachCancelListenersLocked(); diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java index 2399d0525cc4..b311233694ce 100644 --- a/services/core/java/com/android/server/am/UserController.java +++ b/services/core/java/com/android/server/am/UserController.java @@ -559,7 +559,7 @@ class UserController implements Handler.Callback { // Spin up app widgets prior to boot-complete, so they can be ready promptly mInjector.startUserWidgets(userId); - Slog.i(TAG, "Sending BOOT_COMPLETE user #" + userId); + Slog.i(TAG, "Posting BOOT_COMPLETED user #" + userId); // Do not report secondary users, runtime restarts or first boot/upgrade if (userId == UserHandle.USER_SYSTEM && !mInjector.isRuntimeRestarted() && !mInjector.isFirstBootOrUpgrade()) { @@ -572,18 +572,26 @@ class UserController implements Handler.Callback { bootIntent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND | Intent.FLAG_RECEIVER_OFFLOAD); - mInjector.broadcastIntent(bootIntent, null, new IIntentReceiver.Stub() { - @Override - public void performReceive(Intent intent, int resultCode, String data, - Bundle extras, boolean ordered, boolean sticky, int sendingUser) - throws RemoteException { - Slog.i(UserController.TAG, "Finished processing BOOT_COMPLETED for u" + userId); - mBootCompleted = true; - } - }, 0, null, null, - new String[]{android.Manifest.permission.RECEIVE_BOOT_COMPLETED}, - AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID, - Binder.getCallingUid(), Binder.getCallingPid(), userId); + // Widget broadcasts are outbound via FgThread, so to guarantee sequencing + // we also send the boot_completed broadcast from that thread. + final int callingUid = Binder.getCallingUid(); + final int callingPid = Binder.getCallingPid(); + FgThread.getHandler().post(() -> { + mInjector.broadcastIntent(bootIntent, null, + new IIntentReceiver.Stub() { + @Override + public void performReceive(Intent intent, int resultCode, String data, + Bundle extras, boolean ordered, boolean sticky, int sendingUser) + throws RemoteException { + Slog.i(UserController.TAG, "Finished processing BOOT_COMPLETED for u" + + userId); + mBootCompleted = true; + } + }, 0, null, null, + new String[]{android.Manifest.permission.RECEIVE_BOOT_COMPLETED}, + AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID, + callingUid, callingPid, userId); + }); } int restartUser(final int userId, final boolean foreground) { diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index e43c548eb66a..5ae51138f721 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -1016,6 +1016,7 @@ public class AudioService extends IAudioService.Stub sendEncodedSurroundMode(mContentResolver, "onAudioServerDied"); sendEnabledSurroundFormats(mContentResolver, true); updateAssistantUId(true); + updateRttEanbled(mContentResolver); } synchronized (mAccessibilityServiceUidsLock) { AudioSystem.setA11yServicesUids(mAccessibilityServiceUids); @@ -1480,6 +1481,12 @@ public class AudioService extends IAudioService.Stub } } + private void updateRttEanbled(ContentResolver cr) { + final boolean rttEnabled = Settings.Secure.getIntForUser(cr, + Settings.Secure.RTT_CALLING_MODE, 0, UserHandle.USER_CURRENT) != 0; + AudioSystem.setRttEnabled(rttEnabled); + } + private void readPersistedSettings() { final ContentResolver cr = mContentResolver; @@ -1524,6 +1531,7 @@ public class AudioService extends IAudioService.Stub sendEncodedSurroundMode(cr, "readPersistedSettings"); sendEnabledSurroundFormats(cr, true); updateAssistantUId(true); + updateRttEanbled(cr); } mMuteAffectedStreams = System.getIntForUser(cr, @@ -5502,6 +5510,8 @@ public class AudioService extends IAudioService.Stub mContentResolver.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.VOICE_INTERACTION_SERVICE), false, this); + mContentResolver.registerContentObserver(Settings.Secure.getUriFor( + Settings.Secure.RTT_CALLING_MODE), false, this); } @Override @@ -5525,6 +5535,7 @@ public class AudioService extends IAudioService.Stub updateEncodedSurroundOutput(); sendEnabledSurroundFormats(mContentResolver, mSurroundModeChanged); updateAssistantUId(false); + updateRttEanbled(mContentResolver); } } diff --git a/services/core/java/com/android/server/display/AutomaticBrightnessController.java b/services/core/java/com/android/server/display/AutomaticBrightnessController.java index 6d7dff5736fa..31632dc007a5 100644 --- a/services/core/java/com/android/server/display/AutomaticBrightnessController.java +++ b/services/core/java/com/android/server/display/AutomaticBrightnessController.java @@ -322,7 +322,7 @@ class AutomaticBrightnessController { } changed |= setLightSensorEnabled(enable && !dozing); if (changed) { - updateAutoBrightness(false /*sendUpdate*/); + updateAutoBrightness(false /*sendUpdate*/, userInitiatedChange); } } @@ -667,7 +667,7 @@ class AutomaticBrightnessController { "mAmbientLightRingBuffer=" + mAmbientLightRingBuffer + ", " + "mAmbientLux=" + mAmbientLux); } - updateAutoBrightness(true); + updateAutoBrightness(true /* sendUpdate */, false /* isManuallySet */); } long nextBrightenTransition = nextAmbientLightBrighteningTransition(time); @@ -697,7 +697,7 @@ class AutomaticBrightnessController { + "mAmbientLightRingBuffer=" + mAmbientLightRingBuffer + ", " + "mAmbientLux=" + mAmbientLux); } - updateAutoBrightness(true); + updateAutoBrightness(true /* sendUpdate */, false /* isManuallySet */); nextBrightenTransition = nextAmbientLightBrighteningTransition(time); nextDarkenTransition = nextAmbientLightDarkeningTransition(time); } @@ -717,7 +717,7 @@ class AutomaticBrightnessController { mHandler.sendEmptyMessageAtTime(MSG_UPDATE_AMBIENT_LUX, nextTransitionTime); } - private void updateAutoBrightness(boolean sendUpdate) { + private void updateAutoBrightness(boolean sendUpdate, boolean isManuallySet) { if (!mAmbientLuxValid) { return; } @@ -732,6 +732,7 @@ class AutomaticBrightnessController { // in which case we ignore the new screen brightness if it doesn't differ enough from the // previous one. if (mScreenAutoBrightness != -1 + && !isManuallySet && newScreenAutoBrightness > mScreenDarkeningThreshold && newScreenAutoBrightness < mScreenBrighteningThreshold) { if (mLoggingEnabled) { @@ -879,7 +880,7 @@ class AutomaticBrightnessController { mPendingForegroundAppPackageName = null; mForegroundAppCategory = mPendingForegroundAppCategory; mPendingForegroundAppCategory = ApplicationInfo.CATEGORY_UNDEFINED; - updateAutoBrightness(true /* sendUpdate */); + updateAutoBrightness(true /* sendUpdate */, false /* isManuallySet */); } private final class AutomaticBrightnessHandler extends Handler { diff --git a/services/core/java/com/android/server/location/GnssVisibilityControl.java b/services/core/java/com/android/server/location/GnssVisibilityControl.java index 65bd5c6a14da..3ee941920f48 100644 --- a/services/core/java/com/android/server/location/GnssVisibilityControl.java +++ b/services/core/java/com/android/server/location/GnssVisibilityControl.java @@ -78,7 +78,6 @@ class GnssVisibilityControl { private final Handler mHandler; private final Context mContext; private final GpsNetInitiatedHandler mNiHandler; - private final Notification mEmergencyLocationUserNotification; private boolean mIsGpsEnabled; @@ -107,7 +106,6 @@ class GnssVisibilityControl { mNiHandler = niHandler; mAppOps = mContext.getSystemService(AppOpsManager.class); mPackageManager = mContext.getPackageManager(); - mEmergencyLocationUserNotification = createEmergencyLocationUserNotification(mContext); // Complete initialization as the first event to run in mHandler thread. After that, // all object state read/update events run in the mHandler thread. @@ -632,13 +630,15 @@ class GnssVisibilityControl { } notificationManager.notifyAsUser(/* tag= */ null, /* notificationId= */ 0, - mEmergencyLocationUserNotification, UserHandle.ALL); + createEmergencyLocationUserNotification(mContext), UserHandle.ALL); } private static Notification createEmergencyLocationUserNotification(Context context) { - String firstLineText = context.getString(R.string.gpsNotifTitle); - String secondLineText = context.getString(R.string.global_action_emergency); - String accessibilityServicesText = firstLineText + " (" + secondLineText + ")"; + // NOTE: Do not reuse the returned notification object as it will not reflect + // changes to notification text when the system language is changed. + final String firstLineText = context.getString(R.string.gpsNotifTitle); + final String secondLineText = context.getString(R.string.global_action_emergency); + final String accessibilityServicesText = firstLineText + " (" + secondLineText + ")"; return new Notification.Builder(context, SystemNotificationChannels.NETWORK_ALERTS) .setSmallIcon(com.android.internal.R.drawable.stat_sys_gps_on) .setWhen(0) diff --git a/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java b/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java index a1c27d6432f1..2474b2aa9184 100644 --- a/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java +++ b/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java @@ -73,6 +73,10 @@ class PersistentDataBlockLock extends OemLock { // unlocked but doesn't actually do any unlocking. final PersistentDataBlockManager pdbm = (PersistentDataBlockManager) mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE); + if (pdbm == null) { + Slog.w(TAG, "PersistentDataBlock is not supported on this device"); + return; + } pdbm.setOemUnlockEnabled(allowedByDevice); } @@ -80,6 +84,10 @@ class PersistentDataBlockLock extends OemLock { boolean isOemUnlockAllowedByDevice() { final PersistentDataBlockManager pdbm = (PersistentDataBlockManager) mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE); + if (pdbm == null) { + Slog.w(TAG, "PersistentDataBlock is not supported on this device"); + return false; + } return pdbm.getOemUnlockEnabled(); } @@ -91,6 +99,10 @@ class PersistentDataBlockLock extends OemLock { private void disallowUnlockIfNotUnlocked() { final PersistentDataBlockManager pdbm = (PersistentDataBlockManager) mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE); + if (pdbm == null) { + Slog.w(TAG, "PersistentDataBlock is not supported on this device"); + return; + } if (pdbm.getFlashLockState() != PersistentDataBlockManager.FLASH_LOCK_UNLOCKED) { pdbm.setOemUnlockEnabled(false); } diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index 5ba47d8433cc..9e8876a9c32d 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -4995,6 +4995,17 @@ class ActivityStack extends ConfigurationContainer { return true; } + ActivityRecord topActivity = getDisplay().topRunningActivity(); + ActivityStack topStack = topActivity.getActivityStack(); + if (topStack != null && topStack != this && topActivity.isState(RESUMED)) { + // The new top activity is already resumed, so there's a good chance that nothing will + // get resumed below. So, update visibility now in case the transition is closed + // prematurely. + mRootActivityContainer.ensureVisibilityAndConfig(null /* starting */, + getDisplay().mDisplayId, false /* markFrozenIfConfigChanged */, + false /* deferResume */); + } + mRootActivityContainer.resumeFocusedStacksTopActivities(); return true; } diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index 5c55c2e63da1..0a88eef86ea8 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -1419,6 +1419,13 @@ class ActivityStarter { stack.finishActivityLocked(mStartActivity, RESULT_CANCELED, null /* intentResultData */, "startActivity", true /* oomAdj */); } + + // Stack should also be detached from display and be removed if it's empty. + if (startedActivityStack != null && startedActivityStack.isAttached() + && startedActivityStack.numActivities() == 0 + && !startedActivityStack.isActivityTypeHome()) { + startedActivityStack.remove(); + } } mService.mWindowManager.continueSurfaceLayout(); } @@ -2289,15 +2296,17 @@ class ActivityStarter { } private int setTaskFromReuseOrCreateNewTask(TaskRecord taskToAffiliate) { + if (mRestrictedBgActivity && (mReuseTask == null || !mReuseTask.containsAppUid(mCallingUid)) + && handleBackgroundActivityAbort(mStartActivity)) { + return START_ABORTED; + } + mTargetStack = computeStackFocus(mStartActivity, true, mLaunchFlags, mOptions); // Do no move the target stack to front yet, as we might bail if // isLockTaskModeViolation fails below. if (mReuseTask == null) { - if (mRestrictedBgActivity && handleBackgroundActivityAbort(mStartActivity)) { - return START_ABORTED; - } final TaskRecord task = mTargetStack.createTaskRecord( mSupervisor.getNextTaskIdForUserLocked(mStartActivity.mUserId), mNewTaskInfo != null ? mNewTaskInfo : mStartActivity.info, @@ -2310,11 +2319,6 @@ class ActivityStarter { if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Starting new activity " + mStartActivity + " in new task " + mStartActivity.getTaskRecord()); } else { - if (mRestrictedBgActivity && !mReuseTask.containsAppUid(mCallingUid)) { - if (handleBackgroundActivityAbort(mStartActivity)) { - return START_ABORTED; - } - } addOrReparentStartingActivity(mReuseTask, "setTaskFromReuseOrCreateNewTask"); } diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index 4a9a3f71f90e..60cfe14f4080 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -540,6 +540,14 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree // If the app was already visible, don't reset the waitingToShow state. if (isHidden()) { waitingToShow = true; + + // Let's reset the draw state in order to prevent the starting window to be + // immediately dismissed when the app still has the surface. + forAllWindows(w -> { + if (w.mAttrs.type != TYPE_APPLICATION_STARTING) { + w.mWinAnimator.resetDrawState(); + } + }, true /* traverseTopToBottom */); } } diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java index d83869109ff3..481c3ba24fca 100644 --- a/services/core/java/com/android/server/wm/TaskStack.java +++ b/services/core/java/com/android/server/wm/TaskStack.java @@ -1640,6 +1640,7 @@ public class TaskStack extends WindowContainer<Task> implements if (mAnimationType == BoundsAnimationController.FADE_IN) { setPinnedStackAlpha(1f); mActivityStack.mService.notifyPinnedStackAnimationEnded(); + return; } if (finalStackSize != null && !mCancelCurrentBoundsAnimation) { @@ -1935,14 +1936,11 @@ public class TaskStack extends WindowContainer<Task> implements public boolean setPinnedStackAlpha(float alpha) { // Hold the lock since this is called from the BoundsAnimator running on the UiThread synchronized (mWmService.mGlobalLock) { - if (mCancelCurrentBoundsAnimation) { - return false; - } - getPendingTransaction().setAlpha(getSurfaceControl(), alpha); + getPendingTransaction().setAlpha(getSurfaceControl(), + mCancelCurrentBoundsAnimation ? 1 : alpha); scheduleAnimation(); + return !mCancelCurrentBoundsAnimation; } - - return true; } public DisplayInfo getDisplayInfo() { diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index de9d769a19d1..c6c9e1b39db4 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -1548,7 +1548,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP */ boolean isInteresting() { return mAppToken != null && !mAppDied - && (!mAppToken.isFreezingScreen() || !mAppFreezing); + && (!mAppToken.isFreezingScreen() || !mAppFreezing) + && mViewVisibility == View.VISIBLE; } /** diff --git a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl index 1e688d0874de..30893b215001 100644 --- a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl +++ b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net; interface IIpMemoryStore { oneway void storeNetworkAttributes(String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnStatusListener listener); diff --git a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl index cf02c26c2fe3..535ae2cf25e4 100644 --- a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl +++ b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net; interface IIpMemoryStoreCallbacks { oneway void onIpMemoryStoreFetched(in android.net.IIpMemoryStore ipMemoryStore); diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl index 291dbef817e6..6d2dc0ccaaac 100644 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl +++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.ipmemorystore; parcelable Blob { byte[] data; diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl index 52f40d49abd5..48c1fb8c180a 100644 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl +++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.ipmemorystore; interface IOnBlobRetrievedListener { oneway void onBlobRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in String name, in android.net.ipmemorystore.Blob data); diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl index 785351435d73..aebc7240bc9e 100644 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl +++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.ipmemorystore; interface IOnL2KeyResponseListener { oneway void onL2KeyResponse(in android.net.ipmemorystore.StatusParcelable status, in String l2Key); diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl index 3dd2ae6e9bab..b66db5ab21cb 100644 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl +++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.ipmemorystore; interface IOnNetworkAttributesRetrievedListener { oneway void onNetworkAttributesRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes); diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl index 46d4ecb9ed7c..e9f2db445d38 100644 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl +++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.ipmemorystore; interface IOnSameL3NetworkResponseListener { oneway void onSameL3NetworkResponse(in android.net.ipmemorystore.StatusParcelable status, in android.net.ipmemorystore.SameL3NetworkResponseParcelable response); diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl index 54e654b80c9e..49172cea9587 100644 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl +++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.ipmemorystore; interface IOnStatusListener { oneway void onComplete(in android.net.ipmemorystore.StatusParcelable status); diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl index 9531ea3963fb..188db20b531a 100644 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl +++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.ipmemorystore; parcelable NetworkAttributesParcelable { byte[] assignedV4Address; diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl index 414272b49f1d..7a2ed48241e7 100644 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl +++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.ipmemorystore; parcelable SameL3NetworkResponseParcelable { String l2Key1; diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl index 92c6779b5dc0..d9b067875e84 100644 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl +++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.ipmemorystore; parcelable StatusParcelable { int resultCode; diff --git a/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl b/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl index 31891de7230a..07ff32111bb1 100644 --- a/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl +++ b/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net; parcelable DhcpResultsParcelable { android.net.StaticIpConfiguration baseConfiguration; diff --git a/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl b/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl index 029968b6f324..8aa68bd1c7bf 100644 --- a/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl +++ b/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net; interface INetworkMonitor { oneway void start(); diff --git a/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl index ee9871ddcd15..ea93729da5e7 100644 --- a/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl +++ b/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net; interface INetworkMonitorCallbacks { oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor); diff --git a/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl b/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl index 7da11e476c0e..e3a83d17eb0b 100644 --- a/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl +++ b/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net; interface INetworkStackConnector { oneway void makeDhcpServer(in String ifName, in android.net.dhcp.DhcpServingParamsParcel params, in android.net.dhcp.IDhcpServerCallbacks cb); diff --git a/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl b/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl index f6ca6f7a78e2..3112a081735a 100644 --- a/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl +++ b/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net; interface INetworkStackStatusCallback { oneway void onStatusAvailable(int statusCode); diff --git a/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl b/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl index c80a78785b3b..f846b26af808 100644 --- a/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl +++ b/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net; parcelable InitialConfigurationParcelable { android.net.LinkAddress[] ipAddresses; diff --git a/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl index 65de8833e6c5..de75940f5a50 100644 --- a/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl +++ b/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net; parcelable NattKeepalivePacketDataParcelable { byte[] srcAddress; diff --git a/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl b/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl index 2de790bb7754..cf0fbce94c91 100644 --- a/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl +++ b/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net; parcelable PrivateDnsConfigParcel { String hostname; diff --git a/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl b/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl index 3a6c30496fd8..c0f2d4d1747e 100644 --- a/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl +++ b/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net; parcelable ProvisioningConfigurationParcelable { boolean enableIPv4; diff --git a/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl index e121c064f7ac..5926794c2e8a 100644 --- a/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl +++ b/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net; parcelable TcpKeepalivePacketDataParcelable { byte[] srcAddress; diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl index 67193ae904bc..7ab156f10553 100644 --- a/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl +++ b/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.dhcp; parcelable DhcpServingParamsParcel { int serverAddr; diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl index 914315855496..d281ecfee61d 100644 --- a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl +++ b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.dhcp; interface IDhcpServer { oneway void start(in android.net.INetworkStackStatusCallback cb); diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl index dcc4489d52a6..98be0ab1d540 100644 --- a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl +++ b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.dhcp; interface IDhcpServerCallbacks { oneway void onDhcpServerCreated(int statusCode, in android.net.dhcp.IDhcpServer server); diff --git a/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl b/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl index 176a5ce85373..85c8676ab8d0 100644 --- a/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl +++ b/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.ip; interface IIpClient { oneway void completedPreDhcpAction(); diff --git a/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl index d6bc8089a0be..7fe39ed1ed7a 100644 --- a/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl +++ b/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not +// try to edit this file. It looks like you are doing that because you have +// modified an AIDL interface in a backward-incompatible way, e.g., deleting a +// function from an interface or a field from a parcelable and it broke the +// build. That breakage is intended. +// +// You must not make a backward incompatible changes to the AIDL files built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + package android.net.ip; interface IIpClientCallbacks { oneway void onIpClientCreated(in android.net.ip.IIpClient ipClient); diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java index 53b0add8c37e..4986a6d5bd0d 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java @@ -585,7 +585,10 @@ class ActivityTestsBase { } void tearDown() { - mHandlerThread.quitSafely(); + // Make sure there are no running messages and then quit the thread so the next test + // won't be affected. + mHandlerThread.getThreadHandler().runWithScissors(mHandlerThread::quit, + 0 /* timeout */); } } @@ -630,7 +633,8 @@ class ActivityTestsBase { mWindowManager = prepareMockWindowManager(); mKeyguardController = mock(KeyguardController.class); - // Do not schedule idle timeouts + // Do not schedule idle that may touch methods outside the scope of the test. + doNothing().when(this).scheduleIdleLocked(); doNothing().when(this).scheduleIdleTimeoutLocked(any()); // unit test version does not handle launch wake lock doNothing().when(this).acquireLaunchWakelock(); diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 5d39a2cc194a..518da74eb9e2 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -16,6 +16,8 @@ package android.telephony; +import static android.telephony.TelephonyManager.NETWORK_TYPE_BITMASK_UNKNOWN; + import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -1605,6 +1607,12 @@ public class ServiceState implements Parcelable { } } + /** @hide */ + public static int networkTypeToAccessNetworkType(@TelephonyManager.NetworkType + int networkType) { + return rilRadioTechnologyToAccessNetworkType(networkTypeToRilRadioTechnology(networkType)); + } + /** * Get current data network type. * @@ -1730,6 +1738,36 @@ public class ServiceState implements Parcelable { return false; } + /** + * + * Returns whether the bearerBitmask includes a networkType that matches the accessNetworkType. + * + * The NetworkType refers to NetworkType in TelephonyManager. For example + * {@link TelephonyManager#NETWORK_TYPE_GPRS}. + * + * The accessNetworkType refers to {@link AccessNetworkType}. + * + * @hide + * */ + public static boolean networkBitmaskHasAccessNetworkType( + @TelephonyManager.NetworkTypeBitMask int networkBitmask, int accessNetworkType) { + if (networkBitmask == NETWORK_TYPE_BITMASK_UNKNOWN) return true; + if (accessNetworkType == AccessNetworkType.UNKNOWN) return false; + + int networkType = 1; + while (networkBitmask != 0) { + if ((networkBitmask & 1) != 0) { + if (networkTypeToAccessNetworkType(networkType) == accessNetworkType) { + return true; + } + } + networkBitmask = networkBitmask >> 1; + networkType++; + } + + return false; + } + /** @hide */ public static int getBitmaskForTech(int radioTech) { if (radioTech >= 1) { diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java index 68602354d3b0..b44e4f179392 100644 --- a/telephony/java/android/telephony/SmsManager.java +++ b/telephony/java/android/telephony/SmsManager.java @@ -1975,9 +1975,11 @@ public final class SmsManager { */ public static int getDefaultSmsSubscriptionId() { try { - return getISmsServiceOrThrow().getPreferredSmsSubscription(); + return getISmsService().getPreferredSmsSubscription(); } catch (RemoteException e) { return SubscriptionManager.INVALID_SUBSCRIPTION_ID; + } catch (NullPointerException e) { + return SubscriptionManager.INVALID_SUBSCRIPTION_ID; } } diff --git a/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java b/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java index 17fa93135c7d..45ddc3eed39c 100644 --- a/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java +++ b/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java @@ -39,6 +39,8 @@ import com.android.internal.colorextraction.types.Tonal; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; /** * Tests color extraction generation. @@ -48,16 +50,19 @@ import org.junit.runner.RunWith; public class ColorExtractorTest { Context mContext; + @Mock + WallpaperManager mWallpaperManager; @Before public void setup() { + MockitoAnnotations.initMocks(this); mContext = InstrumentationRegistry.getContext(); } @Test public void ColorExtractor_extractWhenInitialized() { ExtractionType type = mock(Tonal.class); - new ColorExtractor(mContext, type, true); + new ColorExtractor(mContext, type, true, mWallpaperManager); // 1 for lock and 1 for system verify(type, times(2)) .extractInto(any(), any(), any(), any()); @@ -84,7 +89,7 @@ public class ColorExtractorTest { outGradientColorsDark.set(colorsExpectedDark); outGradientColorsExtraDark.set(colorsExpectedExtraDark); }; - ColorExtractor extractor = new ColorExtractor(mContext, type, true); + ColorExtractor extractor = new ColorExtractor(mContext, type, true, mWallpaperManager); GradientColors colors = extractor.getColors(WallpaperManager.FLAG_SYSTEM, ColorExtractor.TYPE_NORMAL); @@ -99,7 +104,8 @@ public class ColorExtractorTest { public void addOnColorsChangedListener_invokesListener() { ColorExtractor.OnColorsChangedListener mockedListeners = mock(ColorExtractor.OnColorsChangedListener.class); - ColorExtractor extractor = new ColorExtractor(mContext, new Tonal(mContext), true); + ColorExtractor extractor = new ColorExtractor(mContext, new Tonal(mContext), true, + mWallpaperManager); extractor.addOnColorsChangedListener(mockedListeners); extractor.onColorsChanged(new WallpaperColors(Color.valueOf(Color.RED), null, null), |