Merge "Move QS cell indicator back into mobile data tile" into oc-dev

This commit is contained in:
Jason Monk
2017-06-08 16:35:21 +00:00
committed by Android (Google) Code Review
26 changed files with 434 additions and 150 deletions

View File

@@ -198,14 +198,20 @@ public interface QSTile {
public static final int VERSION = 1;
public boolean activityIn;
public boolean activityOut;
public boolean isOverlayIconWide;
public int overlayIconId;
@Override
public boolean copyTo(State other) {
final SignalState o = (SignalState) other;
final boolean changed = o.activityIn != activityIn
|| o.activityOut != activityOut;
|| o.activityOut != activityOut
|| o.isOverlayIconWide != isOverlayIconWide
|| o.overlayIconId != overlayIconId;
o.activityIn = activityIn;
o.activityOut = activityOut;
o.isOverlayIconWide = isOverlayIconWide;
o.overlayIconId = overlayIconId;
return super.copyTo(other) || changed;
}

View File

@@ -14,10 +14,11 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="17.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
android:width="24dp"
android:height="24.0dp"
android:viewportWidth="40.0"
android:viewportHeight="40.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M19.0,6.41L17.59,5.0 12.0,10.59 6.41,5.0 5.0,6.41 10.59,12.0 5.0,17.59 6.41,19.0 12.0,13.41 17.59,19.0 19.0,17.59 13.41,12.0z"/>

View File

@@ -0,0 +1,28 @@
<!--
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="24.0dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M3.500000,11.000000L1.800000,11.000000L1.800000,4.400000L0.200000,5.100000L0.200000,3.700000l3.100000,-1.300000l0.200000,0.000000L3.500000,11.000000z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M8.600000,5.500000l1.200000,-3.000000l1.900000,0.000000L9.700000,6.700000l2.200000,4.300000L9.900000,11.000000L8.700000,7.900000L7.400000,11.000000L5.500000,11.000000l2.100000,-4.300000L5.600000,2.500000l1.900000,0.000000L8.600000,5.500000z"/>
</vector>

View File

@@ -0,0 +1,28 @@
<!--
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="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M2.000000,6.000000l0.800000,0.000000c0.300000,0.000000 0.500000,-0.100000 0.700000,-0.300000s0.200000,-0.500000 0.200000,-0.900000c0.000000,-0.300000 -0.100000,-0.600000 -0.200000,-0.800000S3.200000,3.700000 2.900000,3.700000C2.700000,3.700000 2.500000,3.800000 2.300000,4.000000S2.100000,4.400000 2.100000,4.700000L0.500000,4.700000C0.500000,4.000000 0.700000,3.400000 1.100000,3.000000s1.000000,-0.600000 1.700000,-0.600000c0.800000,0.000000 1.400000,0.200000 1.900000,0.600000s0.700000,1.000000 0.700000,1.800000c0.000000,0.400000 -0.100000,0.700000 -0.300000,1.100000S4.600000,6.500000 4.300000,6.600000C4.700000,6.800000 5.000000,7.100000 5.200000,7.400000s0.300000,0.700000 0.300000,1.200000c0.000000,0.800000 -0.200000,1.400000 -0.700000,1.800000s-1.100000,0.700000 -1.900000,0.700000c-0.700000,0.000000 -1.300000,-0.200000 -1.800000,-0.600000s-0.700000,-1.000000 -0.700000,-1.800000L2.000000,8.700000C2.000000,9.000000 2.100000,9.300000 2.300000,9.500000s0.400000,0.300000 0.600000,0.300000c0.300000,0.000000 0.500000,-0.100000 0.700000,-0.300000S3.900000,9.000000 3.900000,8.600000c0.000000,-0.500000 -0.100000,-0.800000 -0.300000,-1.000000S3.200000,7.300000 2.800000,7.300000L2.000000,7.300000L2.000000,6.000000z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12.500000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S6.700000,9.000000 6.700000,7.900000L6.700000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000s1.200000,-0.800000 2.100000,-0.800000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000l-1.600000,0.000000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000s-0.500000,-0.300000 -0.900000,-0.300000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S8.400000,5.000000 8.400000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L10.799999,7.800000L9.600000,7.800000L9.600000,6.600000l2.900000,0.000000L12.500000,9.900000z"/>
</vector>

View File

@@ -0,0 +1,28 @@
<!--
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="24.0dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M4.600000,7.800000l0.700000,0.000000l0.000000,1.300000L4.600000,9.100000L4.600000,11.000000L3.000000,11.000000L3.000000,9.200000L0.100000,9.200000L0.000000,8.100000L3.000000,2.500000l1.700000,0.000000L4.700000,7.800000zM1.600000,7.800000L3.000000,7.800000l0.000000,-3.000000L2.900000,5.000000L1.600000,7.800000z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M11.900000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S6.100000,9.000000 6.100000,7.900000L6.100000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000S8.100000,2.400000 9.000000,2.400000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000l-1.600000,0.000000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000S9.500000,3.700000 9.000000,3.700000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S7.700000,5.000000 7.700000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L10.099999,7.800000L9.000000,7.800000L9.000000,6.600000l2.900000,0.000000L11.900000,9.900000z"/>
</vector>

View File

@@ -0,0 +1,31 @@
<!--
Copyright (C) 2016 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="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M4.6,7.8l0.7,0.0l0.0,1.3L4.6,9.1L4.6,11.0L3.0,11.0L3.0,9.2L0.1,9.2L0.0,8.2l3.0,-5.7l1.7,0.0L4.6,7.8L4.6,7.8zM1.7,7.8L3.0,7.8l0.0,-3.0L2.9,5.0L1.7,7.8z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M11.9,9.9c-0.2,0.4 -0.6,0.7 -1.0,0.9s-1.0,0.4 -1.8,0.4c-0.9,0.0 -1.7,-0.3 -2.2,-0.8S6.1,9.0 6.1,7.9L6.1,5.6c0.0,-1.1 0.3,-1.9 0.8,-2.4S8.2,2.4 9.0,2.4c1.0,0.0 1.7,0.2 2.1,0.7s0.7,1.2 0.7,2.1l-1.6,0.0c0.0,-0.5 -0.1,-0.9 -0.2,-1.1S9.5,3.7 9.0,3.7c-0.4,0.0 -0.7,0.2 -0.9,0.5S7.8,5.0 7.8,5.6l0.0,2.3c0.0,0.7 0.1,1.1 0.3,1.4c0.2,0.3 0.6,0.5 1.0,0.5c0.3,0.0 0.6,0.0 0.7,-0.1s0.3,-0.2 0.4,-0.3L10.2,7.8L9.0,7.8L9.0,6.6l2.9,0.0L11.9,9.9z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M17.7,4.4l-1.900001,0.0 0.0,-1.9 -1.2,0.0 0.0,1.9 -1.900001,0.0 0.0,1.2 1.900001,0.0 0.0,1.9 1.2,0.0 0.0,-1.9 1.900001,0.0z"/>
</vector>

View File

@@ -0,0 +1,29 @@
<!--
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:autoMirrored="true"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M21.799999,22.299999l-1.199999,-1.299999 0.000000,0.000000 -9.600000,-10.000000 0.000000,0.000000 -6.400000,-6.700000 -1.300000,1.300000 6.400000,6.700000 -8.700000,8.700000 16.900000,0.000000 2.600000,2.700001z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M21.000000,1.000000l-8.600000,8.600000 8.600000,9.100000z"/>
</vector>

View File

@@ -0,0 +1,28 @@
<!--
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="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<group
android:translateX="3.5" >
<path
android:fillColor="#FFFFFFFF"
android:pathData="M4.400000,7.300000L1.700000,7.300000l0.000000,2.400000l3.300000,0.000000L5.000000,11.000000L0.000000,11.000000L0.000000,2.500000l4.900000,0.000000l0.000000,1.300000L1.700000,3.800000l0.000000,2.100000l2.800000,0.000000L4.500000,7.300000z"/>
</group>
</vector>

View File

@@ -0,0 +1,27 @@
<!--
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="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<group android:translateX="3.5" >
<path
android:fillColor="#FFFFFFFF"
android:pathData="M6.500000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S0.700000,9.000000 0.700000,7.900000L0.700000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000s1.200000,-0.800000 2.100000,-0.800000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000L4.700000,5.200000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000S4.000000,3.700000 3.600000,3.700000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S2.300000,5.000000 2.300000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L4.700000,7.800000L3.500000,7.800000L3.500000,6.600000l2.900000,0.000000L6.400000,9.900000z"/>
</group>
</vector>

View File

@@ -0,0 +1,28 @@
<!--
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="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<group
android:translateX="3.5" >
<path
android:fillColor="#FFFFFFFF"
android:pathData="M6.000000,11.000000L4.400000,11.000000L4.400000,7.500000L1.700000,7.500000L1.700000,11.000000L0.000000,11.000000L0.000000,2.500000l1.700000,0.000000l0.000000,3.700000l2.700000,0.000000L4.400000,2.500000L6.000000,2.500000L6.000000,11.000000z"/>
</group>
</vector>

View File

@@ -0,0 +1,31 @@
<!--
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="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M2.000000,9.700000l2.000000,0.000000L4.000000,11.000000L0.300000,11.000000L0.300000,2.500000L2.000000,2.500000L2.000000,9.700000z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M8.300000,3.800000L7.000000,3.800000L7.000000,11.000000L5.300000,11.000000L5.300000,3.800000L4.000000,3.800000L4.000000,2.500000l4.300000,0.000000L8.300000,3.800000z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12.400000,7.300000l-1.700000,0.000000l0.000000,2.400000l2.100000,0.000000L12.799999,11.000000L9.000000,11.000000L9.000000,2.500000l3.700000,0.000000l0.000000,1.300000l-2.100000,0.000000l0.000000,2.100000l1.700000,0.000000L12.300000,7.300000z"/>
</vector>

View File

@@ -0,0 +1,34 @@
<!--
Copyright (C) 2016 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="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M2.0,9.7l2.0,0.0L4.0,11.0L0.4,11.0L0.4,2.5L2.0,2.5L2.0,9.7z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M8.3,3.8L7.0,3.8L7.0,11.0L5.4,11.0L5.4,3.8L4.0,3.8L4.0,2.5l4.3,0.0L8.3,3.8z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12.4,7.3l-1.7,0.0l0.0,2.4l2.1,0.0L12.799999,11.0L9.0,11.0L9.0,2.5l3.7,0.0l0.0,1.3l-2.1,0.0l0.0,2.1l1.7,0.0L12.4,7.3L12.4,7.3z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M18.4,4.4l-1.9,0.0 0.0,-1.9 -1.2,0.0 0.0,1.9 -1.900001,0.0 0.0,1.2 1.900001,0.0 0.0,1.9 1.2,0.0 0.0,-1.9 1.9,0.0z"/>
</vector>

View File

@@ -56,15 +56,10 @@
android:textColor="?android:attr/textColorPrimary"
android:singleLine="true" />
<FrameLayout
android:id="@+id/system_icons_container"
android:layout_width="wrap_content"
<com.android.systemui.BatteryMeterView android:id="@+id/battery"
android:layout_height="match_parent"
android:layout_gravity="center_vertical">
<include layout="@layout/system_icons" />
</FrameLayout>
android:layout_width="wrap_content"
/>
<com.android.systemui.statusbar.policy.Clock
android:id="@+id/clock"

View File

@@ -15,39 +15,56 @@
package com.android.systemui.qs;
import android.content.Context;
import android.content.res.ColorStateList;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;
import com.android.settingslib.Utils;
import com.android.systemui.R;
import com.android.systemui.plugins.qs.QSTile.Icon;
import com.android.systemui.plugins.qs.QSTile.State;
import com.android.systemui.qs.tileimpl.QSTileImpl.ResourceIcon;
import com.android.systemui.statusbar.phone.SignalDrawable;
import java.util.Objects;
// Exists to provide easy way to add sim icon to cell tile
// TODO Find a better way to handle this and remove it.
public class CellTileView extends SignalTileView {
private final ImageView mOverlay;
private final SignalDrawable mSignalDrawable;
public CellTileView(Context context) {
super(context);
mOverlay = new ImageView(mContext);
mOverlay.setImageTintList(ColorStateList.valueOf(Utils.getColorAttr(context,
android.R.attr.colorPrimary)));
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT);
int padding = context.getResources().getDimensionPixelOffset(R.dimen.cell_overlay_padding);
params.leftMargin = params.rightMargin = padding;
mIconFrame.addView(mOverlay, params);
mSignalDrawable = new SignalDrawable(mContext);
float dark = Utils.getColorAttr(context, android.R.attr.colorForeground) == 0xff000000
? 1 : 0;
mSignalDrawable.setDarkIntensity(dark);
mSignalDrawable.setIntrinsicSize(context.getResources().getDimensionPixelSize(
R.dimen.qs_tile_icon_size));
}
@Override
public void setIcon(State state) {
State s = state.copy();
updateIcon(mOverlay, state);
s.icon = ResourceIcon.get(R.drawable.ic_sim);
super.setIcon(s);
protected void updateIcon(ImageView iv, State state) {
if (!Objects.equals(state.icon, iv.getTag(R.id.qs_icon_tag))) {
mSignalDrawable.setLevel(((SignalIcon) state.icon).getState());
iv.setImageDrawable(mSignalDrawable);
iv.setTag(R.id.qs_icon_tag, state.icon);
}
}
public static class SignalIcon extends Icon {
private final int mState;
public SignalIcon(int state) {
mState = state;
}
public int getState() {
return mState;
}
@Override
public Drawable getDrawable(Context context) {
return null;
}
}
}

View File

@@ -23,11 +23,13 @@ import android.support.annotation.VisibleForTesting;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextClock;
import com.android.settingslib.Utils;
import com.android.systemui.BatteryMeterView;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.R.id;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.qs.QSDetail.Callback;
import com.android.systemui.statusbar.SignalClusterView;
@@ -69,15 +71,11 @@ public class QuickStatusBarHeader extends RelativeLayout {
float intensity = colorForeground == Color.WHITE ? 0 : 1;
Rect tintArea = new Rect(0, 0, 0, 0);
applyDarkness(R.id.signal_cluster, tintArea, intensity, colorForeground);
applyDarkness(R.id.battery, tintArea, intensity, colorForeground);
applyDarkness(R.id.clock, tintArea, intensity, colorForeground);
BatteryMeterView battery = findViewById(R.id.battery);
battery.setForceShowPercent(true);
// Don't show the Wi-Fi indicator here, because it is shown just below in the tile.
SignalClusterView signalCluster = findViewById(R.id.signal_cluster);
signalCluster.setQsSignalCluster();
mActivityStarter = Dependency.get(ActivityStarter.class);
}

View File

@@ -35,6 +35,7 @@ public class SignalTileView extends QSIconViewImpl {
protected FrameLayout mIconFrame;
protected ImageView mSignal;
private ImageView mOverlay;
private ImageView mIn;
private ImageView mOut;
@@ -63,6 +64,8 @@ public class SignalTileView extends QSIconViewImpl {
mIconFrame = new FrameLayout(mContext);
mSignal = new ImageView(mContext);
mIconFrame.addView(mSignal);
mOverlay = new ImageView(mContext);
mIconFrame.addView(mOverlay, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
return mIconFrame;
}
@@ -108,7 +111,18 @@ public class SignalTileView extends QSIconViewImpl {
public void setIcon(QSTile.State state) {
final SignalState s = (SignalState) state;
setIcon(mSignal, s);
Drawable drawable = mSignal.getDrawable();
if (s.overlayIconId > 0) {
mOverlay.setVisibility(VISIBLE);
mOverlay.setImageResource(s.overlayIconId);
} else {
mOverlay.setVisibility(GONE);
}
if (s.overlayIconId > 0 && s.isOverlayIconWide) {
mSignal.setPaddingRelative(mWideOverlayIconStartPadding, 0, 0, 0);
} else {
mSignal.setPaddingRelative(0, 0, 0, 0);
}
final boolean shown = isShown();
setVisibility(mIn, shown, s.activityIn);
setVisibility(mOut, shown, s.activityOut);

View File

@@ -35,6 +35,8 @@ import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.qs.DetailAdapter;
import com.android.systemui.plugins.qs.QSIconView;
import com.android.systemui.plugins.qs.QSTile.SignalState;
import com.android.systemui.qs.CellTileView;
import com.android.systemui.qs.CellTileView.SignalIcon;
import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.SignalTileView;
import com.android.systemui.qs.tileimpl.QSTileImpl;
@@ -83,7 +85,7 @@ public class CellularTile extends QSTileImpl<SignalState> {
@Override
public QSIconView createTileView(Context context) {
return new SignalTileView(context);
return new CellTileView(context);
}
@Override
@@ -120,23 +122,25 @@ public class CellularTile extends QSTileImpl<SignalState> {
final Resources r = mContext.getResources();
state.activityIn = cb.enabled && cb.activityIn;
state.activityOut = cb.enabled && cb.activityOut;
state.isOverlayIconWide = cb.isDataTypeIconWide;
state.overlayIconId = cb.dataTypeIconId;
state.label = r.getString(R.string.mobile_data);
state.contentDescription = state.label;
final String signalContentDesc = cb.enabled && (cb.mobileSignalIconId > 0)
? cb.signalContentDescription
: r.getString(R.string.accessibility_no_signal);
if (cb.noSim) {
state.contentDescription = state.label;
} else {
state.contentDescription = signalContentDesc + ", " + state.label;
}
state.expandedAccessibilityClassName = Switch.class.getName();
state.value = mDataController.isMobileDataSupported()
&& mDataController.isMobileDataEnabled();
state.icon = ResourceIcon.get(R.drawable.ic_data_unavailable);
state.state = cb.airplaneModeEnabled || !cb.enabled ? Tile.STATE_UNAVAILABLE
: state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
if (state.state == Tile.STATE_ACTIVE) {
state.icon = ResourceIcon.get(R.drawable.ic_data_on);
} else if (state.state == Tile.STATE_INACTIVE) {
state.icon = ResourceIcon.get(R.drawable.ic_data_off);
} else {
state.icon = ResourceIcon.get(R.drawable.ic_data_unavailable);
}
state.icon = new SignalIcon(cb.mobileSignalIconId);
state.state = Tile.STATE_ACTIVE;
}
@Override
@@ -163,6 +167,7 @@ public class CellularTile extends QSTileImpl<SignalState> {
boolean enabled;
boolean wifiEnabled;
boolean airplaneModeEnabled;
int mobileSignalIconId;
String signalContentDescription;
int dataTypeIconId;
String dataContentDescription;
@@ -192,6 +197,7 @@ public class CellularTile extends QSTileImpl<SignalState> {
return;
}
mInfo.enabled = qsIcon.visible;
mInfo.mobileSignalIconId = qsIcon.icon;
mInfo.signalContentDescription = qsIcon.contentDescription;
mInfo.dataTypeIconId = qsType;
mInfo.dataContentDescription = typeContentDescription;
@@ -208,6 +214,7 @@ public class CellularTile extends QSTileImpl<SignalState> {
mInfo.noSim = show;
if (mInfo.noSim) {
// Make sure signal gets cleared out when no sims.
mInfo.mobileSignalIconId = 0;
mInfo.dataTypeIconId = 0;
// Show a No SIMs description to avoid emergency calls message.
mInfo.enabled = true;

View File

@@ -121,7 +121,6 @@ public class SignalClusterView extends LinearLayout implements NetworkController
private boolean mBlockEthernet;
private boolean mActivityEnabled;
private boolean mForceBlockWifi;
private boolean mQsSignal;
public SignalClusterView(Context context) {
this(context, null);
@@ -153,10 +152,9 @@ public class SignalClusterView extends LinearLayout implements NetworkController
updateActivityEnabled();
}
public void setQsSignalCluster() {
public void setForceBlockWifi() {
mForceBlockWifi = true;
mBlockWifi = true;
mQsSignal = true;
if (isAttachedToWindow()) {
// Re-register to get new callbacks.
mNetworkController.removeCallback(this);
@@ -301,23 +299,19 @@ public class SignalClusterView extends LinearLayout implements NetworkController
}
@Override
public void setMobileDataIndicators(IconState icon, IconState qsIcon, int type,
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
String description, boolean isWide, int subId, boolean roaming) {
PhoneState state = getState(subId);
if (state == null) {
return;
}
if (mQsSignal && qsIcon != null) {
icon = qsIcon;
type = qsType;
}
state.mMobileVisible = icon.visible && !mBlockMobile;
state.mMobileStrengthId = icon.icon;
state.mMobileTypeId = type;
state.mMobileDescription = icon.contentDescription;
state.mMobileVisible = statusIcon.visible && !mBlockMobile;
state.mMobileStrengthId = statusIcon.icon;
state.mMobileTypeId = statusType;
state.mMobileDescription = statusIcon.contentDescription;
state.mMobileTypeDescription = typeContentDescription;
state.mIsMobileTypeIconWide = type != 0 && isWide;
state.mIsMobileTypeIconWide = statusType != 0 && isWide;
state.mRoaming = roaming;
state.mActivityIn = activityIn && mActivityEnabled;
state.mActivityOut = activityOut && mActivityEnabled;

View File

@@ -91,10 +91,10 @@ public class SignalDrawable extends Drawable {
private final Path mFullPath = new Path();
private final Path mForegroundPath = new Path();
private final Path mXPath = new Path();
private final int mIntrinsicSize;
private final Handler mHandler;
private float mOldDarkIntensity = -1;
private float mNumLevels = 1;
private int mIntrinsicSize;
private int mLevel;
private int mState;
private boolean mVisible;
@@ -115,6 +115,10 @@ public class SignalDrawable extends Drawable {
setDarkIntensity(0);
}
public void setIntrinsicSize(int size) {
mIntrinsicSize = size;
}
@Override
public int getIntrinsicWidth() {
return mIntrinsicSize;

View File

@@ -252,6 +252,11 @@ public class MobileSignalController extends SignalController<
}
}
@Override
public int getQsCurrentIconId() {
return getCurrentIconId();
}
@Override
public void notifyListeners(SignalCallback callback) {
MobileIconGroup icons = getIcons();
@@ -271,9 +276,9 @@ public class MobileSignalController extends SignalController<
String description = null;
// Only send data sim callbacks to QS.
if (mCurrentState.dataSim) {
qsTypeIcon = showDataIcon ? icons.mDataType : 0;
qsTypeIcon = showDataIcon ? icons.mQsDataType : 0;
qsIcon = new IconState(mCurrentState.enabled
&& !mCurrentState.isEmergency, getCurrentIconId(), contentDescription);
&& !mCurrentState.isEmergency, getQsCurrentIconId(), contentDescription);
description = mCurrentState.isEmergency ? null : mCurrentState.networkName;
}
boolean activityIn = mCurrentState.dataConnected

View File

@@ -22,6 +22,16 @@ import com.android.systemui.statusbar.policy.MobileSignalController.MobileIconGr
class TelephonyIcons {
//***** Data connection icons
static final int QS_DATA_G = R.drawable.ic_qs_signal_g;
static final int QS_DATA_3G = R.drawable.ic_qs_signal_3g;
static final int QS_DATA_E = R.drawable.ic_qs_signal_e;
static final int QS_DATA_H = R.drawable.ic_qs_signal_h;
static final int QS_DATA_1X = R.drawable.ic_qs_signal_1x;
static final int QS_DATA_4G = R.drawable.ic_qs_signal_4g;
static final int QS_DATA_4G_PLUS = R.drawable.ic_qs_signal_4g_plus;
static final int QS_DATA_LTE = R.drawable.ic_qs_signal_lte;
static final int QS_DATA_LTE_PLUS = R.drawable.ic_qs_signal_lte_plus;
static final int FLIGHT_MODE_ICON = R.drawable.stat_sys_airplane_mode;
static final int ICON_LTE = R.drawable.stat_sys_data_fully_connected_lte;
@@ -36,6 +46,8 @@ class TelephonyIcons {
static final int ICON_DATA_DISABLED = R.drawable.stat_sys_data_disabled;
static final int QS_ICON_DATA_DISABLED = R.drawable.ic_qs_data_disabled;
static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup(
"CARRIER_NETWORK_CHANGE",
null,
@@ -63,7 +75,7 @@ class TelephonyIcons {
R.string.accessibility_data_connection_3g,
TelephonyIcons.ICON_3G,
true,
TelephonyIcons.ICON_3G
TelephonyIcons.QS_DATA_3G
);
static final MobileIconGroup WFC = new MobileIconGroup(
@@ -102,7 +114,7 @@ class TelephonyIcons {
R.string.accessibility_data_connection_edge,
TelephonyIcons.ICON_E,
false,
TelephonyIcons.ICON_E
TelephonyIcons.QS_DATA_E
);
static final MobileIconGroup ONE_X = new MobileIconGroup(
@@ -117,7 +129,7 @@ class TelephonyIcons {
R.string.accessibility_data_connection_cdma,
TelephonyIcons.ICON_1X,
true,
TelephonyIcons.ICON_1X
TelephonyIcons.QS_DATA_1X
);
static final MobileIconGroup G = new MobileIconGroup(
@@ -132,7 +144,7 @@ class TelephonyIcons {
R.string.accessibility_data_connection_gprs,
TelephonyIcons.ICON_G,
false,
TelephonyIcons.ICON_G
TelephonyIcons.QS_DATA_G
);
static final MobileIconGroup H = new MobileIconGroup(
@@ -147,7 +159,7 @@ class TelephonyIcons {
R.string.accessibility_data_connection_3_5g,
TelephonyIcons.ICON_H,
false,
TelephonyIcons.ICON_H
TelephonyIcons.QS_DATA_H
);
static final MobileIconGroup FOUR_G = new MobileIconGroup(
@@ -162,7 +174,7 @@ class TelephonyIcons {
R.string.accessibility_data_connection_4g,
TelephonyIcons.ICON_4G,
true,
TelephonyIcons.ICON_4G
TelephonyIcons.QS_DATA_4G
);
static final MobileIconGroup FOUR_G_PLUS = new MobileIconGroup(
@@ -177,7 +189,7 @@ class TelephonyIcons {
R.string.accessibility_data_connection_4g_plus,
TelephonyIcons.ICON_4G_PLUS,
true,
TelephonyIcons.ICON_4G_PLUS
TelephonyIcons.QS_DATA_4G_PLUS
);
static final MobileIconGroup LTE = new MobileIconGroup(
@@ -192,7 +204,7 @@ class TelephonyIcons {
R.string.accessibility_data_connection_lte,
TelephonyIcons.ICON_LTE,
true,
TelephonyIcons.ICON_LTE
TelephonyIcons.QS_DATA_LTE
);
static final MobileIconGroup LTE_PLUS = new MobileIconGroup(
@@ -207,7 +219,7 @@ class TelephonyIcons {
R.string.accessibility_data_connection_lte_plus,
TelephonyIcons.ICON_LTE_PLUS,
true,
TelephonyIcons.ICON_LTE_PLUS
TelephonyIcons.QS_DATA_LTE_PLUS
);
static final MobileIconGroup DATA_DISABLED = new MobileIconGroup(
@@ -222,7 +234,7 @@ class TelephonyIcons {
R.string.accessibility_cell_data_off,
TelephonyIcons.ICON_DATA_DISABLED,
false,
TelephonyIcons.ICON_DATA_DISABLED
TelephonyIcons.QS_ICON_DATA_DISABLED
);
}

View File

@@ -1,61 +0,0 @@
/*
* Copyright (C) 2017 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.statusbar;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import android.support.test.filters.SmallTest;
import android.telephony.SubscriptionInfo;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper.RunWithLooper;
import android.view.LayoutInflater;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.policy.NetworkController.IconState;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.Arrays;
@RunWith(AndroidTestingRunner.class)
@RunWithLooper
@SmallTest
public class SignalClusterViewTest extends SysuiTestCase {
private SignalClusterView mSignalCluster;
@Before
public void setup() {
mSignalCluster = (SignalClusterView) LayoutInflater.from(mContext)
.inflate(R.layout.signal_cluster_view, null);
}
@Test
public void testNonDefaultSim() {
SubscriptionInfo first = mock(SubscriptionInfo.class);
SubscriptionInfo second = mock(SubscriptionInfo.class);
when(first.getSubscriptionId()).thenReturn(0);
when(second.getSubscriptionId()).thenReturn(1);
mSignalCluster.setSubs(Arrays.asList(first, second));
mSignalCluster.setQsSignalCluster();
mSignalCluster.setMobileDataIndicators(new IconState(true, 0, 0, ""), null, 0, 0,
false, false, "", "", false, 1, false);
}
}

View File

@@ -111,7 +111,7 @@ public class CallbackHandlerTest extends SysuiTestCase {
String typeDescription = "Test 1";
String description = "Test 2";
int type = R.drawable.stat_sys_data_fully_connected_1x;
int qsType = type;
int qsType = R.drawable.ic_qs_signal_1x;
boolean wide = true;
int subId = 5;
boolean roaming = true;

View File

@@ -70,7 +70,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
protected static final int DEFAULT_SIGNAL_STRENGTH = DEFAULT_LEVEL;
protected static final int DEFAULT_QS_SIGNAL_STRENGTH = DEFAULT_LEVEL;
protected static final int DEFAULT_ICON = TelephonyIcons.ICON_3G;
protected static final int DEFAULT_QS_ICON = DEFAULT_ICON;
protected static final int DEFAULT_QS_ICON = TelephonyIcons.QS_DATA_3G;
protected NetworkControllerImpl mNetworkController;
protected MobileSignalController mMobileSignalController;

View File

@@ -25,7 +25,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
setupDefaultSignal();
verifyDataIndicators(TelephonyIcons.ICON_3G,
TelephonyIcons.ICON_3G);
TelephonyIcons.QS_DATA_3G);
}
@Test
@@ -35,7 +35,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_GSM);
verifyDataIndicators(TelephonyIcons.ICON_G,
TelephonyIcons.ICON_G);
TelephonyIcons.QS_DATA_G);
}
@Test
@@ -45,7 +45,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_CDMA);
verifyDataIndicators(TelephonyIcons.ICON_1X,
TelephonyIcons.ICON_1X);
TelephonyIcons.QS_DATA_1X);
}
@Test
@@ -55,7 +55,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_EDGE);
verifyDataIndicators(TelephonyIcons.ICON_E,
TelephonyIcons.ICON_E);
TelephonyIcons.QS_DATA_E);
}
@Test
@@ -65,7 +65,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_LTE);
verifyDataIndicators(TelephonyIcons.ICON_LTE,
TelephonyIcons.ICON_LTE);
TelephonyIcons.QS_DATA_LTE);
}
@Test
@@ -75,7 +75,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_HSPA);
verifyDataIndicators(TelephonyIcons.ICON_H,
TelephonyIcons.ICON_H);
TelephonyIcons.QS_DATA_H);
}
@Test
@@ -104,7 +104,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_LTE);
verifyDataIndicators(TelephonyIcons.ICON_4G,
TelephonyIcons.ICON_4G);
TelephonyIcons.QS_DATA_4G);
}
@Ignore("Flaky")
@@ -117,7 +117,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
setConnectivity(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
verifyDataIndicators(TelephonyIcons.ICON_DATA_DISABLED,
TelephonyIcons.ICON_DATA_DISABLED);
TelephonyIcons.QS_ICON_DATA_DISABLED);
}
@Test
@@ -148,7 +148,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
mNetworkController.handleConfigurationChanged();
verifyDataIndicators(TelephonyIcons.ICON_4G,
TelephonyIcons.ICON_4G);
TelephonyIcons.QS_DATA_4G);
}
@Test
@@ -158,13 +158,13 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_LTE);
verifyDataIndicators(TelephonyIcons.ICON_LTE,
TelephonyIcons.ICON_LTE);
TelephonyIcons.QS_DATA_LTE);
when(mServiceState.getDataNetworkType())
.thenReturn(TelephonyManager.NETWORK_TYPE_HSPA);
updateServiceState();
verifyDataIndicators(TelephonyIcons.ICON_H,
TelephonyIcons.ICON_H);
TelephonyIcons.QS_DATA_H);
}
@Test

View File

@@ -214,7 +214,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
verifyLastQsMobileDataIndicators(true,
testStrength,
TelephonyIcons.ICON_1X, false, false);
TelephonyIcons.QS_DATA_1X, false, false);
}
}