Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36016082 authored by Dave Mankoff's avatar Dave Mankoff Committed by Android (Google) Code Review
Browse files

Merge "Remove #onConfigurationChanged from CoreStartable" into main

parents 4a26f33e cdb7d939
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -923,14 +923,14 @@ public class AuthControllerTest extends SysuiTestCase {
        doReturn(500).when(mResources)
                .getDimensionPixelSize(eq(com.android.systemui.res.R.dimen
                        .physical_fingerprint_sensor_center_screen_location_y));
        mAuthController.onConfigurationChanged(null /* newConfig */);
        mAuthController.onConfigChanged(null /* newConfig */);

        final Point firstFpLocation = mAuthController.getFingerprintSensorLocation();

        doReturn(1000).when(mResources)
                .getDimensionPixelSize(eq(com.android.systemui.res.R.dimen
                        .physical_fingerprint_sensor_center_screen_location_y));
        mAuthController.onConfigurationChanged(null /* newConfig */);
        mAuthController.onConfigChanged(null /* newConfig */);

        assertNotSame(firstFpLocation, mAuthController.getFingerprintSensorLocation());
    }
+0 −9
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.systemui;

import android.content.res.Configuration;

import androidx.annotation.NonNull;

import java.io.PrintWriter;
@@ -42,13 +40,6 @@ public interface CoreStartable extends Dumpable {
    /** Main entry point for implementations. Called shortly after SysUI startup. */
    void start();

    /** Called when the device configuration changes. This will not be called before
     * {@link #start()}, but it could be called before {@link #onBootCompleted()}.
     *
     * @see android.app.Application#onConfigurationChanged(Configuration)  */
    default void onConfigurationChanged(Configuration newConfig) {
    }

    @Override
    default void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
    }
+5 −3
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ import com.android.systemui.settings.DisplayTracker;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.commandline.CommandRegistry;
import com.android.systemui.statusbar.events.PrivacyDotViewController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.concurrency.ThreadFactory;
import com.android.systemui.util.settings.SecureSettings;
@@ -109,7 +110,8 @@ import javax.inject.Inject;
 * for antialiasing and emulation purposes.
 */
@SysUISingleton
public class ScreenDecorations implements CoreStartable, Dumpable {
public class ScreenDecorations implements
        CoreStartable, ConfigurationController.ConfigurationListener, Dumpable {
    private static final boolean DEBUG_LOGGING = false;
    private static final String TAG = "ScreenDecorations";

@@ -575,7 +577,7 @@ public class ScreenDecorations implements CoreStartable, Dumpable {

                    if (mPendingManualConfigUpdate) {
                        mPendingManualConfigUpdate = false;
                        onConfigurationChanged(mContext.getResources().getConfiguration());
                        onConfigChanged(mContext.getResources().getConfiguration());
                    }
                }
            }
@@ -1062,7 +1064,7 @@ public class ScreenDecorations implements CoreStartable, Dumpable {
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
    public void onConfigChanged(Configuration newConfig) {
        if (DEBUG_DISABLE_SCREEN_DECORATIONS) {
            Log.i(TAG, "ScreenDecorations is disabled");
            return;
+38 −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

import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener
import dagger.Binds
import dagger.Module
import dagger.multibindings.ClassKey
import dagger.multibindings.IntoMap
import dagger.multibindings.IntoSet

@Module
interface ScreenDecorationsModule {
    /** Start ScreenDecorations. */
    @Binds
    @IntoMap
    @ClassKey(ScreenDecorations::class)
    fun bindScreenDecorationsCoreStartable(impl: ScreenDecorations): CoreStartable

    /** Listen to config changes for ScreenDecorations. */
    @Binds
    @IntoSet
    fun bindScreenDecorationsConfigListener(impl: ScreenDecorations): ConfigurationListener
}
+1 −14
Original line number Diff line number Diff line
@@ -37,11 +37,11 @@ import android.view.SurfaceControl;
import android.view.ThreadedRenderer;
import android.view.View;

import com.android.systemui.res.R;
import com.android.internal.protolog.common.ProtoLog;
import com.android.systemui.dagger.GlobalRootComponent;
import com.android.systemui.dagger.SysUIComponent;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.util.NotificationChannels;

@@ -354,19 +354,6 @@ public class SystemUIApplication extends Application implements
            }
            configController.onConfigurationChanged(newConfig);
            Trace.endSection();
            int len = mServices.length;
            for (int i = 0; i < len; i++) {
                if (mServices[i] != null) {
                    if (Trace.isEnabled()) {
                        Trace.traceBegin(
                                Trace.TRACE_TAG_APP,
                                mServices[i].getClass().getSimpleName()
                                        + ".onConfigurationChanged()");
                    }
                    mServices[i].onConfigurationChanged(newConfig);
                    Trace.endSection();
                }
            }
        }
    }

Loading