Loading packages/SystemUI/src/com/android/systemui/qs/QSHost.java +0 −6 Original line number Diff line number Diff line Loading @@ -20,8 +20,6 @@ import android.content.res.Resources; import android.os.Build; import android.provider.Settings; import com.android.internal.logging.InstanceId; import com.android.internal.logging.UiEventLogger; import com.android.systemui.R; import com.android.systemui.plugins.qs.QSFactory; import com.android.systemui.plugins.qs.QSTile; Loading Loading @@ -55,11 +53,9 @@ public interface QSHost { return tiles; } void warn(String message, Throwable t); Context getContext(); Context getUserContext(); int getUserId(); UiEventLogger getUiEventLogger(); Collection<QSTile> getTiles(); void addCallback(Callback callback); void removeCallback(Callback callback); Loading Loading @@ -107,8 +103,6 @@ public interface QSHost { int indexOf(String tileSpec); InstanceId getNewInstanceId(); interface Callback { void onTilesChanged(); } Loading packages/SystemUI/src/com/android/systemui/qs/QSHostAdapter.kt +4 −28 Original line number Diff line number Diff line Loading @@ -19,8 +19,6 @@ package com.android.systemui.qs import android.content.ComponentName import android.content.Context import androidx.annotation.GuardedBy import com.android.internal.logging.InstanceId import com.android.internal.logging.UiEventLogger import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dump.DumpManager Loading @@ -39,10 +37,9 @@ import kotlinx.coroutines.launch /** * Adapter to determine what real class to use for classes that depend on [QSHost]. * * * When [Flags.QS_PIPELINE_NEW_HOST] is off, all calls will be routed to [QSTileHost]. * * When [Flags.QS_PIPELINE_NEW_HOST] is on, calls regarding the current set of tiles will be * routed to [CurrentTilesInteractor]. Other calls (like [warn]) will still be routed to * routed to [CurrentTilesInteractor]. Other calls (like [createTileView]) will still be routed to * [QSTileHost]. * * This routing also includes dumps. Loading Loading @@ -71,10 +68,7 @@ constructor( init { scope.launch { tileServiceRequestControllerBuilder.create(this@QSHostAdapter).init() } // Redirect dump to the correct host (needed for CTS tests) dumpManager.registerCriticalDumpable( TAG, if (useNewHost) interactor else qsTileHost ) dumpManager.registerCriticalDumpable(TAG, if (useNewHost) interactor else qsTileHost) } override fun getTiles(): Collection<QSTile> { Loading Loading @@ -103,10 +97,7 @@ constructor( override fun addCallback(callback: QSHost.Callback) { if (useNewHost) { val job = scope.launch { interactor.currentTiles.collect { callback.onTilesChanged() } } val job = scope.launch { interactor.currentTiles.collect { callback.onTilesChanged() } } synchronized(callbacksMap) { callbacksMap.put(callback, job) } } else { qsTileHost.addCallback(callback) Loading Loading @@ -147,10 +138,7 @@ constructor( override fun addTile(component: ComponentName, end: Boolean) { if (useNewHost) { interactor.addTile( TileSpec.create(component), if (end) POSITION_AT_END else 0 ) interactor.addTile(TileSpec.create(component), if (end) POSITION_AT_END else 0) } else { qsTileHost.addTile(component, end) } Loading @@ -164,10 +152,6 @@ constructor( } } override fun warn(message: String?, t: Throwable?) { qsTileHost.warn(message, t) } override fun getContext(): Context { return if (useNewHost) { context Loading @@ -192,10 +176,6 @@ constructor( } } override fun getUiEventLogger(): UiEventLogger { return qsTileHost.uiEventLogger } override fun createTileView( themedContext: Context?, tile: QSTile?, Loading @@ -219,8 +199,4 @@ constructor( override fun indexOf(tileSpec: String): Int { return specs.indexOf(tileSpec) } override fun getNewInstanceId(): InstanceId { return qsTileHost.newInstanceId } } packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java +0 −24 Original line number Diff line number Diff line Loading @@ -29,9 +29,6 @@ import androidx.annotation.MainThread; import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.InstanceId; import com.android.internal.logging.InstanceIdSequence; import com.android.internal.logging.UiEventLogger; import com.android.systemui.Dumpable; import com.android.systemui.ProtoDumpable; import com.android.systemui.R; Loading Loading @@ -91,7 +88,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P PanelInteractor, CustomTileAddedRepository { private static final String TAG = "QSTileHost"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final int MAX_QS_INSTANCE_ID = 1 << 20; // Shared prefs that hold tile lifecycle info. @VisibleForTesting Loading @@ -103,8 +99,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P private final TunerService mTunerService; private final PluginManager mPluginManager; private final QSLogger mQSLogger; private final UiEventLogger mUiEventLogger; private final InstanceIdSequence mInstanceIdSequence; private final CustomTileStatePersister mCustomTileStatePersister; private final Executor mMainExecutor; private final UserFileManager mUserFileManager; Loading Loading @@ -137,7 +131,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P Provider<AutoTileManager> autoTiles, Optional<CentralSurfaces> centralSurfacesOptional, QSLogger qsLogger, UiEventLogger uiEventLogger, UserTracker userTracker, SecureSettings secureSettings, CustomTileStatePersister customTileStatePersister, Loading @@ -150,13 +143,11 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P mTunerService = tunerService; mPluginManager = pluginManager; mQSLogger = qsLogger; mUiEventLogger = uiEventLogger; mMainExecutor = mainExecutor; mTileLifeCycleManagerFactory = tileLifecycleManagerFactory; mUserFileManager = userFileManager; mFeatureFlags = featureFlags; mInstanceIdSequence = new InstanceIdSequence(MAX_QS_INSTANCE_ID); mCentralSurfacesOptional = centralSurfacesOptional; mQsFactories.add(defaultFactory); Loading @@ -175,11 +166,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P }); } @Override public InstanceId getNewInstanceId() { return mInstanceIdSequence.newInstanceId(); } public void destroy() { mTiles.values().forEach(tile -> tile.destroy()); mAutoTiles.destroy(); Loading @@ -206,11 +192,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P onTuningChanged(TILES_SETTING, value); } @Override public UiEventLogger getUiEventLogger() { return mUiEventLogger; } @Override public void addCallback(Callback callback) { mCallbacks.add(callback); Loading @@ -226,11 +207,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P return mTiles.values(); } @Override public void warn(String message, Throwable t) { // already logged } @Override public void collapsePanels() { mCentralSurfacesOptional.ifPresent(CentralSurfaces::postAnimateCollapsePanels); Loading packages/SystemUI/src/com/android/systemui/qs/QsEventLogger.kt 0 → 100644 +44 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 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 com.android.systemui.qs import com.android.internal.logging.InstanceId import com.android.internal.logging.InstanceIdSequence import com.android.internal.logging.UiEventLogger import com.android.systemui.dagger.SysUISingleton import javax.inject.Inject interface QsEventLogger : UiEventLogger { fun getNewInstanceId(): InstanceId } @SysUISingleton class QsEventLoggerImpl @Inject constructor( uiEventLogger: UiEventLogger, ) : QsEventLogger, UiEventLogger by uiEventLogger { companion object { private const val MAX_QS_INSTANCE_ID = 1 shl 20 } val sequence = InstanceIdSequence(MAX_QS_INSTANCE_ID) override fun getNewInstanceId(): InstanceId { return sequence.newInstanceId() } } packages/SystemUI/src/com/android/systemui/qs/dagger/QSHostModule.kt +6 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import com.android.systemui.flags.Flags import com.android.systemui.qs.QSHost import com.android.systemui.qs.QSHostAdapter import com.android.systemui.qs.QSTileHost import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.QsEventLoggerImpl import com.android.systemui.qs.pipeline.data.repository.CustomTileAddedRepository import com.android.systemui.qs.pipeline.data.repository.CustomTileAddedSharedPrefsRepository import com.android.systemui.qs.pipeline.domain.interactor.PanelInteractor Loading @@ -34,8 +36,12 @@ interface QSHostModule { @Binds fun provideQsHost(controllerImpl: QSHostAdapter): QSHost @Binds fun provideEventLogger(impl: QsEventLoggerImpl): QsEventLogger @Module companion object { private const val MAX_QS_INSTANCE_ID = 1 shl 20 @Provides @JvmStatic fun providePanelInteractor( Loading Loading
packages/SystemUI/src/com/android/systemui/qs/QSHost.java +0 −6 Original line number Diff line number Diff line Loading @@ -20,8 +20,6 @@ import android.content.res.Resources; import android.os.Build; import android.provider.Settings; import com.android.internal.logging.InstanceId; import com.android.internal.logging.UiEventLogger; import com.android.systemui.R; import com.android.systemui.plugins.qs.QSFactory; import com.android.systemui.plugins.qs.QSTile; Loading Loading @@ -55,11 +53,9 @@ public interface QSHost { return tiles; } void warn(String message, Throwable t); Context getContext(); Context getUserContext(); int getUserId(); UiEventLogger getUiEventLogger(); Collection<QSTile> getTiles(); void addCallback(Callback callback); void removeCallback(Callback callback); Loading Loading @@ -107,8 +103,6 @@ public interface QSHost { int indexOf(String tileSpec); InstanceId getNewInstanceId(); interface Callback { void onTilesChanged(); } Loading
packages/SystemUI/src/com/android/systemui/qs/QSHostAdapter.kt +4 −28 Original line number Diff line number Diff line Loading @@ -19,8 +19,6 @@ package com.android.systemui.qs import android.content.ComponentName import android.content.Context import androidx.annotation.GuardedBy import com.android.internal.logging.InstanceId import com.android.internal.logging.UiEventLogger import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dump.DumpManager Loading @@ -39,10 +37,9 @@ import kotlinx.coroutines.launch /** * Adapter to determine what real class to use for classes that depend on [QSHost]. * * * When [Flags.QS_PIPELINE_NEW_HOST] is off, all calls will be routed to [QSTileHost]. * * When [Flags.QS_PIPELINE_NEW_HOST] is on, calls regarding the current set of tiles will be * routed to [CurrentTilesInteractor]. Other calls (like [warn]) will still be routed to * routed to [CurrentTilesInteractor]. Other calls (like [createTileView]) will still be routed to * [QSTileHost]. * * This routing also includes dumps. Loading Loading @@ -71,10 +68,7 @@ constructor( init { scope.launch { tileServiceRequestControllerBuilder.create(this@QSHostAdapter).init() } // Redirect dump to the correct host (needed for CTS tests) dumpManager.registerCriticalDumpable( TAG, if (useNewHost) interactor else qsTileHost ) dumpManager.registerCriticalDumpable(TAG, if (useNewHost) interactor else qsTileHost) } override fun getTiles(): Collection<QSTile> { Loading Loading @@ -103,10 +97,7 @@ constructor( override fun addCallback(callback: QSHost.Callback) { if (useNewHost) { val job = scope.launch { interactor.currentTiles.collect { callback.onTilesChanged() } } val job = scope.launch { interactor.currentTiles.collect { callback.onTilesChanged() } } synchronized(callbacksMap) { callbacksMap.put(callback, job) } } else { qsTileHost.addCallback(callback) Loading Loading @@ -147,10 +138,7 @@ constructor( override fun addTile(component: ComponentName, end: Boolean) { if (useNewHost) { interactor.addTile( TileSpec.create(component), if (end) POSITION_AT_END else 0 ) interactor.addTile(TileSpec.create(component), if (end) POSITION_AT_END else 0) } else { qsTileHost.addTile(component, end) } Loading @@ -164,10 +152,6 @@ constructor( } } override fun warn(message: String?, t: Throwable?) { qsTileHost.warn(message, t) } override fun getContext(): Context { return if (useNewHost) { context Loading @@ -192,10 +176,6 @@ constructor( } } override fun getUiEventLogger(): UiEventLogger { return qsTileHost.uiEventLogger } override fun createTileView( themedContext: Context?, tile: QSTile?, Loading @@ -219,8 +199,4 @@ constructor( override fun indexOf(tileSpec: String): Int { return specs.indexOf(tileSpec) } override fun getNewInstanceId(): InstanceId { return qsTileHost.newInstanceId } }
packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java +0 −24 Original line number Diff line number Diff line Loading @@ -29,9 +29,6 @@ import androidx.annotation.MainThread; import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.InstanceId; import com.android.internal.logging.InstanceIdSequence; import com.android.internal.logging.UiEventLogger; import com.android.systemui.Dumpable; import com.android.systemui.ProtoDumpable; import com.android.systemui.R; Loading Loading @@ -91,7 +88,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P PanelInteractor, CustomTileAddedRepository { private static final String TAG = "QSTileHost"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final int MAX_QS_INSTANCE_ID = 1 << 20; // Shared prefs that hold tile lifecycle info. @VisibleForTesting Loading @@ -103,8 +99,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P private final TunerService mTunerService; private final PluginManager mPluginManager; private final QSLogger mQSLogger; private final UiEventLogger mUiEventLogger; private final InstanceIdSequence mInstanceIdSequence; private final CustomTileStatePersister mCustomTileStatePersister; private final Executor mMainExecutor; private final UserFileManager mUserFileManager; Loading Loading @@ -137,7 +131,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P Provider<AutoTileManager> autoTiles, Optional<CentralSurfaces> centralSurfacesOptional, QSLogger qsLogger, UiEventLogger uiEventLogger, UserTracker userTracker, SecureSettings secureSettings, CustomTileStatePersister customTileStatePersister, Loading @@ -150,13 +143,11 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P mTunerService = tunerService; mPluginManager = pluginManager; mQSLogger = qsLogger; mUiEventLogger = uiEventLogger; mMainExecutor = mainExecutor; mTileLifeCycleManagerFactory = tileLifecycleManagerFactory; mUserFileManager = userFileManager; mFeatureFlags = featureFlags; mInstanceIdSequence = new InstanceIdSequence(MAX_QS_INSTANCE_ID); mCentralSurfacesOptional = centralSurfacesOptional; mQsFactories.add(defaultFactory); Loading @@ -175,11 +166,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P }); } @Override public InstanceId getNewInstanceId() { return mInstanceIdSequence.newInstanceId(); } public void destroy() { mTiles.values().forEach(tile -> tile.destroy()); mAutoTiles.destroy(); Loading @@ -206,11 +192,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P onTuningChanged(TILES_SETTING, value); } @Override public UiEventLogger getUiEventLogger() { return mUiEventLogger; } @Override public void addCallback(Callback callback) { mCallbacks.add(callback); Loading @@ -226,11 +207,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P return mTiles.values(); } @Override public void warn(String message, Throwable t) { // already logged } @Override public void collapsePanels() { mCentralSurfacesOptional.ifPresent(CentralSurfaces::postAnimateCollapsePanels); Loading
packages/SystemUI/src/com/android/systemui/qs/QsEventLogger.kt 0 → 100644 +44 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 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 com.android.systemui.qs import com.android.internal.logging.InstanceId import com.android.internal.logging.InstanceIdSequence import com.android.internal.logging.UiEventLogger import com.android.systemui.dagger.SysUISingleton import javax.inject.Inject interface QsEventLogger : UiEventLogger { fun getNewInstanceId(): InstanceId } @SysUISingleton class QsEventLoggerImpl @Inject constructor( uiEventLogger: UiEventLogger, ) : QsEventLogger, UiEventLogger by uiEventLogger { companion object { private const val MAX_QS_INSTANCE_ID = 1 shl 20 } val sequence = InstanceIdSequence(MAX_QS_INSTANCE_ID) override fun getNewInstanceId(): InstanceId { return sequence.newInstanceId() } }
packages/SystemUI/src/com/android/systemui/qs/dagger/QSHostModule.kt +6 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import com.android.systemui.flags.Flags import com.android.systemui.qs.QSHost import com.android.systemui.qs.QSHostAdapter import com.android.systemui.qs.QSTileHost import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.QsEventLoggerImpl import com.android.systemui.qs.pipeline.data.repository.CustomTileAddedRepository import com.android.systemui.qs.pipeline.data.repository.CustomTileAddedSharedPrefsRepository import com.android.systemui.qs.pipeline.domain.interactor.PanelInteractor Loading @@ -34,8 +36,12 @@ interface QSHostModule { @Binds fun provideQsHost(controllerImpl: QSHostAdapter): QSHost @Binds fun provideEventLogger(impl: QsEventLoggerImpl): QsEventLogger @Module companion object { private const val MAX_QS_INSTANCE_ID = 1 shl 20 @Provides @JvmStatic fun providePanelInteractor( Loading