Merge "Explicitly use main dispatcher for the window root view blurs" into main
diff --git a/core/api/current.txt b/core/api/current.txt
index e9a63f7..99e4063 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -21750,6 +21750,7 @@
field public static final int CHANNEL_IN_X_AXIS = 2048; // 0x800
field public static final int CHANNEL_IN_Y_AXIS = 4096; // 0x1000
field public static final int CHANNEL_IN_Z_AXIS = 8192; // 0x2000
+ field @FlaggedApi("android.media.audio.sony_360ra_mpegh_3d_format") public static final int CHANNEL_OUT_13POINT0 = 30136348; // 0x1cbd81c
field public static final int CHANNEL_OUT_5POINT1 = 252; // 0xfc
field public static final int CHANNEL_OUT_5POINT1POINT2 = 3145980; // 0x3000fc
field public static final int CHANNEL_OUT_5POINT1POINT4 = 737532; // 0xb40fc
diff --git a/core/java/android/os/TestLooperManager.java b/core/java/android/os/TestLooperManager.java
index d451109..ddfa379 100644
--- a/core/java/android/os/TestLooperManager.java
+++ b/core/java/android/os/TestLooperManager.java
@@ -84,17 +84,8 @@
* interactions with it have completed.
*/
public Message next() {
- // Wait for the looper block to come up, to make sure we don't accidentally get
- // the message for the block.
- while (!mLooperIsMyLooper && !mLooperBlocked) {
- synchronized (this) {
- try {
- wait();
- } catch (InterruptedException e) {
- }
- }
- }
checkReleased();
+ waitForLooperHolder();
return mQueue.next();
}
@@ -110,6 +101,7 @@
@Nullable
public Message poll() {
checkReleased();
+ waitForLooperHolder();
return mQueue.pollForTest();
}
@@ -124,6 +116,7 @@
@Nullable
public Long peekWhen() {
checkReleased();
+ waitForLooperHolder();
return mQueue.peekWhenForTest();
}
@@ -133,6 +126,7 @@
@FlaggedApi(Flags.FLAG_MESSAGE_QUEUE_TESTABILITY)
public boolean isBlockedOnSyncBarrier() {
checkReleased();
+ waitForLooperHolder();
return mQueue.isBlockedOnSyncBarrier();
}
@@ -221,6 +215,23 @@
}
}
+ /**
+ * Waits until the Looper is blocked by the LooperHolder, if one was posted.
+ *
+ * After this method returns, it's guaranteed that the LooperHolder Message
+ * is not in the underlying queue.
+ */
+ private void waitForLooperHolder() {
+ while (!mLooperIsMyLooper && !mLooperBlocked) {
+ synchronized (this) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+ }
+
private class LooperHolder implements Runnable {
@Override
public void run() {
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index cd8a85a..bf34069 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -5566,9 +5566,6 @@
if (mAttachInfo.mContentCaptureManager != null) {
ContentCaptureSession session =
mAttachInfo.mContentCaptureManager.getMainContentCaptureSession();
- if (android.view.contentcapture.flags.Flags.postCreateAndroidBgThread()) {
- session.performStart();
- }
session.notifyWindowBoundsChanged(session.getId(),
getConfiguration().windowConfiguration.getBounds());
}
diff --git a/core/java/android/view/contentcapture/ContentCaptureManager.java b/core/java/android/view/contentcapture/ContentCaptureManager.java
index 3f3484d..724e8fa 100644
--- a/core/java/android/view/contentcapture/ContentCaptureManager.java
+++ b/core/java/android/view/contentcapture/ContentCaptureManager.java
@@ -52,6 +52,7 @@
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.os.BackgroundThread;
import com.android.internal.util.RingBuffer;
import com.android.internal.util.SyncResultReceiver;
@@ -604,6 +605,7 @@
mContext,
this,
prepareUiHandler(),
+ prepareContentCaptureHandler(),
mService
);
if (sVerbose) Log.v(TAG, "getMainContentCaptureSession(): created " + mMainSession);
@@ -614,6 +616,15 @@
@NonNull
@GuardedBy("mLock")
+ private Handler prepareContentCaptureHandler() {
+ if (mContentCaptureHandler == null) {
+ mContentCaptureHandler = BackgroundThread.getHandler();
+ }
+ return mContentCaptureHandler;
+ }
+
+ @NonNull
+ @GuardedBy("mLock")
private Handler prepareUiHandler() {
if (mUiHandler == null) {
mUiHandler = Handler.createAsync(Looper.getMainLooper());
diff --git a/core/java/android/view/contentcapture/ContentCaptureSession.java b/core/java/android/view/contentcapture/ContentCaptureSession.java
index 6bb2975..9aeec20 100644
--- a/core/java/android/view/contentcapture/ContentCaptureSession.java
+++ b/core/java/android/view/contentcapture/ContentCaptureSession.java
@@ -286,9 +286,6 @@
abstract void start(@NonNull IBinder token, @NonNull IBinder shareableActivityToken,
@NonNull ComponentName component, int flags);
- /** @hide */
- public void performStart() {}
-
abstract boolean isDisabled();
/**
diff --git a/core/java/android/view/contentcapture/MainContentCaptureSession.java b/core/java/android/view/contentcapture/MainContentCaptureSession.java
index eddfc42d..2fb78c0 100644
--- a/core/java/android/view/contentcapture/MainContentCaptureSession.java
+++ b/core/java/android/view/contentcapture/MainContentCaptureSession.java
@@ -57,12 +57,10 @@
import android.view.ViewStructure;
import android.view.autofill.AutofillId;
import android.view.contentcapture.ViewNode.ViewStructureImpl;
-import android.view.contentcapture.flags.Flags;
import android.view.contentprotection.ContentProtectionEventProcessor;
import android.view.inputmethod.BaseInputConnection;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.os.BackgroundThread;
import com.android.internal.os.IResultReceiver;
import com.android.modules.expresslog.Counter;
@@ -109,10 +107,8 @@
@NonNull
private final Handler mUiHandler;
- /** @hide */
- @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
- @Nullable
- public Handler mContentCaptureHandler;
+ @NonNull
+ private final Handler mContentCaptureHandler;
/**
* Interface to the system_server binder object - it's only used to start the session (and
@@ -191,12 +187,6 @@
@Nullable
public ContentProtectionEventProcessor mContentProtectionEventProcessor;
- /**
- * A runnable object to perform the start of this session.
- */
- @Nullable
- private Runnable mStartRunnable = null;
-
private static class SessionStateReceiver extends IResultReceiver.Stub {
private final WeakReference<MainContentCaptureSession> mMainSession;
@@ -208,7 +198,7 @@
public void send(int resultCode, Bundle resultData) {
final MainContentCaptureSession mainSession = mMainSession.get();
if (mainSession == null) {
- Log.w(TAG, "received result after main session released");
+ Log.w(TAG, "received result after mina session released");
return;
}
final IBinder binder;
@@ -223,8 +213,6 @@
binder = resultData.getBinder(EXTRA_BINDER);
if (binder == null) {
Log.wtf(TAG, "No " + EXTRA_BINDER + " extra result");
- // explicitly init the bg thread
- mainSession.mContentCaptureHandler = mainSession.prepareContentCaptureHandler();
mainSession.runOnContentCaptureThread(() -> mainSession.resetSession(
STATE_DISABLED | STATE_INTERNAL_ERROR));
return;
@@ -232,45 +220,23 @@
} else {
binder = null;
}
- // explicitly init the bg thread
- mainSession.mContentCaptureHandler = mainSession.prepareContentCaptureHandler();
mainSession.runOnContentCaptureThread(() ->
mainSession.onSessionStarted(resultCode, binder));
}
}
- /**
- * Prepares the content capture handler(i.e. the background thread).
- *
- * This is expected to be called from the {@link SessionStateReceiver#send} callback, after the
- * session {@link performStart}. This is expected to be executed in a binder thread, instead
- * of the UI thread.
- */
- @NonNull
- private Handler prepareContentCaptureHandler() {
- if (mContentCaptureHandler == null) {
- try {
- if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) {
- Trace.traceBegin(Trace.TRACE_TAG_VIEW, "prepareContentCaptureHandler");
- }
- mContentCaptureHandler = BackgroundThread.getHandler();
- } finally {
- Trace.traceEnd(Trace.TRACE_TAG_VIEW);
- }
- }
- return mContentCaptureHandler;
- }
-
/** @hide */
@VisibleForTesting(visibility = VisibleForTesting.Visibility.PROTECTED)
public MainContentCaptureSession(
@NonNull ContentCaptureManager.StrippedContext context,
@NonNull ContentCaptureManager manager,
@NonNull Handler uiHandler,
+ @NonNull Handler contentCaptureHandler,
@NonNull IContentCaptureManager systemServerInterface) {
mContext = context;
mManager = manager;
mUiHandler = uiHandler;
+ mContentCaptureHandler = contentCaptureHandler;
mSystemServerInterface = systemServerInterface;
final int logHistorySize = mManager.mOptions.logHistorySize;
@@ -294,49 +260,18 @@
}
/**
- * Performs the start of the session.
- *
- * This is expected to be called from the UI thread, when the activity finishes its first frame.
- * This is a no-op if the session has already been started.
- *
- * See {@link #start(IBinder, IBinder, ComponentName, int)} for more details.
- *
- * @hide */
- @Override
- public void performStart() {
- if (!hasStarted() && mStartRunnable != null) {
- mStartRunnable.run();
- }
- }
-
- /**
- * Creates a runnable to start this session.
- *
- * For performance reasons, it is better to only create a task to start the session
- * during the creation of the activity and perform the actual start when the activity
- * finishes it's first frame.
+ * Starts this session.
*/
@Override
void start(@NonNull IBinder token, @NonNull IBinder shareableActivityToken,
@NonNull ComponentName component, int flags) {
- if (Flags.postCreateAndroidBgThread()) {
- mStartRunnable = () -> {
- try {
- if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) {
- Trace.traceBegin(Trace.TRACE_TAG_VIEW, "cc session startImpl");
- }
- startImpl(token, shareableActivityToken, component, flags);
- } finally {
- Trace.traceEnd(Trace.TRACE_TAG_VIEW);
- }
- };
- } else {
- startImpl(token, shareableActivityToken, component, flags);
- }
+ runOnContentCaptureThread(
+ () -> startImpl(token, shareableActivityToken, component, flags));
}
private void startImpl(@NonNull IBinder token, @NonNull IBinder shareableActivityToken,
@NonNull ComponentName component, int flags) {
+ checkOnContentCaptureThread();
if (!isContentCaptureEnabled()) return;
if (sVerbose) {
@@ -370,7 +305,6 @@
Log.w(TAG, "Error starting session for " + component.flattenToShortString() + ": " + e);
}
}
-
@Override
void onDestroy() {
clearAndRunOnContentCaptureThread(() -> {
@@ -627,6 +561,7 @@
}
private boolean hasStarted() {
+ checkOnContentCaptureThread();
return mState != UNKNOWN_STATE;
}
@@ -640,11 +575,6 @@
if (sVerbose) Log.v(TAG, "handleScheduleFlush(): session not started yet");
return;
}
- if (mContentCaptureHandler == null) {
- Log.w(TAG, "handleScheduleFlush(" + getDebugState(reason) + "): content capture "
- + "thread not ready");
- return;
- }
if (mDisabled.get()) {
// Should not be called on this state, as handleSendEvent checks.
@@ -717,11 +647,6 @@
if (!isContentCaptureReceiverEnabled()) {
return;
}
- if (mContentCaptureHandler == null) {
- Log.w(TAG, "handleForceFlush(" + getDebugState(reason) + "): content capture thread"
- + "not ready");
- return;
- }
if (mDirectServiceInterface == null) {
if (sVerbose) {
@@ -838,9 +763,7 @@
}
mDirectServiceInterface = null;
mContentProtectionEventProcessor = null;
- if (mContentCaptureHandler != null) {
- mContentCaptureHandler.removeMessages(MSG_FLUSH);
- }
+ mContentCaptureHandler.removeMessages(MSG_FLUSH);
}
@Override
@@ -994,10 +917,6 @@
* clear the buffer events then starting sending out current event.
*/
private void enqueueEvent(@NonNull final ContentCaptureEvent event, boolean forceFlush) {
- if (mContentCaptureHandler == null) {
- mEventProcessQueue.offer(event);
- return;
- }
if (forceFlush || mEventProcessQueue.size() >= mManager.mOptions.maxBufferSize - 1) {
// The buffer events are cleared in the same thread first to prevent new events
// being added during the time of context switch. This would disrupt the sequence
@@ -1200,10 +1119,6 @@
* always delegate to the assigned thread from {@code mHandler} for synchronization.</p>
*/
private void checkOnContentCaptureThread() {
- if (mContentCaptureHandler == null) {
- Log.e(TAG, "content capture thread is not initiallized!");
- return;
- }
final boolean onContentCaptureThread = mContentCaptureHandler.getLooper().isCurrentThread();
if (!onContentCaptureThread) {
mWrongThreadCount.incrementAndGet();
@@ -1224,12 +1139,6 @@
* </p>
*/
private void runOnContentCaptureThread(@NonNull Runnable r) {
- if (mContentCaptureHandler == null) {
- Log.e(TAG, "content capture thread is not initiallized!");
- // fall back to UI thread
- runOnUiThread(r);
- return;
- }
if (!mContentCaptureHandler.getLooper().isCurrentThread()) {
mContentCaptureHandler.post(r);
} else {
@@ -1238,12 +1147,6 @@
}
private void clearAndRunOnContentCaptureThread(@NonNull Runnable r, int what) {
- if (mContentCaptureHandler == null) {
- Log.e(TAG, "content capture thread is not initiallized!");
- // fall back to UI thread
- runOnUiThread(r);
- return;
- }
if (!mContentCaptureHandler.getLooper().isCurrentThread()) {
mContentCaptureHandler.removeMessages(what);
mContentCaptureHandler.post(r);
diff --git a/core/java/android/view/contentcapture/flags/content_capture_flags.aconfig b/core/java/android/view/contentcapture/flags/content_capture_flags.aconfig
index 9df8350..e7bc004 100644
--- a/core/java/android/view/contentcapture/flags/content_capture_flags.aconfig
+++ b/core/java/android/view/contentcapture/flags/content_capture_flags.aconfig
@@ -15,14 +15,3 @@
bug: "380381249"
is_exported: true
}
-
-flag {
- name: "post_create_android_bg_thread"
- namespace: "pixel_state_server"
- description: "Feature flag to post create the bg thread when an app is in the allowlist"
- bug: "376468525"
- is_fixed_read_only: true
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
diff --git a/core/java/android/window/flags/lse_desktop_experience.aconfig b/core/java/android/window/flags/lse_desktop_experience.aconfig
index 222088e..51d488f 100644
--- a/core/java/android/window/flags/lse_desktop_experience.aconfig
+++ b/core/java/android/window/flags/lse_desktop_experience.aconfig
@@ -593,3 +593,10 @@
purpose: PURPOSE_BUGFIX
}
}
+
+flag {
+ name: "enable_non_default_display_split"
+ namespace: "lse_desktop_experience"
+ description: "Enables split screen on non default displays"
+ bug: "384999213"
+}
diff --git a/core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt b/core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt
index f9d449c..4ad6708 100644
--- a/core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt
+++ b/core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt
@@ -191,7 +191,7 @@
.fuzzFractions()
.mapNotNull{ FontScaleConverterFactory.forScale(it) }
.flatMap{ table ->
- generateSequenceOfFractions(-2000f..2000f, step = 0.1f)
+ generateSequenceOfFractions(-20f..100f, step = 0.1f)
.fuzzFractions()
.map{ Pair(table, it) }
}
diff --git a/core/tests/coretests/src/android/view/contentcapture/MainContentCaptureSessionTest.java b/core/tests/coretests/src/android/view/contentcapture/MainContentCaptureSessionTest.java
index 4a5123e..b42bcee 100644
--- a/core/tests/coretests/src/android/view/contentcapture/MainContentCaptureSessionTest.java
+++ b/core/tests/coretests/src/android/view/contentcapture/MainContentCaptureSessionTest.java
@@ -499,57 +499,6 @@
assertThat(session.mEventProcessQueue).hasSize(1);
}
- @Test
- public void notifyContentCaptureEvents_beforeSessionPerformStart() throws RemoteException {
- ContentCaptureOptions options =
- createOptions(
- /* enableContentCaptureReceiver= */ true,
- /* enableContentProtectionReceiver= */ true);
- MainContentCaptureSession session = createSession(options);
- session.mContentCaptureHandler = null;
- session.mDirectServiceInterface = null;
-
- notifyContentCaptureEvents(session);
- mTestableLooper.processAllMessages();
-
- assertThat(session.mEvents).isNull();
- assertThat(session.mEventProcessQueue).hasSize(7); // 5 view events + 2 view tree events
- }
-
- @Test
- public void notifyViewAppeared_beforeSessionPerformStart() throws RemoteException {
- ContentCaptureOptions options =
- createOptions(
- /* enableContentCaptureReceiver= */ true,
- /* enableContentProtectionReceiver= */ true);
- MainContentCaptureSession session = createSession(options);
- session.mContentCaptureHandler = null;
- session.mDirectServiceInterface = null;
-
- View view = prepareView(session);
- session.notifyViewAppeared(session.newViewStructure(view));
-
- assertThat(session.mEvents).isNull();
- assertThat(session.mEventProcessQueue).hasSize(1);
- }
-
- @Test
- public void flush_beforeSessionPerformStart() throws Exception {
- ContentCaptureOptions options =
- createOptions(
- /* enableContentCaptureReceiver= */ true,
- /* enableContentProtectionReceiver= */ true);
- MainContentCaptureSession session = createSession(options);
- session.mEvents = new ArrayList<>(Arrays.asList(EVENT));
- session.mContentCaptureHandler = null;
- session.mDirectServiceInterface = null;
-
- session.flush(REASON);
-
- assertThat(session.mEvents).hasSize(1);
- assertThat(session.mEventProcessQueue).isEmpty();
- }
-
/** Simulates the regular content capture events sequence. */
private void notifyContentCaptureEvents(final MainContentCaptureSession session) {
final ArrayList<Object> events = new ArrayList<>(
@@ -612,8 +561,8 @@
sStrippedContext,
manager,
testHandler,
+ testHandler,
mMockSystemServerInterface);
- session.mContentCaptureHandler = testHandler;
session.mComponentName = COMPONENT_NAME;
return session;
}
diff --git a/libs/WindowManager/Shell/aconfig/multitasking.aconfig b/libs/WindowManager/Shell/aconfig/multitasking.aconfig
index 0656446..13d0169 100644
--- a/libs/WindowManager/Shell/aconfig/multitasking.aconfig
+++ b/libs/WindowManager/Shell/aconfig/multitasking.aconfig
@@ -177,10 +177,3 @@
description: "Factor task-view state tracking out of taskviewtransitions"
bug: "384976265"
}
-
-flag {
- name: "enable_non_default_display_split"
- namespace: "multitasking"
- description: "Enables split screen on non default displays"
- bug: "384999213"
-}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java
index cd5c135..bd89f5c 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java
@@ -394,11 +394,19 @@
* Returns the divider position as a fraction from 0 to 1.
*/
public float getDividerPositionAsFraction() {
- return Math.min(1f, Math.max(0f, mIsLeftRightSplit
- ? (float) ((getTopLeftBounds().right + getBottomRightBounds().left) / 2f)
- / getBottomRightBounds().right
- : (float) ((getTopLeftBounds().bottom + getBottomRightBounds().top) / 2f)
- / getBottomRightBounds().bottom));
+ if (Flags.enableFlexibleTwoAppSplit()) {
+ return Math.min(1f, Math.max(0f, mIsLeftRightSplit
+ ? (getTopLeftBounds().right + getBottomRightBounds().left) / 2f
+ / getDisplayWidth()
+ : (getTopLeftBounds().bottom + getBottomRightBounds().top) / 2f
+ / getDisplayHeight()));
+ } else {
+ return Math.min(1f, Math.max(0f, mIsLeftRightSplit
+ ? (float) ((getTopLeftBounds().right + getBottomRightBounds().left) / 2f)
+ / getBottomRightBounds().right
+ : (float) ((getTopLeftBounds().bottom + getBottomRightBounds().top) / 2f)
+ / getBottomRightBounds().bottom));
+ }
}
private void updateInvisibleRect() {
diff --git a/media/java/android/media/AudioFormat.java b/media/java/android/media/AudioFormat.java
index 8bc66a0..f308ce9 100644
--- a/media/java/android/media/AudioFormat.java
+++ b/media/java/android/media/AudioFormat.java
@@ -18,6 +18,7 @@
import static android.media.audio.Flags.FLAG_DOLBY_AC4_LEVEL4_ENCODING_API;
import static android.media.audio.Flags.FLAG_IAMF_DEFINITIONS_API;
+import static android.media.audio.Flags.FLAG_SONY_360RA_MPEGH_3D_FORMAT;
import android.annotation.FlaggedApi;
import android.annotation.IntDef;
@@ -718,8 +719,9 @@
* Same as 9.1.4 with the addition of left and right top side channels */
public static final int CHANNEL_OUT_9POINT1POINT6 = (CHANNEL_OUT_9POINT1POINT4
| CHANNEL_OUT_TOP_SIDE_LEFT | CHANNEL_OUT_TOP_SIDE_RIGHT);
- /** @hide */
- public static final int CHANNEL_OUT_13POINT_360RA = (
+ /** Output channel mask for 13.0 */
+ @FlaggedApi(FLAG_SONY_360RA_MPEGH_3D_FORMAT)
+ public static final int CHANNEL_OUT_13POINT0 = (
CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_CENTER | CHANNEL_OUT_FRONT_RIGHT |
CHANNEL_OUT_SIDE_LEFT | CHANNEL_OUT_SIDE_RIGHT |
CHANNEL_OUT_TOP_FRONT_LEFT | CHANNEL_OUT_TOP_FRONT_CENTER |
@@ -915,7 +917,7 @@
case CHANNEL_OUT_9POINT1POINT6:
result.append("9.1.6");
break;
- case CHANNEL_OUT_13POINT_360RA:
+ case CHANNEL_OUT_13POINT0:
result.append("360RA 13ch");
break;
case CHANNEL_OUT_22POINT2:
diff --git a/media/java/android/media/audio/common/AidlConversion.java b/media/java/android/media/audio/common/AidlConversion.java
index 8521d1c..b831e4f 100644
--- a/media/java/android/media/audio/common/AidlConversion.java
+++ b/media/java/android/media/audio/common/AidlConversion.java
@@ -366,8 +366,8 @@
return AudioFormat.CHANNEL_OUT_9POINT1POINT4;
case AudioChannelLayout.LAYOUT_9POINT1POINT6:
return AudioFormat.CHANNEL_OUT_9POINT1POINT6;
- case AudioChannelLayout.LAYOUT_13POINT_360RA:
- return AudioFormat.CHANNEL_OUT_13POINT_360RA;
+ case AudioChannelLayout.LAYOUT_13POINT0:
+ return AudioFormat.CHANNEL_OUT_13POINT0;
case AudioChannelLayout.LAYOUT_22POINT2:
return AudioFormat.CHANNEL_OUT_22POINT2;
case AudioChannelLayout.LAYOUT_MONO_HAPTIC_A:
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/log/TableLogBufferBase.kt b/packages/SystemUI/plugin/src/com/android/systemui/plugins/log/TableLogBufferBase.kt
index 50b3f78..8a962f9 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/log/TableLogBufferBase.kt
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/log/TableLogBufferBase.kt
@@ -25,34 +25,34 @@
*
* For Java overloading.
*/
- fun logChange(prefix: String, columnName: String, value: String?) {
+ fun logChange(prefix: String = "", columnName: String, value: String?) {
logChange(prefix, columnName, value, isInitial = false)
}
/** Logs a String? change. */
- fun logChange(prefix: String, columnName: String, value: String?, isInitial: Boolean)
+ fun logChange(prefix: String = "", columnName: String, value: String?, isInitial: Boolean)
/**
* Logs a Boolean change.
*
* For Java overloading.
*/
- fun logChange(prefix: String, columnName: String, value: Boolean) {
+ fun logChange(prefix: String = "", columnName: String, value: Boolean) {
logChange(prefix, columnName, value, isInitial = false)
}
/** Logs a Boolean change. */
- fun logChange(prefix: String, columnName: String, value: Boolean, isInitial: Boolean)
+ fun logChange(prefix: String = "", columnName: String, value: Boolean, isInitial: Boolean)
/**
* Logs an Int? change.
*
* For Java overloading.
*/
- fun logChange(prefix: String, columnName: String, value: Int?) {
+ fun logChange(prefix: String = "", columnName: String, value: Int?) {
logChange(prefix, columnName, value, isInitial = false)
}
/** Logs an Int? change. */
- fun logChange(prefix: String, columnName: String, value: Int?, isInitial: Boolean)
+ fun logChange(prefix: String = "", columnName: String, value: Int?, isInitial: Boolean)
}
diff --git a/packages/SystemUI/src/com/android/systemui/log/table/Diffable.kt b/packages/SystemUI/src/com/android/systemui/log/table/Diffable.kt
index baa07c1..9fddbfb 100644
--- a/packages/SystemUI/src/com/android/systemui/log/table/Diffable.kt
+++ b/packages/SystemUI/src/com/android/systemui/log/table/Diffable.kt
@@ -65,7 +65,7 @@
*/
fun <T : Diffable<T>> Flow<T>.logDiffsForTable(
tableLogBuffer: TableLogBuffer,
- columnPrefix: String,
+ columnPrefix: String = "",
initialValue: T,
): Flow<T> {
// Fully log the initial value to the table.
@@ -87,7 +87,7 @@
/** See [logDiffsForTable(TableLogBuffer, String, T)]. */
fun Flow<Boolean>.logDiffsForTable(
tableLogBuffer: TableLogBuffer,
- columnPrefix: String,
+ columnPrefix: String = "",
columnName: String,
initialValue: Boolean,
): Flow<Boolean> {
@@ -106,7 +106,7 @@
/** See [logDiffsForTable(TableLogBuffer, String, T)]. */
fun Flow<Int>.logDiffsForTable(
tableLogBuffer: TableLogBuffer,
- columnPrefix: String,
+ columnPrefix: String = "",
columnName: String,
initialValue: Int,
): Flow<Int> {
@@ -125,7 +125,7 @@
/** See [logDiffsForTable(TableLogBuffer, String, T)]. */
fun Flow<Int?>.logDiffsForTable(
tableLogBuffer: TableLogBuffer,
- columnPrefix: String,
+ columnPrefix: String = "",
columnName: String,
initialValue: Int?,
): Flow<Int?> {
@@ -144,7 +144,7 @@
/** See [logDiffsForTable(TableLogBuffer, String, T)]. */
fun Flow<String?>.logDiffsForTable(
tableLogBuffer: TableLogBuffer,
- columnPrefix: String,
+ columnPrefix: String = "",
columnName: String,
initialValue: String?,
): Flow<String?> {
@@ -163,7 +163,7 @@
/** See [logDiffsForTable(TableLogBuffer, String, T)]. */
fun <T> Flow<List<T>>.logDiffsForTable(
tableLogBuffer: TableLogBuffer,
- columnPrefix: String,
+ columnPrefix: String = "",
columnName: String,
initialValue: List<T>,
): Flow<List<T>> {
diff --git a/packages/SystemUI/src/com/android/systemui/log/table/TableLogBuffer.kt b/packages/SystemUI/src/com/android/systemui/log/table/TableLogBuffer.kt
index 89a599a..3d1623b 100644
--- a/packages/SystemUI/src/com/android/systemui/log/table/TableLogBuffer.kt
+++ b/packages/SystemUI/src/com/android/systemui/log/table/TableLogBuffer.kt
@@ -124,7 +124,7 @@
* the separator token for parsing, so it can't be present in any part of the column name.
*/
@Synchronized
- fun <T : Diffable<T>> logDiffs(columnPrefix: String, prevVal: T, newVal: T) {
+ fun <T : Diffable<T>> logDiffs(columnPrefix: String = "", prevVal: T, newVal: T) {
val row = tempRow
row.timestamp = systemClock.currentTimeMillis()
row.columnPrefix = columnPrefix
@@ -136,6 +136,7 @@
/**
* Logs change(s) to the buffer using [rowInitializer].
*
+ * @param columnPrefix see [logDiffs].
* @param rowInitializer a function that will be called immediately to store relevant data on
* the row.
* @param isInitial true if this change represents the starting value for a particular column
@@ -145,9 +146,9 @@
*/
@Synchronized
fun logChange(
- columnPrefix: String,
+ columnPrefix: String = "",
isInitial: Boolean = false,
- rowInitializer: (TableRowLogger) -> Unit
+ rowInitializer: (TableRowLogger) -> Unit,
) {
val row = tempRow
row.timestamp = systemClock.currentTimeMillis()
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepository.kt
index 9f1395a..f82e681 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/airplane/data/repository/AirplaneModeRepository.kt
@@ -81,12 +81,7 @@
awaitClose { observer.isListening = false }
}
.distinctUntilChanged()
- .logDiffsForTable(
- logger,
- columnPrefix = "",
- columnName = "isAirplaneMode",
- initialValue = false,
- )
+ .logDiffsForTable(logger, columnName = "isAirplaneMode", initialValue = false)
.stateIn(
scope,
started = SharingStarted.WhileSubscribed(),
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/airplane/ui/viewmodel/AirplaneModeViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/airplane/ui/viewmodel/AirplaneModeViewModel.kt
index bd18f4b..2cef54f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/airplane/ui/viewmodel/AirplaneModeViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/airplane/ui/viewmodel/AirplaneModeViewModel.kt
@@ -59,7 +59,6 @@
.distinctUntilChanged()
.logDiffsForTable(
logger,
- columnPrefix = "",
columnName = "isAirplaneModeIconVisible",
initialValue = false,
)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionRepository.kt
index be3977e..410389a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionRepository.kt
@@ -64,9 +64,8 @@
_carrierId
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_CARRIER_ID,
- _carrierId.value,
+ initialValue = _carrierId.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), _carrierId.value)
@@ -75,9 +74,8 @@
_inflateSignalStrength
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = "inflate",
- _inflateSignalStrength.value,
+ initialValue = _inflateSignalStrength.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), _inflateSignalStrength.value)
@@ -89,9 +87,8 @@
_isEmergencyOnly
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_EMERGENCY,
- _isEmergencyOnly.value,
+ initialValue = _isEmergencyOnly.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), _isEmergencyOnly.value)
@@ -100,9 +97,8 @@
_isRoaming
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_ROAMING,
- _isRoaming.value,
+ initialValue = _isRoaming.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), _isRoaming.value)
@@ -111,9 +107,8 @@
_operatorAlphaShort
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_OPERATOR,
- _operatorAlphaShort.value,
+ initialValue = _operatorAlphaShort.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), _operatorAlphaShort.value)
@@ -122,9 +117,8 @@
_isInService
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_IS_IN_SERVICE,
- _isInService.value,
+ initialValue = _isInService.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), _isInService.value)
@@ -133,21 +127,15 @@
_isNonTerrestrial
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_IS_NTN,
- _isNonTerrestrial.value,
+ initialValue = _isNonTerrestrial.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), _isNonTerrestrial.value)
private val _isGsm = MutableStateFlow(false)
override val isGsm =
_isGsm
- .logDiffsForTable(
- tableLogBuffer,
- columnPrefix = "",
- columnName = COL_IS_GSM,
- _isGsm.value,
- )
+ .logDiffsForTable(tableLogBuffer, columnName = COL_IS_GSM, initialValue = _isGsm.value)
.stateIn(scope, SharingStarted.WhileSubscribed(), _isGsm.value)
private val _cdmaLevel = MutableStateFlow(CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN)
@@ -155,9 +143,8 @@
_cdmaLevel
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_CDMA_LEVEL,
- _cdmaLevel.value,
+ initialValue = _cdmaLevel.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), _cdmaLevel.value)
@@ -166,9 +153,8 @@
_primaryLevel
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_PRIMARY_LEVEL,
- _primaryLevel.value,
+ initialValue = _primaryLevel.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), _primaryLevel.value)
@@ -177,23 +163,22 @@
_satelliteLevel
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_SATELLITE_LEVEL,
- _satelliteLevel.value,
+ initialValue = _satelliteLevel.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), _satelliteLevel.value)
private val _dataConnectionState = MutableStateFlow(DataConnectionState.Disconnected)
override val dataConnectionState =
_dataConnectionState
- .logDiffsForTable(tableLogBuffer, columnPrefix = "", _dataConnectionState.value)
+ .logDiffsForTable(tableLogBuffer, initialValue = _dataConnectionState.value)
.stateIn(scope, SharingStarted.WhileSubscribed(), _dataConnectionState.value)
private val _dataActivityDirection =
MutableStateFlow(DataActivityModel(hasActivityIn = false, hasActivityOut = false))
override val dataActivityDirection =
_dataActivityDirection
- .logDiffsForTable(tableLogBuffer, columnPrefix = "", _dataActivityDirection.value)
+ .logDiffsForTable(tableLogBuffer, initialValue = _dataActivityDirection.value)
.stateIn(scope, SharingStarted.WhileSubscribed(), _dataActivityDirection.value)
private val _carrierNetworkChangeActive = MutableStateFlow(false)
@@ -201,9 +186,8 @@
_carrierNetworkChangeActive
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_CARRIER_NETWORK_CHANGE,
- _carrierNetworkChangeActive.value,
+ initialValue = _carrierNetworkChangeActive.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), _carrierNetworkChangeActive.value)
@@ -211,7 +195,7 @@
MutableStateFlow(ResolvedNetworkType.UnknownNetworkType)
override val resolvedNetworkType =
_resolvedNetworkType
- .logDiffsForTable(tableLogBuffer, columnPrefix = "", _resolvedNetworkType.value)
+ .logDiffsForTable(tableLogBuffer, initialValue = _resolvedNetworkType.value)
.stateIn(scope, SharingStarted.WhileSubscribed(), _resolvedNetworkType.value)
override val numberOfLevels =
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepository.kt
index 21a3410..5094bc7e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepository.kt
@@ -73,7 +73,6 @@
_isCarrierMerged
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = "isCarrierMerged",
initialValue = startingIsCarrierMerged,
)
@@ -128,9 +127,8 @@
.flatMapLatest { it.isEmergencyOnly }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_EMERGENCY,
- activeRepo.value.isEmergencyOnly.value,
+ initialValue = activeRepo.value.isEmergencyOnly.value,
)
.stateIn(
scope,
@@ -143,9 +141,8 @@
.flatMapLatest { it.isRoaming }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_ROAMING,
- activeRepo.value.isRoaming.value,
+ initialValue = activeRepo.value.isRoaming.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), activeRepo.value.isRoaming.value)
@@ -154,9 +151,8 @@
.flatMapLatest { it.operatorAlphaShort }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_OPERATOR,
- activeRepo.value.operatorAlphaShort.value,
+ initialValue = activeRepo.value.operatorAlphaShort.value,
)
.stateIn(
scope,
@@ -169,9 +165,8 @@
.flatMapLatest { it.isInService }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_IS_IN_SERVICE,
- activeRepo.value.isInService.value,
+ initialValue = activeRepo.value.isInService.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), activeRepo.value.isInService.value)
@@ -180,9 +175,8 @@
.flatMapLatest { it.isNonTerrestrial }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_IS_NTN,
- activeRepo.value.isNonTerrestrial.value,
+ initialValue = activeRepo.value.isNonTerrestrial.value,
)
.stateIn(
scope,
@@ -195,9 +189,8 @@
.flatMapLatest { it.isGsm }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_IS_GSM,
- activeRepo.value.isGsm.value,
+ initialValue = activeRepo.value.isGsm.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), activeRepo.value.isGsm.value)
@@ -206,9 +199,8 @@
.flatMapLatest { it.cdmaLevel }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_CDMA_LEVEL,
- activeRepo.value.cdmaLevel.value,
+ initialValue = activeRepo.value.cdmaLevel.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), activeRepo.value.cdmaLevel.value)
@@ -217,9 +209,8 @@
.flatMapLatest { it.primaryLevel }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_PRIMARY_LEVEL,
- activeRepo.value.primaryLevel.value,
+ initialValue = activeRepo.value.primaryLevel.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), activeRepo.value.primaryLevel.value)
@@ -228,9 +219,8 @@
.flatMapLatest { it.satelliteLevel }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_SATELLITE_LEVEL,
- activeRepo.value.satelliteLevel.value,
+ initialValue = activeRepo.value.satelliteLevel.value,
)
.stateIn(scope, SharingStarted.WhileSubscribed(), activeRepo.value.satelliteLevel.value)
@@ -239,8 +229,7 @@
.flatMapLatest { it.dataConnectionState }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
- activeRepo.value.dataConnectionState.value,
+ initialValue = activeRepo.value.dataConnectionState.value,
)
.stateIn(
scope,
@@ -253,8 +242,7 @@
.flatMapLatest { it.dataActivityDirection }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
- activeRepo.value.dataActivityDirection.value,
+ initialValue = activeRepo.value.dataActivityDirection.value,
)
.stateIn(
scope,
@@ -267,9 +255,8 @@
.flatMapLatest { it.carrierNetworkChangeActive }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = COL_CARRIER_NETWORK_CHANGE,
- activeRepo.value.carrierNetworkChangeActive.value,
+ initialValue = activeRepo.value.carrierNetworkChangeActive.value,
)
.stateIn(
scope,
@@ -282,8 +269,7 @@
.flatMapLatest { it.resolvedNetworkType }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
- activeRepo.value.resolvedNetworkType.value,
+ initialValue = activeRepo.value.resolvedNetworkType.value,
)
.stateIn(
scope,
@@ -296,7 +282,6 @@
.flatMapLatest { it.dataEnabled }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = "dataEnabled",
initialValue = activeRepo.value.dataEnabled.value,
)
@@ -307,7 +292,6 @@
.flatMapLatest { it.inflateSignalStrength }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = "inflate",
initialValue = activeRepo.value.inflateSignalStrength.value,
)
@@ -322,7 +306,6 @@
.flatMapLatest { it.allowNetworkSliceIndicator }
.logDiffsForTable(
tableLogBuffer,
- columnPrefix = "",
columnName = "allowSlice",
initialValue = activeRepo.value.allowNetworkSliceIndicator.value,
)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt
index 6337110..d336903 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt
@@ -380,7 +380,6 @@
.distinctUntilChanged()
.logDiffsForTable(
tableLogger,
- columnPrefix = "",
columnName = "defaultConnectionIsValidated",
initialValue = false,
)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt
index 36de2c1..a1f7a81 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt
@@ -238,7 +238,6 @@
.distinctUntilChanged()
.logDiffsForTable(
tableLogBuffer = tableLogBuffer,
- columnPrefix = "",
initialValue = DefaultIcon(defaultMobileIconGroup.value),
)
.stateIn(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt
index be9d8f7..171e4f5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt
@@ -191,7 +191,6 @@
.distinctUntilChanged()
.logDiffsForTable(
iconInteractor.tableLogBuffer,
- columnPrefix = "",
columnName = "visible",
initialValue = false,
)
@@ -249,7 +248,6 @@
.distinctUntilChanged()
.logDiffsForTable(
iconInteractor.tableLogBuffer,
- columnPrefix = "",
columnName = "showNetworkTypeIcon",
initialValue = false,
)
@@ -293,7 +291,6 @@
iconInteractor.isRoaming
.logDiffsForTable(
iconInteractor.tableLogBuffer,
- columnPrefix = "",
columnName = "roaming",
initialValue = false,
)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractor.kt
index 88b4802..569e02c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractor.kt
@@ -63,12 +63,7 @@
flowOf(false)
}
.distinctUntilChanged()
- .logDiffsForTable(
- tableLog,
- columnPrefix = "",
- columnName = COL_ALLOWED,
- initialValue = false,
- )
+ .logDiffsForTable(tableLog, columnName = COL_ALLOWED, initialValue = false)
.stateIn(scope, SharingStarted.WhileSubscribed(), false)
/** See [SatelliteConnectionState] for relevant states */
@@ -80,11 +75,7 @@
flowOf(SatelliteConnectionState.Off)
}
.distinctUntilChanged()
- .logDiffsForTable(
- tableLog,
- columnPrefix = "",
- initialValue = SatelliteConnectionState.Off,
- )
+ .logDiffsForTable(tableLog, initialValue = SatelliteConnectionState.Off)
.stateIn(scope, SharingStarted.WhileSubscribed(), SatelliteConnectionState.Off)
/** 0-4 description of the connection strength */
@@ -95,7 +86,7 @@
flowOf(0)
}
.distinctUntilChanged()
- .logDiffsForTable(tableLog, columnPrefix = "", columnName = COL_LEVEL, initialValue = 0)
+ .logDiffsForTable(tableLog, columnName = COL_LEVEL, initialValue = 0)
.stateIn(scope, SharingStarted.WhileSubscribed(), 0)
val isSatelliteProvisioned = repo.isSatelliteProvisioned
@@ -119,12 +110,7 @@
isOosAndNotEmergencyAndNotSatellite.all { it }
}
.distinctUntilChanged()
- .logDiffsForTable(
- tableLog,
- columnPrefix = "",
- columnName = COL_ALL_OOS,
- initialValue = true,
- )
+ .logDiffsForTable(tableLog, columnName = COL_ALL_OOS, initialValue = true)
/** When all connections are considered OOS, satellite connectivity is potentially valid */
val areAllConnectionsOutOfService =
@@ -152,12 +138,7 @@
flowOf(false)
}
.distinctUntilChanged()
- .logDiffsForTable(
- tableLog,
- columnPrefix = "",
- columnName = COL_FULL_OOS,
- initialValue = true,
- )
+ .logDiffsForTable(tableLog, columnName = COL_FULL_OOS, initialValue = true)
.stateIn(scope, SharingStarted.WhileSubscribed(), true)
/** True if any known mobile network is currently using a non terrestrial network */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt
index 5acedf1..a59d95f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt
@@ -195,7 +195,6 @@
.distinctUntilChanged()
.logDiffsForTable(
tableLogBuffer = tableLogger,
- columnPrefix = "",
columnName = COL_LOCK_TO_OCCLUDED,
initialValue = false,
)
@@ -228,7 +227,6 @@
.distinctUntilChanged()
.logDiffsForTable(
tableLogBuffer = tableLogger,
- columnPrefix = "",
columnName = COL_ALLOWED_BY_SCENE,
initialValue = false,
)
@@ -248,7 +246,6 @@
}
.logDiffsForTable(
tableLogBuffer = tableLogger,
- columnPrefix = "",
columnName = COL_NOTIF_LIGHTS_OUT,
initialValue = false,
)
@@ -306,7 +303,6 @@
.distinctUntilChanged()
.logDiffsForTable(
tableLogBuffer = tableLogger,
- columnPrefix = "",
columnName = COL_VISIBLE,
initialValue = false,
)
@@ -350,7 +346,6 @@
.distinctUntilChanged()
.logDiffsForTable(
tableLogBuffer = tableLogger,
- columnPrefix = "",
columnName = COL_SHOW_OPERATOR_NAME,
initialValue = false,
)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt
index 115de28..f9bba9d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt
@@ -300,19 +300,14 @@
wifiPickerTrackerInfo
.map { it.state == WifiManager.WIFI_STATE_ENABLED }
.distinctUntilChanged()
- .logDiffsForTable(
- tableLogger,
- columnPrefix = "",
- columnName = COL_NAME_IS_ENABLED,
- initialValue = false,
- )
+ .logDiffsForTable(tableLogger, columnName = COL_NAME_IS_ENABLED, initialValue = false)
.stateIn(scope, SharingStarted.Eagerly, false)
override val wifiNetwork: StateFlow<WifiNetworkModel> =
wifiPickerTrackerInfo
.map { it.primaryNetwork }
.distinctUntilChanged()
- .logDiffsForTable(tableLogger, columnPrefix = "", initialValue = WIFI_NETWORK_DEFAULT)
+ .logDiffsForTable(tableLogger, initialValue = WIFI_NETWORK_DEFAULT)
.stateIn(scope, SharingStarted.Eagerly, WIFI_NETWORK_DEFAULT)
override val secondaryNetworks: StateFlow<List<WifiNetworkModel>> =
@@ -321,7 +316,6 @@
.distinctUntilChanged()
.logDiffsForTable(
tableLogger,
- columnPrefix = "",
columnName = "secondaryNetworks",
initialValue = emptyList(),
)
@@ -400,12 +394,7 @@
wifiPickerTrackerInfo
.map { it.isDefault }
.distinctUntilChanged()
- .logDiffsForTable(
- tableLogger,
- columnPrefix = "",
- columnName = COL_NAME_IS_DEFAULT,
- initialValue = false,
- )
+ .logDiffsForTable(tableLogger, columnName = COL_NAME_IS_DEFAULT, initialValue = false)
.stateIn(scope, SharingStarted.Eagerly, false)
override val wifiActivity: StateFlow<DataActivityModel> =
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModel.kt
index f9556d2..986068b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModel.kt
@@ -89,7 +89,7 @@
else -> WifiIcon.Hidden
}
}
- .logDiffsForTable(wifiTableLogBuffer, columnPrefix = "", initialValue = WifiIcon.Hidden)
+ .logDiffsForTable(wifiTableLogBuffer, initialValue = WifiIcon.Hidden)
.stateIn(
scope,
started = SharingStarted.WhileSubscribed(),
diff --git a/services/core/java/com/android/server/om/OverlayManagerSettings.java b/services/core/java/com/android/server/om/OverlayManagerSettings.java
index b8b49f3e..f9758fc 100644
--- a/services/core/java/com/android/server/om/OverlayManagerSettings.java
+++ b/services/core/java/com/android/server/om/OverlayManagerSettings.java
@@ -26,13 +26,13 @@
import android.os.UserHandle;
import android.util.ArrayMap;
import android.util.ArraySet;
+import android.util.IndentingPrintWriter;
import android.util.Pair;
import android.util.Slog;
import android.util.Xml;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.CollectionUtils;
-import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.XmlUtils;
import com.android.modules.utils.TypedXmlPullParser;
import com.android.modules.utils.TypedXmlSerializer;
@@ -49,7 +49,6 @@
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;
-import java.util.stream.Stream;
/**
* Data structure representing the current state of all overlay packages in the
@@ -358,26 +357,29 @@
}
void dump(@NonNull final PrintWriter p, @NonNull DumpState dumpState) {
- // select items to display
- Stream<SettingsItem> items = mItems.stream();
- if (dumpState.getUserId() != UserHandle.USER_ALL) {
- items = items.filter(item -> item.mUserId == dumpState.getUserId());
- }
- if (dumpState.getPackageName() != null) {
- items = items.filter(item -> item.mOverlay.getPackageName()
- .equals(dumpState.getPackageName()));
- }
- if (dumpState.getOverlayName() != null) {
- items = items.filter(item -> item.mOverlay.getOverlayName()
- .equals(dumpState.getOverlayName()));
- }
+ final int userId = dumpState.getUserId();
+ final String packageName = dumpState.getPackageName();
+ final String overlayName = dumpState.getOverlayName();
+ final String field = dumpState.getField();
+ final var pw = new IndentingPrintWriter(p, " ");
- // display items
- final IndentingPrintWriter pw = new IndentingPrintWriter(p, " ");
- if (dumpState.getField() != null) {
- items.forEach(item -> dumpSettingsItemField(pw, item, dumpState.getField()));
- } else {
- items.forEach(item -> dumpSettingsItem(pw, item));
+ for (int i = 0; i < mItems.size(); i++) {
+ final var item = mItems.get(i);
+ if (userId != UserHandle.USER_ALL && userId != item.mUserId) {
+ continue;
+ }
+ if (packageName != null && !packageName.equals(item.mOverlay.getPackageName())) {
+ continue;
+ }
+ if (overlayName != null && !overlayName.equals(item.mOverlay.getOverlayName())) {
+ continue;
+ }
+
+ if (field != null) {
+ dumpSettingsItemField(pw, item, field);
+ } else {
+ dumpSettingsItem(pw, item);
+ }
}
}
diff --git a/tests/testables/src/android/testing/TestableLooper.java b/tests/testables/src/android/testing/TestableLooper.java
index 7d07d42..3ee6dc4 100644
--- a/tests/testables/src/android/testing/TestableLooper.java
+++ b/tests/testables/src/android/testing/TestableLooper.java
@@ -16,13 +16,11 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.app.Instrumentation;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.MessageQueue;
-import android.os.SystemClock;
import android.os.TestLooperManager;
import android.util.ArrayMap;
@@ -34,7 +32,7 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import java.util.LinkedList;
+import java.lang.reflect.Field;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -58,6 +56,9 @@
* catch crashes.
*/
public static final boolean HOLD_MAIN_THREAD = false;
+ private static final Field MESSAGE_QUEUE_MESSAGES_FIELD;
+ private static final Field MESSAGE_NEXT_FIELD;
+ private static final Field MESSAGE_WHEN_FIELD;
private Looper mLooper;
private MessageQueue mQueue;
@@ -66,6 +67,19 @@
private Handler mHandler;
private TestLooperManager mQueueWrapper;
+ static {
+ try {
+ MESSAGE_QUEUE_MESSAGES_FIELD = MessageQueue.class.getDeclaredField("mMessages");
+ MESSAGE_QUEUE_MESSAGES_FIELD.setAccessible(true);
+ MESSAGE_NEXT_FIELD = Message.class.getDeclaredField("next");
+ MESSAGE_NEXT_FIELD.setAccessible(true);
+ MESSAGE_WHEN_FIELD = Message.class.getDeclaredField("when");
+ MESSAGE_WHEN_FIELD.setAccessible(true);
+ } catch (NoSuchFieldException e) {
+ throw new RuntimeException("Failed to initialize TestableLooper", e);
+ }
+ }
+
public TestableLooper(Looper l) throws Exception {
this(acquireLooperManager(l), l);
}
@@ -208,17 +222,29 @@
}
public void moveTimeForward(long milliSeconds) {
- long futureWhen = SystemClock.uptimeMillis() + milliSeconds;
- // Find messages in the queue enqueued within the future time, and execute them now.
- while (true) {
- Long peekWhen = mQueueWrapper.peekWhen();
- if (peekWhen == null || peekWhen > futureWhen) {
- break;
+ try {
+ Message msg = getMessageLinkedList();
+ while (msg != null) {
+ long updatedWhen = msg.getWhen() - milliSeconds;
+ if (updatedWhen < 0) {
+ updatedWhen = 0;
+ }
+ MESSAGE_WHEN_FIELD.set(msg, updatedWhen);
+ msg = (Message) MESSAGE_NEXT_FIELD.get(msg);
}
- Message message = mQueueWrapper.poll();
- if (message != null) {
- mQueueWrapper.execute(message);
- }
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException("Access failed in TestableLooper: set - Message.when", e);
+ }
+ }
+
+ private Message getMessageLinkedList() {
+ try {
+ MessageQueue queue = mLooper.getQueue();
+ return (Message) MESSAGE_QUEUE_MESSAGES_FIELD.get(queue);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(
+ "Access failed in TestableLooper: get - MessageQueue.mMessages",
+ e);
}
}