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

Commit b574627e authored by Jason Monk's avatar Jason Monk
Browse files

SysUI: Actual MSIM status bar support

Expand SignalClusterView and NetworkController to handle multiple
SIMs.  It does this by creating multiple MobileSignalControllers
for each of the active subscriptions on the device.

Also some minor changes for followup on the NetworkController
refactor that went in before this.

Bug: 18222975
Change-Id: Ic7a857cfc5cadb46d51bb9ded0df8187eea799f7
parent fbeeac82
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<!--
Copyright (C) 2014 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="17dp"
        android:height="17dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">

    <path
        android:fillColor="#4DFFFFFF"
        android:pathData="M19.0,5.0c0.0,-1.1 -0.9,-2.0 -2.0,-2.0l-7.0,0.0L7.7,5.3L19.0,16.7L19.0,5.0zM3.7,3.9L2.4,5.2L5.0,7.8L5.0,19.0c0.0,1.1 0.9,2.0 2.0,2.0l10.0,0.0c0.4,0.0 0.7,-0.1 1.0,-0.3l1.9,1.9l1.3,-1.3L3.7,3.9z"/>
</vector>
+36 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/* apps/common/assets/default/default/skins/StatusBar.xml
**
** Copyright 2011, 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.
*/
-->
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mobile_combo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    >
    <ImageView
        android:id="@+id/mobile_signal"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        />
    <ImageView
        android:id="@+id/mobile_type"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        />
</FrameLayout>
+9 −18
Original line number Diff line number Diff line
@@ -50,27 +50,18 @@
        android:layout_height="4dp"
        android:visibility="gone"
        />
    <FrameLayout
    <LinearLayout
        android:id="@+id/mobile_signal_group"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        >
        <FrameLayout
            android:id="@+id/mobile_combo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            >
    </LinearLayout>
    <ImageView
                android:id="@+id/mobile_signal"
        android:id="@+id/no_sims"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:src="@drawable/stat_sys_no_sims"
        />
            <ImageView
                android:id="@+id/mobile_type"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                />
        </FrameLayout>
    </FrameLayout>
    <View
        android:id="@+id/wifi_airplane_spacer"
        android:layout_width="4dp"
+3 −0
Original line number Diff line number Diff line
@@ -515,6 +515,9 @@
         type icon is wide. -->
    <dimen name="wide_type_icon_start_padding">2dp</dimen>

    <!-- Extra padding between multiple phone signal icons. -->
    <dimen name="secondary_telephony_padding">2dp</dimen>

    <!-- Extra padding between the mobile data type icon and the strength indicator when the data
         type icon is wide for the tile in quick settings. -->
    <dimen name="wide_type_icon_start_padding_qs">3dp</dimen>
+30 −23
Original line number Diff line number Diff line
@@ -147,16 +147,15 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
    }

    private final NetworkSignalChangedCallback mCallback = new NetworkSignalChangedCallback() {
        private boolean mWifiEnabled;
        private boolean mWifiConnected;
        private boolean mAirplaneModeEnabled;
        private final CallbackInfo mInfo = new CallbackInfo();

        @Override
        public void onWifiSignalChanged(boolean enabled, boolean connected, int wifiSignalIconId,
                boolean activityIn, boolean activityOut,
                String wifiSignalContentDescriptionId, String description) {
            mWifiEnabled = enabled;
            mWifiConnected = connected;
            mInfo.wifiEnabled = enabled;
            mInfo.wifiConnected = connected;
            refreshState(mInfo);
        }

        @Override
@@ -164,28 +163,35 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
                int mobileSignalIconId,
                String mobileSignalContentDescriptionId, int dataTypeIconId,
                boolean activityIn, boolean activityOut,
                String dataTypeContentDescriptionId, String description, boolean noSim,
                String dataTypeContentDescriptionId, String description,
                boolean isDataTypeIconWide) {
            final CallbackInfo info = new CallbackInfo();  // TODO pool?
            info.enabled = enabled;
            info.wifiEnabled = mWifiEnabled;
            info.wifiConnected = mWifiConnected;
            info.airplaneModeEnabled = mAirplaneModeEnabled;
            info.mobileSignalIconId = mobileSignalIconId;
            info.signalContentDescription = mobileSignalContentDescriptionId;
            info.dataTypeIconId = dataTypeIconId;
            info.dataContentDescription = dataTypeContentDescriptionId;
            info.activityIn = activityIn;
            info.activityOut = activityOut;
            info.enabledDesc = description;
            info.noSim = noSim;
            info.isDataTypeIconWide = isDataTypeIconWide;
            refreshState(info);
            mInfo.enabled = enabled;
            mInfo.mobileSignalIconId = mobileSignalIconId;
            mInfo.signalContentDescription = mobileSignalContentDescriptionId;
            mInfo.dataTypeIconId = dataTypeIconId;
            mInfo.dataContentDescription = dataTypeContentDescriptionId;
            mInfo.activityIn = activityIn;
            mInfo.activityOut = activityOut;
            mInfo.enabledDesc = description;
            mInfo.isDataTypeIconWide = isDataTypeIconWide;
            refreshState(mInfo);
        }

        @Override
        public void onNoSimVisibleChanged(boolean visible) {
            mInfo.noSim = visible;
            if (mInfo.noSim) {
                // Make sure signal gets cleared out when no sims.
                mInfo.mobileSignalIconId = 0;
                mInfo.dataTypeIconId = 0;
            }
            refreshState(mInfo);
        }

        @Override
        public void onAirplaneModeChanged(boolean enabled) {
            mAirplaneModeEnabled = enabled;
            mInfo.airplaneModeEnabled = enabled;
            refreshState(mInfo);
        }

        public void onMobileDataEnabled(boolean enabled) {
@@ -203,7 +209,8 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
        @Override
        public Boolean getToggleState() {
            return mDataController.isMobileDataSupported()
                    ? mDataController.isMobileDataEnabled() : null;
                    ? mDataController.isMobileDataEnabled()
                    : null;
        }

        @Override
Loading