Loading core/java/com/android/internal/util/cm/QSConstants.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,7 @@ public class QSConstants { public static final String TILE_NFC = "nfc"; public static final String TILE_NFC = "nfc"; public static final String TILE_COMPASS = "compass"; public static final String TILE_COMPASS = "compass"; public static final String TILE_LOCKSCREEN = "lockscreen"; public static final String TILE_LOCKSCREEN = "lockscreen"; public static final String TILE_LTE = "lte"; // Order matters // Order matters protected static final ArrayList<String> TILES_DEFAULT = new ArrayList<String>(); protected static final ArrayList<String> TILES_DEFAULT = new ArrayList<String>(); Loading Loading @@ -74,5 +75,6 @@ public class QSConstants { TILES_AVAILABLE.add(TILE_NFC); TILES_AVAILABLE.add(TILE_NFC); TILES_AVAILABLE.add(TILE_COMPASS); TILES_AVAILABLE.add(TILE_COMPASS); TILES_AVAILABLE.add(TILE_LOCKSCREEN); TILES_AVAILABLE.add(TILE_LOCKSCREEN); TILES_AVAILABLE.add(TILE_LTE); } } } } core/java/com/android/internal/util/cm/QSUtils.java +9 −1 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.net.ConnectivityManager; import android.nfc.NfcAdapter; import android.nfc.NfcAdapter; import android.telephony.TelephonyManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.text.TextUtils; import com.android.internal.telephony.PhoneConstants; import java.util.Iterator; import java.util.Iterator; import java.util.List; import java.util.List; Loading Loading @@ -94,7 +95,14 @@ public class QSUtils { } } } } private static boolean deviceSupportsDdsSupported(Context context) { public static boolean deviceSupportsLte(Context ctx) { final TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); return (tm.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) || tm.getLteOnGsmMode() != 0; } public static boolean deviceSupportsDdsSupported(Context context) { TelephonyManager tm = (TelephonyManager) TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); context.getSystemService(Context.TELEPHONY_SERVICE); return tm.isMultiSimEnabled() return tm.isMultiSimEnabled() Loading packages/SystemUI/res/drawable/ic_qs_lte_off.xml 0 → 100644 +13 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="64dp" android:height="64dp" android:viewportWidth="48" android:viewportHeight="48"> <path android:fillColor="#4DFFFFFF" android:pathData="M8.8,6L42,39.2L39.2,42L24,26.8V34h-4V22.8L6,8.8L8.8,6Z M10,14H6v16v4h4h8v-4h-8V14z M28,18v-4h-4h-1.6l4,4H28z M42,33.6V30h-3.6L42,33.6z M42,18v-4h-8h-4v4v3.6l4.4,4.4H42v-4h-8v-4H42z" /> </vector> No newline at end of file packages/SystemUI/res/drawable/ic_qs_lte_on.xml 0 → 100644 +12 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="64dp" android:height="64dp" android:viewportWidth="48" android:viewportHeight="48"> <path android:fillColor="#FFFFFF" android:pathData="M10,30h8v4h-8H6v-4V14h4V30Z M20,14h-4v4h4v16h4V18h4v-4h-4H20z M42,18v-4h-8h-4v4v4v4v4v4h4 h8v-4h-8v-4h8v-4h-8v-4H42z" /> </vector> No newline at end of file packages/SystemUI/src/com/android/systemui/qs/tiles/LteTile.java 0 → 100644 +101 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2015 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.qs.tiles; import android.content.Context; import android.content.Intent; import android.provider.Settings; import android.telephony.TelephonyManager; import com.android.internal.telephony.Phone; import com.android.internal.util.cm.QSUtils; import com.android.systemui.qs.QSTile; import com.android.systemui.R; /** * Lazy Lte Tile * Created by Adnan on 1/21/15. */ public class LteTile extends QSTile<QSTile.BooleanState> { public LteTile(Host host) { super(host); } @Override protected BooleanState newTileState() { return new BooleanState(); } @Override protected void handleLongClick() { super.handleLongClick(); mHost.startSettingsActivity(new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS)); } @Override protected void handleClick() { toggleLteState(); refreshState(); } @Override protected void handleUpdateState(BooleanState state, Object arg) { // Hide the tile if device doesn't support LTE // or it supports Dual Sim Dual Active. // TODO: Should be spawning off a tile per sim if (!QSUtils.deviceSupportsLte(mContext) || QSUtils.deviceSupportsDdsSupported(mContext)) { state.visible = false; return; } switch (getCurrentPreferredNetworkMode()) { case Phone.NT_MODE_GLOBAL: case Phone.NT_MODE_LTE_CDMA_AND_EVDO: case Phone.NT_MODE_LTE_GSM_WCDMA: case Phone.NT_MODE_LTE_ONLY: case Phone.NT_MODE_LTE_WCDMA: case Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA: case Phone.NT_MODE_TD_SCDMA_GSM_WCDMA_LTE: case Phone.NT_MODE_TD_SCDMA_WCDMA_LTE: state.visible = true; state.iconId = R.drawable.ic_qs_lte_on; break; default: state.visible = true; state.iconId = R.drawable.ic_qs_lte_off; break; } } private void toggleLteState() { TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); tm.toggleLTE(true); } private int getCurrentPreferredNetworkMode() { return Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.PREFERRED_NETWORK_MODE, -1); } @Override public void setListening(boolean listening) { } } Loading
core/java/com/android/internal/util/cm/QSConstants.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,7 @@ public class QSConstants { public static final String TILE_NFC = "nfc"; public static final String TILE_NFC = "nfc"; public static final String TILE_COMPASS = "compass"; public static final String TILE_COMPASS = "compass"; public static final String TILE_LOCKSCREEN = "lockscreen"; public static final String TILE_LOCKSCREEN = "lockscreen"; public static final String TILE_LTE = "lte"; // Order matters // Order matters protected static final ArrayList<String> TILES_DEFAULT = new ArrayList<String>(); protected static final ArrayList<String> TILES_DEFAULT = new ArrayList<String>(); Loading Loading @@ -74,5 +75,6 @@ public class QSConstants { TILES_AVAILABLE.add(TILE_NFC); TILES_AVAILABLE.add(TILE_NFC); TILES_AVAILABLE.add(TILE_COMPASS); TILES_AVAILABLE.add(TILE_COMPASS); TILES_AVAILABLE.add(TILE_LOCKSCREEN); TILES_AVAILABLE.add(TILE_LOCKSCREEN); TILES_AVAILABLE.add(TILE_LTE); } } } }
core/java/com/android/internal/util/cm/QSUtils.java +9 −1 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.net.ConnectivityManager; import android.nfc.NfcAdapter; import android.nfc.NfcAdapter; import android.telephony.TelephonyManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.text.TextUtils; import com.android.internal.telephony.PhoneConstants; import java.util.Iterator; import java.util.Iterator; import java.util.List; import java.util.List; Loading Loading @@ -94,7 +95,14 @@ public class QSUtils { } } } } private static boolean deviceSupportsDdsSupported(Context context) { public static boolean deviceSupportsLte(Context ctx) { final TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); return (tm.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) || tm.getLteOnGsmMode() != 0; } public static boolean deviceSupportsDdsSupported(Context context) { TelephonyManager tm = (TelephonyManager) TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); context.getSystemService(Context.TELEPHONY_SERVICE); return tm.isMultiSimEnabled() return tm.isMultiSimEnabled() Loading
packages/SystemUI/res/drawable/ic_qs_lte_off.xml 0 → 100644 +13 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="64dp" android:height="64dp" android:viewportWidth="48" android:viewportHeight="48"> <path android:fillColor="#4DFFFFFF" android:pathData="M8.8,6L42,39.2L39.2,42L24,26.8V34h-4V22.8L6,8.8L8.8,6Z M10,14H6v16v4h4h8v-4h-8V14z M28,18v-4h-4h-1.6l4,4H28z M42,33.6V30h-3.6L42,33.6z M42,18v-4h-8h-4v4v3.6l4.4,4.4H42v-4h-8v-4H42z" /> </vector> No newline at end of file
packages/SystemUI/res/drawable/ic_qs_lte_on.xml 0 → 100644 +12 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="64dp" android:height="64dp" android:viewportWidth="48" android:viewportHeight="48"> <path android:fillColor="#FFFFFF" android:pathData="M10,30h8v4h-8H6v-4V14h4V30Z M20,14h-4v4h4v16h4V18h4v-4h-4H20z M42,18v-4h-8h-4v4v4v4v4v4h4 h8v-4h-8v-4h8v-4h-8v-4H42z" /> </vector> No newline at end of file
packages/SystemUI/src/com/android/systemui/qs/tiles/LteTile.java 0 → 100644 +101 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2015 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.qs.tiles; import android.content.Context; import android.content.Intent; import android.provider.Settings; import android.telephony.TelephonyManager; import com.android.internal.telephony.Phone; import com.android.internal.util.cm.QSUtils; import com.android.systemui.qs.QSTile; import com.android.systemui.R; /** * Lazy Lte Tile * Created by Adnan on 1/21/15. */ public class LteTile extends QSTile<QSTile.BooleanState> { public LteTile(Host host) { super(host); } @Override protected BooleanState newTileState() { return new BooleanState(); } @Override protected void handleLongClick() { super.handleLongClick(); mHost.startSettingsActivity(new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS)); } @Override protected void handleClick() { toggleLteState(); refreshState(); } @Override protected void handleUpdateState(BooleanState state, Object arg) { // Hide the tile if device doesn't support LTE // or it supports Dual Sim Dual Active. // TODO: Should be spawning off a tile per sim if (!QSUtils.deviceSupportsLte(mContext) || QSUtils.deviceSupportsDdsSupported(mContext)) { state.visible = false; return; } switch (getCurrentPreferredNetworkMode()) { case Phone.NT_MODE_GLOBAL: case Phone.NT_MODE_LTE_CDMA_AND_EVDO: case Phone.NT_MODE_LTE_GSM_WCDMA: case Phone.NT_MODE_LTE_ONLY: case Phone.NT_MODE_LTE_WCDMA: case Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA: case Phone.NT_MODE_TD_SCDMA_GSM_WCDMA_LTE: case Phone.NT_MODE_TD_SCDMA_WCDMA_LTE: state.visible = true; state.iconId = R.drawable.ic_qs_lte_on; break; default: state.visible = true; state.iconId = R.drawable.ic_qs_lte_off; break; } } private void toggleLteState() { TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); tm.toggleLTE(true); } private int getCurrentPreferredNetworkMode() { return Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.PREFERRED_NETWORK_MODE, -1); } @Override public void setListening(boolean listening) { } }