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

Commit 03b39647 authored by Beverly's avatar Beverly
Browse files

Add interface for services to share SessionIds

- adds ability to start/end sessions via StatusBarService's
SessionMonitor
- adds ability to register/unregister for session listeners via
StatusBarService's SessionMonitor
- adds logic for SystemUI to start/end Keyguard and BiometricPrompt
sessions in SessionTracker

Test: atest AuthControllerTest SessionTrackerTest
Bug: 213483562

Change-Id: I50ea003baae4fb89e311fa442fd52397e03e514c
parent b5ac8648
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import com.android.internal.statusbar.NotificationVisibility;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.function.Consumer;

@@ -213,6 +214,34 @@ public class StatusBarManager {
    /** @hide */
    public static final int CAMERA_LAUNCH_SOURCE_LIFT_TRIGGER = 2;

    /**
     * Session flag for {@link #registerSessionListener} indicating the listener
     * is interested in sessions on the keygaurd
     * @hide
     */
    public static final int SESSION_KEYGUARD = 1 << 0;

    /**
     * Session flag for {@link #registerSessionListener} indicating the current session
     * is interested in session on the biometric prompt.
     * @hide
     */
    public static final int SESSION_BIOMETRIC_PROMPT = 1 << 1;

    /** @hide */
    public static final Set<Integer> ALL_SESSIONS = Set.of(
            SESSION_KEYGUARD,
            SESSION_BIOMETRIC_PROMPT
    );

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(flag = true, prefix = { "SESSION_KEYGUARD" }, value = {
            SESSION_KEYGUARD,
            SESSION_BIOMETRIC_PROMPT,
    })
    public @interface SessionFlags {}

    /**
     * Response indicating that the tile was not added.
     */
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2022, 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.internal.logging;

parcelable InstanceId;
+25 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2022, 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 permissons and
 * limitations under the License.
 */

package com.android.internal.statusbar;

import com.android.internal.logging.InstanceId;

/** {@hide} */
oneway interface ISessionListener {
    void onSessionStarted(int sessionType, in InstanceId instance);
    void onSessionEnded(int sessionType, in InstanceId instance);
}
 No newline at end of file
+15 −0
Original line number Diff line number Diff line
@@ -28,7 +28,9 @@ import android.os.Bundle;
import android.os.UserHandle;
import android.service.notification.StatusBarNotification;

import com.android.internal.logging.InstanceId;
import com.android.internal.statusbar.IAddTileResultCallback;
import com.android.internal.statusbar.ISessionListener;
import com.android.internal.statusbar.IStatusBar;
import com.android.internal.statusbar.RegisterStatusBarResult;
import com.android.internal.statusbar.StatusBarIcon;
@@ -178,4 +180,17 @@ interface IStatusBarService
    * @hide
    */
    int getNavBarModeOverride();

    /**
    * Register a listener for certain sessions. Each session may be guarded by its own permission.
    */
    void registerSessionListener(int sessionFlags, in ISessionListener listener);
    void unregisterSessionListener(int sessionFlags, in ISessionListener listener);

    /**
    * Informs all registered listeners that a session has begun and has the following instanceId.
    * Can only be set by callers with certain permission based on the session type being updated.
    */
    void onSessionStarted(int sessionType, in InstanceId instanceId);
    void onSessionEnded(int sessionType, in InstanceId instanceId);
}
+1 −0
Original line number Diff line number Diff line
@@ -309,6 +309,7 @@
        <item>com.android.systemui.globalactions.GlobalActionsComponent</item>
        <item>com.android.systemui.ScreenDecorations</item>
        <item>com.android.systemui.biometrics.AuthController</item>
        <item>com.android.systemui.log.SessionTracker</item>
        <item>com.android.systemui.SliceBroadcastRelayHandler</item>
        <item>com.android.systemui.statusbar.notification.InstantAppNotifier</item>
        <item>com.android.systemui.theme.ThemeOverlayController</item>
Loading