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

Commit 7adb70ae authored by Kenneth Ford's avatar Kenneth Ford Committed by Android (Google) Code Review
Browse files

Merge "Catch InvalidDisplayException" into main

parents 83c79c45 be8fa79a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -656,4 +656,12 @@ public class LogModule {
    public static LogBuffer providesLongPressTouchLog(LogBufferFactory factory) {
        return factory.create("LongPressViewLog", 200);
    }

    /** Provides a {@link LogBuffer} for use by long touch event handlers. */
    @Provides
    @SysUISingleton
    @RearDisplayLog
    public static LogBuffer providesRearDisplayLog(LogBufferFactory factory) {
        return factory.create("RearDisplayLog", 50);
    }
}
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.log.dagger;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import com.android.systemui.log.LogBuffer;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;

import javax.inject.Qualifier;

/** A {@link LogBuffer} for rear display dialog-related messages. */
@Qualifier
@Documented
@Retention(RUNTIME)
public @interface RearDisplayLog {
}
+15 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.Context
import android.hardware.devicestate.DeviceStateManager
import android.hardware.devicestate.feature.flags.Flags
import android.os.Handler
import android.view.WindowManager
import android.view.accessibility.AccessibilityManager
import androidx.annotation.VisibleForTesting
import com.android.keyguard.KeyguardUpdateMonitor
@@ -29,6 +30,9 @@ import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.display.domain.interactor.RearDisplayStateInteractor
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.core.LogLevel
import com.android.systemui.log.dagger.RearDisplayLog
import com.android.systemui.statusbar.phone.SystemUIDialog
import java.util.concurrent.atomic.AtomicBoolean
import javax.inject.Inject
@@ -58,6 +62,7 @@ internal constructor(
    private val keyguardUpdateMonitor: KeyguardUpdateMonitor,
    private val accessibilityManager: AccessibilityManager,
    @Background private val handler: Handler,
    @RearDisplayLog private val buffer: LogBuffer,
) : CoreStartable, AutoCloseable {

    companion object {
@@ -113,7 +118,16 @@ internal constructor(
                                                deviceStateManager::cancelStateRequest,
                                                touchExplorationEnabled.get(),
                                            )
                                        try {
                                            dialog = delegate.createDialog().apply { show() }
                                        } catch (e: WindowManager.InvalidDisplayException) {
                                            buffer.log(
                                                TAG,
                                                LogLevel.ERROR,
                                                "Rear display provided was unavailable",
                                                e,
                                            )
                                        }
                                    }
                                }

+2 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.runTest
import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.useUnconfinedTestDispatcher
import com.android.systemui.log.core.FakeLogBuffer
import com.android.systemui.rearDisplayInnerDialogDelegateFactory
import com.android.systemui.statusbar.phone.SystemUIDialog
import com.android.systemui.testKosmos
@@ -66,6 +67,7 @@ class RearDisplayCoreStartableTest : SysuiTestCase() {
            kosmos.keyguardUpdateMonitor,
            kosmos.accessibilityManager,
            kosmos.fakeExecutorHandler,
            FakeLogBuffer.Factory.create(),
        )

    @Before