Loading core/java/com/android/internal/util/cm/QSConstants.java +2 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ public class QSConstants { public static final String TILE_VISUALIZER = "visualizer"; public static final String TILE_SCREEN_TIMEOUT = "screen_timeout"; public static final String TILE_LIVE_DISPLAY = "live_display"; public static final String TILE_USB_TETHER = "usb_tether"; // Order matters protected static final ArrayList<String> TILES_DEFAULT = new ArrayList<String>(); Loading Loading @@ -82,5 +83,6 @@ public class QSConstants { TILES_AVAILABLE.add(TILE_VISUALIZER); TILES_AVAILABLE.add(TILE_SCREEN_TIMEOUT); TILES_AVAILABLE.add(TILE_LIVE_DISPLAY); TILES_AVAILABLE.add(TILE_USB_TETHER); } } packages/SystemUI/res/drawable/ic_qs_usb_tether_off.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2015 The CyanogenMod 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="64dp" android:height="64dp" android:viewportWidth="64" android:viewportHeight="64"> <path android:fillColor="#4DFFFFFF" android:pathData="M48.677,29.715h5.255v-7.254h4.401l-7.047-9.612l-7.052,9.612h4.443V29.715z M54.688,46.753l3.645-4.971h-4.401v-7.255 h-5.255v6.215L54.688,46.753z M36.741,28.805v-3.923h2.109v-8.445h-8.444v6.034L36.741,28.805z M23.942,16.007v-1.679h4.562 l-6.547-8.976l-3.656,5.014L23.942,16.007z M28.916,34.699l22.692,22.692l3.324-3.324L7.6,6.734l-3.324,3.323l15.693,15.694 l0.004,10.381l-8.571-3.715v-3.896c1.257-0.734,2.111-2.079,2.111-3.639c0-2.33-1.887-4.222-4.224-4.222 c-2.332,0-4.222,1.892-4.222,4.222c0,1.56,0.854,2.905,2.113,3.639v6.668l12.794,5.547v5.609c-2.518,0.837-4.348,3.185-4.348,5.987 c0,3.495,2.835,6.333,6.332,6.333c3.501,0,6.337-2.838,6.337-6.333c0-2.802-1.83-5.15-4.352-5.987v-9.113L28.916,34.699z M23.938,29.72l1.843,1.843l-1.839,0.93L23.938,29.72z" /> </vector> No newline at end of file packages/SystemUI/res/drawable/ic_qs_usb_tether_on.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2015 The CyanogenMod 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="64dp" android:height="64dp" android:viewportWidth="64" android:viewportHeight="64"> <path android:fillColor="#FFFFFF" android:pathData="M48.677,29.724h5.255V22.47h4.401l-7.047-9.611l-7.052,9.611h4.443V29.724z M48.677,34.537h5.255v7.254h4.401l-7.047,9.611 l-7.052-9.611h4.443V34.537z M38.85,16.447h-8.444v8.445h2.11v3.251l-8.574,4.36V14.337h4.562l-6.547-8.975l-6.545,8.975h4.561 v21.805l-8.571-3.715v-3.896c1.257-0.734,2.111-2.079,2.111-3.639c0-2.33-1.887-4.222-4.224-4.222c-2.332,0-4.222,1.892-4.222,4.222c0,1.56,0.854,2.905,2.113,3.639v6.668l12.794,5.547v5.609c-2.518,0.837-4.348,3.184-4.348,5.987c0,3.495,2.835,6.333,6.332,6.333c3.501,0,6.337-2.838,6.337-6.333c0-2.802-1.83-5.15-4.352-5.987v-9.113l12.798-6.512v-5.839h2.11L38.85,16.447L38.85,16.447z" /> </vector> No newline at end of file packages/SystemUI/res/values/cm_strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ <string name="quick_settings_lte_label">LTE</string> <string name="quick_settings_visualizer_label" translatable="false">AudioFX</string> <string name="quick_settings_screen_timeout_detail_title">Screen timeout</string> <string name="quick_settings_usb_tether_label">USB tethering</string> <!-- Weather string format in expanded statusbar header --> <string name="status_bar_expanded_header_weather_format"><xliff:g id="temp">%1$s</xliff:g> - <xliff:g id="condition">%2$s</xliff:g></string> Loading packages/SystemUI/src/com/android/systemui/qs/tiles/UsbTetherTile.java 0 → 100644 +113 −0 Original line number 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.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.hardware.usb.UsbManager; import android.provider.Settings; import android.net.ConnectivityManager; import com.android.systemui.R; import com.android.systemui.qs.QSTile; /** * USB Tether quick settings tile */ public class UsbTetherTile extends QSTile<QSTile.BooleanState> { private static final Intent WIRELESS_SETTINGS = new Intent(Settings.ACTION_WIRELESS_SETTINGS); private final ConnectivityManager mConnectivityManager; private boolean mListening; private boolean mUsbTethered = false; private boolean mUsbConnected = false; public UsbTetherTile(Host host) { super(host); mConnectivityManager = (ConnectivityManager) mContext .getSystemService(Context.CONNECTIVITY_SERVICE); } protected BooleanState newTileState() { return new BooleanState(); } @Override public void setListening(boolean listening) { if (mListening == listening) return; mListening = listening; if (listening) { final IntentFilter filter = new IntentFilter(); filter.addAction(UsbManager.ACTION_USB_STATE); mContext.registerReceiver(mReceiver, filter); } else { mContext.unregisterReceiver(mReceiver); } } @Override protected void handleClick() { mConnectivityManager.setUsbTethering(!mUsbTethered); } @Override protected void handleLongClick() { mHost.startSettingsActivity(WIRELESS_SETTINGS); } private void updateState() { String[] tetheredIfaces = mConnectivityManager.getTetheredIfaces(); String[] usbRegexs = mConnectivityManager.getTetherableUsbRegexs(); mUsbTethered = false; for (String s : tetheredIfaces) { for (String regex : usbRegexs) { if (s.matches(regex)) { mUsbTethered = true; return; } } } } private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mUsbConnected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false); if (mUsbConnected && mConnectivityManager.isTetheringSupported()) { updateState(); } else { mUsbTethered = false; } refreshState(); } }; @Override protected void handleUpdateState(BooleanState state, Object arg) { state.visible = mUsbConnected && mConnectivityManager.isTetheringSupported(); state.value = mUsbTethered; state.label = mContext.getString(R.string.quick_settings_usb_tether_label); state.iconId = mUsbTethered ? R.drawable.ic_qs_usb_tether_on : R.drawable.ic_qs_usb_tether_off; } } Loading
core/java/com/android/internal/util/cm/QSConstants.java +2 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ public class QSConstants { public static final String TILE_VISUALIZER = "visualizer"; public static final String TILE_SCREEN_TIMEOUT = "screen_timeout"; public static final String TILE_LIVE_DISPLAY = "live_display"; public static final String TILE_USB_TETHER = "usb_tether"; // Order matters protected static final ArrayList<String> TILES_DEFAULT = new ArrayList<String>(); Loading Loading @@ -82,5 +83,6 @@ public class QSConstants { TILES_AVAILABLE.add(TILE_VISUALIZER); TILES_AVAILABLE.add(TILE_SCREEN_TIMEOUT); TILES_AVAILABLE.add(TILE_LIVE_DISPLAY); TILES_AVAILABLE.add(TILE_USB_TETHER); } }
packages/SystemUI/res/drawable/ic_qs_usb_tether_off.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2015 The CyanogenMod 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="64dp" android:height="64dp" android:viewportWidth="64" android:viewportHeight="64"> <path android:fillColor="#4DFFFFFF" android:pathData="M48.677,29.715h5.255v-7.254h4.401l-7.047-9.612l-7.052,9.612h4.443V29.715z M54.688,46.753l3.645-4.971h-4.401v-7.255 h-5.255v6.215L54.688,46.753z M36.741,28.805v-3.923h2.109v-8.445h-8.444v6.034L36.741,28.805z M23.942,16.007v-1.679h4.562 l-6.547-8.976l-3.656,5.014L23.942,16.007z M28.916,34.699l22.692,22.692l3.324-3.324L7.6,6.734l-3.324,3.323l15.693,15.694 l0.004,10.381l-8.571-3.715v-3.896c1.257-0.734,2.111-2.079,2.111-3.639c0-2.33-1.887-4.222-4.224-4.222 c-2.332,0-4.222,1.892-4.222,4.222c0,1.56,0.854,2.905,2.113,3.639v6.668l12.794,5.547v5.609c-2.518,0.837-4.348,3.185-4.348,5.987 c0,3.495,2.835,6.333,6.332,6.333c3.501,0,6.337-2.838,6.337-6.333c0-2.802-1.83-5.15-4.352-5.987v-9.113L28.916,34.699z M23.938,29.72l1.843,1.843l-1.839,0.93L23.938,29.72z" /> </vector> No newline at end of file
packages/SystemUI/res/drawable/ic_qs_usb_tether_on.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2015 The CyanogenMod 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="64dp" android:height="64dp" android:viewportWidth="64" android:viewportHeight="64"> <path android:fillColor="#FFFFFF" android:pathData="M48.677,29.724h5.255V22.47h4.401l-7.047-9.611l-7.052,9.611h4.443V29.724z M48.677,34.537h5.255v7.254h4.401l-7.047,9.611 l-7.052-9.611h4.443V34.537z M38.85,16.447h-8.444v8.445h2.11v3.251l-8.574,4.36V14.337h4.562l-6.547-8.975l-6.545,8.975h4.561 v21.805l-8.571-3.715v-3.896c1.257-0.734,2.111-2.079,2.111-3.639c0-2.33-1.887-4.222-4.224-4.222c-2.332,0-4.222,1.892-4.222,4.222c0,1.56,0.854,2.905,2.113,3.639v6.668l12.794,5.547v5.609c-2.518,0.837-4.348,3.184-4.348,5.987c0,3.495,2.835,6.333,6.332,6.333c3.501,0,6.337-2.838,6.337-6.333c0-2.802-1.83-5.15-4.352-5.987v-9.113l12.798-6.512v-5.839h2.11L38.85,16.447L38.85,16.447z" /> </vector> No newline at end of file
packages/SystemUI/res/values/cm_strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ <string name="quick_settings_lte_label">LTE</string> <string name="quick_settings_visualizer_label" translatable="false">AudioFX</string> <string name="quick_settings_screen_timeout_detail_title">Screen timeout</string> <string name="quick_settings_usb_tether_label">USB tethering</string> <!-- Weather string format in expanded statusbar header --> <string name="status_bar_expanded_header_weather_format"><xliff:g id="temp">%1$s</xliff:g> - <xliff:g id="condition">%2$s</xliff:g></string> Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/UsbTetherTile.java 0 → 100644 +113 −0 Original line number 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.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.hardware.usb.UsbManager; import android.provider.Settings; import android.net.ConnectivityManager; import com.android.systemui.R; import com.android.systemui.qs.QSTile; /** * USB Tether quick settings tile */ public class UsbTetherTile extends QSTile<QSTile.BooleanState> { private static final Intent WIRELESS_SETTINGS = new Intent(Settings.ACTION_WIRELESS_SETTINGS); private final ConnectivityManager mConnectivityManager; private boolean mListening; private boolean mUsbTethered = false; private boolean mUsbConnected = false; public UsbTetherTile(Host host) { super(host); mConnectivityManager = (ConnectivityManager) mContext .getSystemService(Context.CONNECTIVITY_SERVICE); } protected BooleanState newTileState() { return new BooleanState(); } @Override public void setListening(boolean listening) { if (mListening == listening) return; mListening = listening; if (listening) { final IntentFilter filter = new IntentFilter(); filter.addAction(UsbManager.ACTION_USB_STATE); mContext.registerReceiver(mReceiver, filter); } else { mContext.unregisterReceiver(mReceiver); } } @Override protected void handleClick() { mConnectivityManager.setUsbTethering(!mUsbTethered); } @Override protected void handleLongClick() { mHost.startSettingsActivity(WIRELESS_SETTINGS); } private void updateState() { String[] tetheredIfaces = mConnectivityManager.getTetheredIfaces(); String[] usbRegexs = mConnectivityManager.getTetherableUsbRegexs(); mUsbTethered = false; for (String s : tetheredIfaces) { for (String regex : usbRegexs) { if (s.matches(regex)) { mUsbTethered = true; return; } } } } private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mUsbConnected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false); if (mUsbConnected && mConnectivityManager.isTetheringSupported()) { updateState(); } else { mUsbTethered = false; } refreshState(); } }; @Override protected void handleUpdateState(BooleanState state, Object arg) { state.visible = mUsbConnected && mConnectivityManager.isTetheringSupported(); state.value = mUsbTethered; state.label = mContext.getString(R.string.quick_settings_usb_tether_label); state.iconId = mUsbTethered ? R.drawable.ic_qs_usb_tether_on : R.drawable.ic_qs_usb_tether_off; } }