Skip to content

Commit

Permalink
Adding HD icon for IMS registration
Browse files Browse the repository at this point in the history
HD icon is appended for phone signal
icon in status bar once the device
is registered to IMS network.

Change-Id: If1382e9c9f61bed3c1bdb45c6828b217a8486011
CRs-Fixed: 957278 957288 957411 957457 957396 957473
  • Loading branch information
Chaitanya Kumar Reddy Gopireddy Srinivasa authored and Gerrit - the friendly Code Review server committed Feb 8, 2016
1 parent 3fbefaa commit 79b8407
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 7 deletions.
38 changes: 38 additions & 0 deletions packages/SystemUI/res/drawable/ims_services_hd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2016, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of The Linux Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<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="#FFFFFF" android:pathData="M11.8,16.6h-2v-4.2H5.9v4.2h-2V6.9h2v3.9h3.9V6.9h2V16.6z"/>
<path android:fillColor="#FFFFFF" android:pathData="M13.5,16.6V6.9h3c0.7,0 1.3,0.1 1.8,0.3s1,0.5 1.4,0.9c0.4,0.4 0.7,0.9 0.9,1.5c0.2,0.6 0.3,1.2 0.3,1.9V12c0,0.7 -0.1,1.3 -0.3,1.9s-0.5,1.1 -0.9,1.5c-0.4,0.4 -0.9,0.7 -1.4,0.9c-0.5,0.2 -1.1,0.3 -1.8,0.3H13.5zM15.5,8.5V15h1c0.8,0 1.4,-0.3 1.8,-0.8s0.6,-1.3 0.6,-2.2v-0.5c0,-1 -0.2,-1.7 -0.6,-2.2c-0.4,-0.5 -1,-0.8 -1.8,-0.8H15.5z"/>
</vector>
7 changes: 7 additions & 0 deletions packages/SystemUI/res/layout/mobile_signal_group.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:id="@+id/ims_hd"
android:visibility="gone"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
7 changes: 7 additions & 0 deletions packages/SystemUI/res/layout/signal_cluster_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@
android:layout_height="4dp"
android:visibility="gone"
/>
<ImageView android:id="@+id/airplane_ims"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:src="@drawable/ims_services_hd"
/>
<ImageView
android:id="@+id/airplane"
android:layout_height="wrap_content"
Expand Down
6 changes: 6 additions & 0 deletions packages/SystemUI/res/values/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,15 @@
3: Show data activity with data type at the left side
of signal icon, and do not show two stacked icon on
one slot.
4: Show LTE, LTE+ symbols on top of signal icon,
and shows IMS and embms icons on the left side
of the signal icon.
-->
<integer name="status_bar_style">0</integer>

<!-- For status bar style extended : 4 -->
<integer name="status_bar_style_extended">4</integer>

<!-- Control whether status bar should fetch mobile signal icons from xml file dynamically -->
<bool name="config_read_icons_from_xml">false</bool>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
// Intimately tied to the design of res/layout/signal_cluster_view.xml
public class SignalClusterView
extends LinearLayout
implements NetworkControllerImpl.SignalCallback,
implements NetworkControllerImpl.SignalCallbackExtended,
SecurityController.SecurityControllerCallback, Tunable {

static final String TAG = "SignalClusterView";
Expand All @@ -69,6 +69,7 @@ public class SignalClusterView
private int mEthernetIconId = 0;
private int mLastEthernetIconId = -1;
private boolean mWifiVisible = false;
private boolean mImsRegistered = false;
private int mWifiStrengthId = 0, mWifiActivityId = 0;
private int mLastWifiStrengthId = -1, mLastWifiActivityId = -1;
private boolean mIsAirplaneMode = false;
Expand All @@ -84,7 +85,8 @@ public class SignalClusterView

ViewGroup mEthernetGroup, mWifiGroup;
View mNoSimsCombo;
ImageView mVpn, mEthernet, mWifi, mAirplane, mNoSims, mEthernetDark, mWifiDark, mNoSimsDark;
ImageView mVpn, mEthernet, mWifi, mAirplane,
mNoSims, mEthernetDark, mWifiDark, mNoSimsDark, mImsAirplane;
ImageView mWifiActivity;
View mWifiAirplaneSpacer;
View mWifiSignalSpacer;
Expand Down Expand Up @@ -175,6 +177,7 @@ protected void onAttachedToWindow() {
mAirplane = (ImageView) findViewById(R.id.airplane);
mNoSims = (ImageView) findViewById(R.id.no_sims);
mNoSimsDark = (ImageView) findViewById(R.id.no_sims_dark);
mImsAirplane = (ImageView) findViewById(R.id.airplane_ims);
mNoSimsCombo = findViewById(R.id.no_sims_combo);
mWifiAirplaneSpacer = findViewById(R.id.wifi_airplane_spacer);
mWifiSignalSpacer = findViewById(R.id.wifi_signal_spacer);
Expand All @@ -197,6 +200,7 @@ protected void onDetachedFromWindow() {
mWifi = null;
mWifiActivity = null;
mAirplane = null;
mImsAirplane = null;
mMobileSignalGroup.removeAllViews();
mMobileSignalGroup = null;
TunerService.get(mContext).removeTunable(this);
Expand Down Expand Up @@ -250,6 +254,23 @@ public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int
apply();
}

@Override
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
int qsType, boolean activityIn, boolean activityOut, int dataActivityId,
int mobileActivityId, int stackedDataId, int stackedVoiceId,
String typeContentDescription, String description, boolean isWide, int subId,
int imsIconId, boolean isImsInAirplane) {
PhoneState state = getState(subId);
if (state == null) {
return;
}
state.mMobileImsId = imsIconId;
mImsRegistered = isImsInAirplane;
this.setMobileDataIndicators(statusIcon, qsIcon, statusType, qsType, activityIn,
activityOut, dataActivityId, mobileActivityId, stackedDataId,
stackedVoiceId, typeContentDescription, description, isWide, subId);
}

@Override
public void setEthernetIndicators(IconState state) {
mEthernetVisible = state.visible && !mBlockEthernet;
Expand Down Expand Up @@ -492,6 +513,12 @@ private void apply() {
mAirplane.setVisibility(View.GONE);
}

if (mIsAirplaneMode && mImsRegistered){
mImsAirplane.setVisibility(View.VISIBLE);
} else {
mImsAirplane.setVisibility(View.GONE);
}

if (mIsAirplaneMode && mWifiVisible) {
mWifiAirplaneSpacer.setVisibility(View.VISIBLE);
} else {
Expand Down Expand Up @@ -555,9 +582,9 @@ private class PhoneState {
private String mMobileDescription, mMobileTypeDescription;

private ViewGroup mMobileGroup;
private ImageView mMobile, mMobileDark, mMobileType, mRoaming;
private ImageView mMobile, mMobileDark, mMobileType, mRoaming, mMobileIms;

private int mDataActivityId = 0, mMobileActivityId = 0;
private int mDataActivityId = 0, mMobileActivityId = 0, mMobileImsId = 0;
private int mStackedDataId = 0, mStackedVoiceId = 0;
private ImageView mDataActivity, mMobileActivity, mStackedData, mStackedVoice;
private ViewGroup mMobileSingleGroup, mMobileStackedGroup;
Expand All @@ -575,6 +602,7 @@ public void setViews(ViewGroup root) {
mMobileDark = (ImageView) root.findViewById(R.id.mobile_signal_dark);
mMobileType = (ImageView) root.findViewById(R.id.mobile_type);
mMobileActivity = (ImageView) root.findViewById(R.id.mobile_inout);
mMobileIms = (ImageView) root.findViewById(R.id.ims_hd);

mDataActivity = (ImageView) root.findViewById(R.id.data_inout);
mStackedData = (ImageView) root.findViewById(R.id.mobile_signal_data);
Expand Down Expand Up @@ -624,6 +652,8 @@ public boolean apply(boolean isSecondaryIcon) {
}
}

mMobileIms.setImageResource(mMobileImsId);

if (mStackedDataId != 0 && mStackedVoiceId != 0) {
mStackedData.setImageResource(mStackedDataId);
mStackedVoice.setImageResource(mStackedVoiceId);
Expand Down Expand Up @@ -666,6 +696,7 @@ public boolean apply(boolean isSecondaryIcon) {
mMobileType.setVisibility(mMobileTypeId != 0 ? View.VISIBLE : View.GONE);
mDataActivity.setVisibility(mDataActivityId != 0 ? View.VISIBLE : View.GONE);
mMobileActivity.setVisibility(mMobileActivityId != 0 ? View.VISIBLE : View.GONE);
mMobileIms.setVisibility(mMobileImsId != 0 ? View.VISIBLE : View.GONE);

return mMobileVisible;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.statusbar.policy.NetworkController.IconState;
import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
import com.android.systemui.statusbar.policy.NetworkController.SignalCallbackExtended;
import com.android.systemui.statusbar.policy.NetworkControllerImpl.EmergencyListener;

import java.util.ArrayList;
Expand All @@ -33,7 +34,7 @@
* Implements network listeners and forwards the calls along onto other listeners but on
* the current or specified Looper.
*/
public class CallbackHandler extends Handler implements EmergencyListener, SignalCallback {
public class CallbackHandler extends Handler implements EmergencyListener, SignalCallbackExtended {
private static final int MSG_EMERGENCE_CHANGED = 0;
private static final int MSG_SUBS_CHANGED = 1;
private static final int MSG_NO_SIM_VISIBLE_CHANGED = 2;
Expand Down Expand Up @@ -142,6 +143,34 @@ public void run() {
});
}

@Override
public void setMobileDataIndicators(final IconState statusIcon, final IconState qsIcon,
final int statusType, final int qsType, final boolean activityIn,
final boolean activityOut, final int dataActivityId, final int mobileActivityId,
final int stackedDataIcon, final int stackedVoiceIcon,
final String typeContentDescription, final String description, final boolean isWide,
final int subId, final int imsIconId, final boolean isImsInAirplane) {
post(new Runnable() {
@Override
public void run() {
for (SignalCallback signalCluster : mSignalCallbacks) {
if (signalCluster instanceof SignalCallbackExtended) {
((SignalCallbackExtended)signalCluster).setMobileDataIndicators(
statusIcon, qsIcon, statusType, qsType, activityIn,
activityOut, dataActivityId, mobileActivityId,
stackedDataIcon, stackedVoiceIcon, typeContentDescription,
description, isWide, subId, imsIconId, isImsInAirplane);
} else {
signalCluster.setMobileDataIndicators(statusIcon, qsIcon, statusType,
qsType, activityIn, activityOut, dataActivityId,
mobileActivityId, stackedDataIcon, stackedVoiceIcon,
typeContentDescription, description, isWide, subId);
}
}
}
});
}

@Override
public void setSubs(List<SubscriptionInfo> subs) {
obtainMessage(MSG_SUBS_CHANGED, subs).sendToTarget();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import android.util.SparseArray;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.CarrierAppUtils;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.cdma.EriInfo;
import com.android.systemui.R;
Expand Down Expand Up @@ -87,8 +88,10 @@ public class MobileSignalController extends SignalController<
private final int STATUS_BAR_STYLE_CDMA_1X_COMBINED = 1;
private final int STATUS_BAR_STYLE_DEFAULT_DATA = 2;
private final int STATUS_BAR_STYLE_DATA_VOICE = 3;
private final int STATUS_BAR_STYLE_EXTENDED = 4;
private int mStyle = STATUS_BAR_STYLE_ANDROID_DEFAULT;
private DataEnabledSettingObserver mDataEnabledSettingObserver;
CarrierAppUtils.CARRIER carrier = CarrierAppUtils.getCarrierId();

// TODO: Reduce number of vars passed in, if we have the NetworkController, probably don't
// need listener lists anymore.
Expand Down Expand Up @@ -124,7 +127,12 @@ public MobileSignalController(Context context, Config config, boolean hasMobileD
mapIconSets();
}

mStyle = context.getResources().getInteger(R.integer.status_bar_style);
if (carrier != null && (CarrierAppUtils.CARRIER.TELEPHONY_CARRIER_ONE
== carrier)) {
mStyle = context.getResources().getInteger(R.integer.status_bar_style_extended);
} else {
mStyle = context.getResources().getInteger(R.integer.status_bar_style);
}

String networkName = info.getCarrierName() != null ? info.getCarrierName().toString()
: mNetworkNameDefault;
Expand Down Expand Up @@ -326,7 +334,8 @@ public void notifyListeners() {
activityIn, activityOut, dataActivityId, mobileActivityId,
icons.mStackedDataIcon, icons.mStackedVoiceIcon,
dataContentDescription, description, icons.mIsWide,
mSubscriptionInfo.getSubscriptionId());
mSubscriptionInfo.getSubscriptionId(), getImsIconId(),
isImsRegisteredInAirplaneMode());

mCallbackHandler.post(new Runnable() {
@Override
Expand All @@ -336,6 +345,26 @@ public void run() {
});
}

private boolean isImsRegisteredInAirplaneMode() {
return mStyle == STATUS_BAR_STYLE_EXTENDED
&& mPhone != null && mPhone.isImsRegistered()
&& mCurrentState.airplaneMode;
}

private int getImsIconId() {
if (mStyle == STATUS_BAR_STYLE_EXTENDED
&& isImsRegisteredOnDataSim()) {
return R.drawable.ims_services_hd;
} else {
return 0;
}
}

private boolean isImsRegisteredOnDataSim() {
return mPhone != null && mPhone.isImsRegistered()
&& mCurrentState.dataSim;
}

@Override
protected MobileState cleanState() {
return new MobileState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusT
void setMobileDataEnabled(boolean enabled);
}

public interface SignalCallbackExtended extends SignalCallback {
void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
int qsType, boolean activityIn, boolean activityOut, int dataActivityId,
int mobileActivityId, int stackedDataIcon, int stackedVoiceIcon,
String typeContentDescription, String description, boolean isWide,
int subId, int imsIconId, boolean isImsInAirplane);
}

public static class IconState {
public final boolean visible;
public final int icon;
Expand Down

0 comments on commit 79b8407

Please sign in to comment.