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

Commit 363c10a9 authored by Yohei Yukawa's avatar Yohei Yukawa Committed by android-build-merger
Browse files

Merge "Introduce a result class for IStatusBarService#registerStatusBar()"...

Merge "Introduce a result class for IStatusBarService#registerStatusBar()" into qt-dev am: fd33fe0e
am: 1b3ebb83

Change-Id: I8551eec0d76f793f69afd72a2378dc495eb09fee
parents cee912e3 1b3ebb83
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -436,6 +436,7 @@ java_defaults {
        "core/java/com/android/internal/os/IShellCallback.aidl",
        "core/java/com/android/internal/statusbar/IStatusBar.aidl",
        "core/java/com/android/internal/statusbar/IStatusBarService.aidl",
        "core/java/com/android/internal/statusbar/RegisterStatusBarResult.aidl",
        "core/java/com/android/internal/textservice/ISpellCheckerService.aidl",
        "core/java/com/android/internal/textservice/ISpellCheckerServiceCallback.aidl",
        "core/java/com/android/internal/textservice/ISpellCheckerSession.aidl",
+2 −4
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.service.notification.StatusBarNotification;
import android.hardware.biometrics.IBiometricServiceReceiverInternal;

import com.android.internal.statusbar.IStatusBar;
import com.android.internal.statusbar.RegisterStatusBarResult;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarIconList;
import com.android.internal.statusbar.NotificationVisibility;
@@ -54,10 +55,7 @@ interface IStatusBarService

    // ---- Methods below are for use by the status bar policy services ----
    // You need the STATUS_BAR_SERVICE permission
    void registerStatusBar(IStatusBar callbacks, out List<String> iconSlots,
            out List<StatusBarIcon> iconList,
            out int[] switches, out List<IBinder> binders, out Rect fullscreenStackBounds,
            out Rect dockedStackBounds);
    RegisterStatusBarResult registerStatusBar(IStatusBar callbacks);
    void onPanelRevealed(boolean clearNotificationEffects, int numItems);
    void onPanelHidden();
    // Mark current notifications as "seen" and stop ringing, vibrating, blinking.
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.statusbar;

parcelable RegisterStatusBarResult;
+118 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.statusbar;

import android.graphics.Rect;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.ArrayMap;

/**
 * An immutable data object to return a set of values from StatusBarManagerService to its clients.
 */
public final class RegisterStatusBarResult implements Parcelable {
    public final ArrayMap<String, StatusBarIcon> mIcons;
    public final int mDisabledFlags1;                  // switch[0]
    public final int mSystemUiVisibility;              // switch[1]
    public final boolean mMenuVisible;                 // switch[2]
    public final int mImeWindowVis;                    // switch[3]
    public final int mImeBackDisposition;              // switch[4]
    public final boolean mShowImeSwitcher;             // switch[5]
    public final int mDisabledFlags2;                  // switch[6]
    public final int mFullscreenStackSysUiVisibility;  // switch[7]
    public final int mDockedStackSysUiVisibility;      // switch[8]
    public final IBinder mImeToken;
    public final Rect mFullscreenStackBounds;
    public final Rect mDockedStackBounds;

    public RegisterStatusBarResult(ArrayMap<String, StatusBarIcon> icons, int disabledFlags1,
            int systemUiVisibility, boolean menuVisible, int imeWindowVis, int imeBackDisposition,
            boolean showImeSwitcher, int disabledFlags2, int fullscreenStackSysUiVisibility,
            int dockedStackSysUiVisibility, IBinder imeToken, Rect fullscreenStackBounds,
            Rect dockedStackBounds) {
        mIcons = new ArrayMap<>(icons);
        mDisabledFlags1 = disabledFlags1;
        mSystemUiVisibility = systemUiVisibility;
        mMenuVisible = menuVisible;
        mImeWindowVis = imeWindowVis;
        mImeBackDisposition = imeBackDisposition;
        mShowImeSwitcher = showImeSwitcher;
        mDisabledFlags2 = disabledFlags2;
        mFullscreenStackSysUiVisibility = fullscreenStackSysUiVisibility;
        mDockedStackSysUiVisibility = dockedStackSysUiVisibility;
        mImeToken = imeToken;
        mFullscreenStackBounds = fullscreenStackBounds;
        mDockedStackBounds = dockedStackBounds;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeTypedArrayMap(mIcons, flags);
        dest.writeInt(mDisabledFlags1);
        dest.writeInt(mSystemUiVisibility);
        dest.writeBoolean(mMenuVisible);
        dest.writeInt(mImeWindowVis);
        dest.writeInt(mImeBackDisposition);
        dest.writeBoolean(mShowImeSwitcher);
        dest.writeInt(mDisabledFlags2);
        dest.writeInt(mFullscreenStackSysUiVisibility);
        dest.writeInt(mDockedStackSysUiVisibility);
        dest.writeStrongBinder(mImeToken);
        dest.writeParcelable(mFullscreenStackBounds, flags);
        dest.writeParcelable(mDockedStackBounds, flags);
    }

    /**
     * Used to make this class parcelable.
     */
    public static final Parcelable.Creator<RegisterStatusBarResult> CREATOR =
            new Parcelable.Creator<RegisterStatusBarResult>() {
                @Override
                public RegisterStatusBarResult createFromParcel(Parcel source) {
                    final ArrayMap<String, StatusBarIcon> icons =
                            source.createTypedArrayMap(StatusBarIcon.CREATOR);
                    final int disabledFlags1 = source.readInt();
                    final int systemUiVisibility = source.readInt();
                    final boolean menuVisible = source.readBoolean();
                    final int imeWindowVis = source.readInt();
                    final int imeBackDisposition = source.readInt();
                    final boolean showImeSwitcher = source.readBoolean();
                    final int disabledFlags2 = source.readInt();
                    final int fullscreenStackSysUiVisibility = source.readInt();
                    final int dockedStackSysUiVisibility = source.readInt();
                    final IBinder imeToken = source.readStrongBinder();
                    final Rect fullscreenStackBounds = Rect.CREATOR.createFromParcel(source);
                    final Rect dockedStackBounds = Rect.CREATOR.createFromParcel(source);
                    return new RegisterStatusBarResult(icons, disabledFlags1, systemUiVisibility,
                            menuVisible, imeWindowVis, imeBackDisposition, showImeSwitcher,
                            disabledFlags2, fullscreenStackSysUiVisibility,
                            dockedStackSysUiVisibility, imeToken, fullscreenStackBounds,
                            dockedStackBounds);
                }

                @Override
                public RegisterStatusBarResult[] newArray(int size) {
                    return new RegisterStatusBarResult[size];
                }
            };
}
+22 −27
Original line number Diff line number Diff line
@@ -81,7 +81,6 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
@@ -123,7 +122,7 @@ import com.android.internal.colorextraction.ColorExtractor;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.RegisterStatusBarResult;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
@@ -690,17 +689,11 @@ public class StatusBar extends SystemUI implements DemoMode,
        mCommandQueue = getComponent(CommandQueue.class);
        mCommandQueue.addCallback(this);

        int[] switches = new int[9];
        ArrayList<IBinder> binders = new ArrayList<>();
        ArrayList<String> iconSlots = new ArrayList<>();
        ArrayList<StatusBarIcon> icons = new ArrayList<>();
        Rect fullscreenStackBounds = new Rect();
        Rect dockedStackBounds = new Rect();
        RegisterStatusBarResult result = null;
        try {
            mBarService.registerStatusBar(mCommandQueue, iconSlots, icons, switches, binders,
                    fullscreenStackBounds, dockedStackBounds);
            result = mBarService.registerStatusBar(mCommandQueue);
        } catch (RemoteException ex) {
            // If the system process isn't there we're doomed anyway.
            ex.rethrowFromSystemServer();
        }

        createAndAddWindows();
@@ -714,28 +707,29 @@ public class StatusBar extends SystemUI implements DemoMode,
        // Set up the initial notification state. This needs to happen before CommandQueue.disable()
        setUpPresenter();

        setSystemUiVisibility(mDisplayId, switches[1], switches[7], switches[8], 0xffffffff,
                fullscreenStackBounds, dockedStackBounds);
        topAppWindowChanged(mDisplayId, switches[2] != 0);
        setSystemUiVisibility(mDisplayId, result.mSystemUiVisibility,
                result.mFullscreenStackSysUiVisibility, result.mDockedStackSysUiVisibility,
                0xffffffff, result.mFullscreenStackBounds, result.mDockedStackBounds);
        topAppWindowChanged(mDisplayId, result.mMenuVisible);
        // StatusBarManagerService has a back up of IME token and it's restored here.
        setImeWindowStatus(mDisplayId, binders.get(0), switches[3], switches[4], switches[5] != 0);
        setImeWindowStatus(mDisplayId, result.mImeToken, result.mImeWindowVis,
                result.mImeBackDisposition, result.mShowImeSwitcher);

        // Set up the initial icon state
        int N = iconSlots.size();
        for (int i=0; i < N; i++) {
            mCommandQueue.setIcon(iconSlots.get(i), icons.get(i));
        int numIcons = result.mIcons.size();
        for (int i = 0; i < numIcons; i++) {
            mCommandQueue.setIcon(result.mIcons.keyAt(i), result.mIcons.valueAt(i));
        }


        if (DEBUG) {
            Log.d(TAG, String.format(
                    "init: icons=%d disabled=0x%08x lights=0x%08x menu=0x%08x imeButton=0x%08x",
                   icons.size(),
                   switches[0],
                   switches[1],
                   switches[2],
                   switches[3]
                   ));
                    numIcons,
                    result.mDisabledFlags1,
                    result.mSystemUiVisibility,
                    result.mMenuVisible ? 1 : 0,
                    result.mImeWindowVis));
        }

        IntentFilter internalFilter = new IntentFilter();
@@ -774,9 +768,10 @@ public class StatusBar extends SystemUI implements DemoMode,

        // set the initial view visibility
        Dependency.get(InitController.class).addPostInitTask(this::updateAreThereNotifications);
        Dependency.get(InitController.class).addPostInitTask(() -> {
            setUpDisableFlags(switches[0], switches[6]);
        });
        int disabledFlags1 = result.mDisabledFlags1;
        int disabledFlags2 = result.mDisabledFlags2;
        Dependency.get(InitController.class).addPostInitTask(
                () -> setUpDisableFlags(disabledFlags1, disabledFlags2));

    }

Loading