diff options
Diffstat (limited to 'packages')
45 files changed, 160 insertions, 213 deletions
diff --git a/packages/DocumentsUI/res/layout/fragment_directory.xml b/packages/DocumentsUI/res/layout/fragment_directory.xml index f0ab0d1..b4138a5 100644 --- a/packages/DocumentsUI/res/layout/fragment_directory.xml +++ b/packages/DocumentsUI/res/layout/fragment_directory.xml @@ -40,12 +40,4 @@ android:listSelector="@android:color/transparent" android:visibility="gone" /> - <Button - android:id="@+id/more" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="bottom" - android:text="@string/more" - android:visibility="gone" /> - </FrameLayout> diff --git a/packages/Keyguard/AndroidManifest.xml b/packages/Keyguard/AndroidManifest.xml index d2c82c8..7d77c48 100644 --- a/packages/Keyguard/AndroidManifest.xml +++ b/packages/Keyguard/AndroidManifest.xml @@ -37,8 +37,6 @@ <uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW" /> <uses-permission android:name="android.permission.BIND_DEVICE_ADMIN" /> <uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" /> - <!-- Permission to perform hotword recognition --> - <uses-permission android:name="android.permission.HOTWORD_RECOGNITION" /> <application android:label="@string/app_name" android:process="com.android.systemui" diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java index 40a1af6..fbe3a9c 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java @@ -49,9 +49,6 @@ import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; -import android.speech.hotword.HotwordRecognitionListener; -import android.speech.hotword.HotwordRecognitionService; -import android.speech.hotword.HotwordRecognizer; import android.telephony.TelephonyManager; import android.util.AttributeSet; import android.util.Log; @@ -69,10 +66,6 @@ import java.util.List; public class KeyguardHostView extends KeyguardViewBase { private static final String TAG = "KeyguardHostView"; - // Don't enable hotword on limited-memory devices. - private static final boolean ENABLE_HOTWORD = !ActivityManager.isLowRamDeviceStatic(); - // Indicates if hotword is enabled, should it also be available on secure keyguard(s). - private static final boolean ENABLE_HOTWORD_SECURE = false; // Transport control states. static final int TRANSPORT_GONE = 0; @@ -88,13 +81,6 @@ public class KeyguardHostView extends KeyguardViewBase { // Found in KeyguardAppWidgetPickActivity.java static final int APPWIDGET_HOST_ID = 0x4B455947; - // TODO: Fix this to be non-static. - // We need to be careful here to make stopRecognition calls on the same instance - // that started it. Since KeyguardHostView is a view, it keeps getting - // recreated every now and then, and unless we figure out a better way, - // this needs to be a static field. - private static HotwordRecognizer sHotwordClient; - private final int MAX_WIDGETS = 5; private AppWidgetHost mAppWidgetHost; @@ -218,11 +204,6 @@ public class KeyguardHostView extends KeyguardViewBase { if ((mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0) { Log.v(TAG, "Keyguard secure camera disabled by DPM"); } - - // Create Hotword recognizer, for the first time. - if (ENABLE_HOTWORD && sHotwordClient == null) { - sHotwordClient = HotwordRecognizer.createHotwordRecognizer(getContext()); - } } private void getInitialTransportState() { @@ -320,21 +301,6 @@ public class KeyguardHostView extends KeyguardViewBase { } } } - @Override - public void onPhoneStateChanged(int phoneState) { - // We need to stop hotword detection when a call state is not idle anymore. - if (shouldRunHotwordInSecurityMode(mCurrentSecuritySelection) - && TelephonyManager.CALL_STATE_IDLE != phoneState) { - if (DEBUG) Log.d(TAG, "Stopping due to call state not being idle"); - maybeStopHotwordDetector(); - } - } - @Override - public void onUserSwitching(int userId) { - if (shouldRunHotwordInSecurityMode(mCurrentSecuritySelection)) { - maybeStopHotwordDetector(); - } - } }; private static final boolean isMusicPlaying(int playbackState) { @@ -818,9 +784,6 @@ public class KeyguardHostView extends KeyguardViewBase { // If the alternate unlock was suppressed, it can now be safely // enabled because the user has left keyguard. KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true); - if (shouldRunHotwordInSecurityMode(mCurrentSecuritySelection)){ - maybeStopHotwordDetector(); - } // If there's a pending runnable because the user interacted with a widget // and we're leaving keyguard, then run it. @@ -985,9 +948,6 @@ public class KeyguardHostView extends KeyguardViewBase { // Emulate Activity life cycle if (oldView != null) { - if (shouldRunHotwordInSecurityMode(mCurrentSecuritySelection)) { - maybeStopHotwordDetector(); - } oldView.onPause(); oldView.setKeyguardCallback(mNullCallback); // ignore requests from old view } @@ -1041,11 +1001,6 @@ public class KeyguardHostView extends KeyguardViewBase { mViewStateManager.showUsabilityHints(); } - // Start hotword detection on insecure Keyguard. - if (shouldRunHotwordInSecurityMode(mCurrentSecuritySelection)) { - maybeStartHotwordDetector(); - } - requestFocus(); } @@ -1068,11 +1023,6 @@ public class KeyguardHostView extends KeyguardViewBase { cameraPage.onScreenTurnedOff(); } - // Stop hotword detection on insecure Keyguard. - if (shouldRunHotwordInSecurityMode(mCurrentSecuritySelection)) { - maybeStopHotwordDetector(); - } - clearFocus(); } @@ -1157,9 +1107,6 @@ public class KeyguardHostView extends KeyguardViewBase { new CameraWidgetFrame.Callbacks() { @Override public void onLaunchingCamera() { - if (shouldRunHotwordInSecurityMode(mCurrentSecuritySelection)) { - maybeStopHotwordDetector(); - } setSliderHandleAlpha(0); } @@ -1689,9 +1636,6 @@ public class KeyguardHostView extends KeyguardViewBase { } public void showAssistant() { - if (shouldRunHotwordInSecurityMode(mCurrentSecuritySelection)) { - maybeStopHotwordDetector(); - } final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) .getAssistIntent(mContext, true, UserHandle.USER_CURRENT); @@ -1706,125 +1650,4 @@ public class KeyguardHostView extends KeyguardViewBase { mActivityLauncher.launchActivityWithAnimation( intent, false, opts.toBundle(), null, null); } - - - /** - * Start the hotword detector if: - * <li> ENABLE_HOTWORD is true and - * <li> Hotword detection is not already running and - * <li> TelephonyManager is in CALL_STATE_IDLE - * <li> and Screen is turned on. - */ - private void maybeStartHotwordDetector() { - if (!ENABLE_HOTWORD) return; - - if (sHotwordClient != null) { - if (DEBUG) Log.d(TAG, "maybeStartHotwordDetector()"); - // Don't start hotword detection if the screen is off. - if (!mIsScreenOn) { - if (DEBUG) Log.d(TAG, "screen was off, not starting"); - return; - } - - KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(getContext()); - if (monitor.getPhoneState() != TelephonyManager.CALL_STATE_IDLE) { - if (DEBUG) Log.d(TAG, "Call underway, not starting"); - return; - } - - try { - sHotwordClient.startRecognition(mHotwordCallback); - } catch(Exception ex) { - // Don't allow hotword errors to make the keyguard unusable - Log.e(TAG, "Failed to start hotword recognition", ex); - sHotwordClient = null; - } - } - } - - /** - * Stop hotword detector if: - * <li> ENABLE_HOTWORD is true - * <li> and hotword is running. - */ - private void maybeStopHotwordDetector() { - if (!ENABLE_HOTWORD) return; - - if (sHotwordClient != null) { - if (DEBUG) Log.d(TAG, "maybeStopHotwordDetector()"); - try { - sHotwordClient.stopRecognition(); - } catch(Exception ex) { - // Don't allow hotword errors to make the keyguard unusable - Log.e(TAG, "Failed to start hotword recognition", ex); - } finally { - sHotwordClient = null; - } - } - } - - private final HotwordRecognitionListener mHotwordCallback = new HotwordRecognitionListener() { - private static final String TAG = "HotwordRecognitionListener"; - - public void onHotwordRecognitionStarted() { - if (DEBUG) Log.d(TAG, "onHotwordRecognitionStarted()"); - } - - public void onHotwordRecognitionStopped() { - if (DEBUG) Log.d(TAG, "onHotwordRecognitionStopped()"); - } - - public void onHotwordEvent(int eventType, Bundle eventBundle) { - if (DEBUG) Log.d(TAG, "onHotwordEvent: " + eventType); - if (eventType == HotwordRecognitionService.EVENT_TYPE_PROMPT_CHANGED) { - if (eventBundle != null - && eventBundle.containsKey(HotwordRecognitionService.KEY_PROMPT_TEXT)) { - new KeyguardMessageArea - .Helper((View) getSecurityView(mCurrentSecuritySelection)) - .setMessage(eventBundle.getString( - HotwordRecognitionService.KEY_PROMPT_TEXT),true); - } - } - } - - public void onHotwordRecognized(final Intent intent) { - if (DEBUG) Log.d(TAG, "onHotwordRecognized"); - maybeStopHotwordDetector(); - // See if an activity can handle this intent. - if (getContext().getPackageManager().resolveActivity(intent, 0) == null) - return; - if (SecurityMode.None == mCurrentSecuritySelection) { - if (intent != null) { - mActivityLauncher.launchActivity(intent, true, true, null, null); - } - mCallback.userActivity(0); - } else if (ENABLE_HOTWORD_SECURE && mLockPatternUtils.isSecure()) { - setOnDismissAction(new OnDismissAction() { - @Override - public boolean onDismiss() { - if (intent != null) { - mActivityLauncher.launchActivity(intent, true, true, null, null); - } - return false; - } - }); - getSecurityView(mCurrentSecuritySelection).showBouncer(0); - } - } - - public void onHotwordError(int errorCode) { - if (DEBUG) Log.d(TAG, "onHotwordError: " + errorCode); - // TODO: Inspect the error code and handle the errors appropriately - // instead of blindly failing. - maybeStopHotwordDetector(); - } - }; - - private boolean shouldRunHotwordInSecurityMode(SecurityMode mode) { - // Enable hotoword for insecure keyguard, - // and for pattern unlock if ENABLE_HOTWORD_SECURE is true. - return ENABLE_HOTWORD - && ((SecurityMode.None == mode) - || (ENABLE_HOTWORD_SECURE && mLockPatternUtils.isSecure())); - } } diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java index 080290c..dd7a828 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java @@ -104,6 +104,10 @@ public class SettingsHelper { } else { Uri canonicalUri = Uri.parse(value); ringtoneUri = mContext.getContentResolver().uncanonicalize(canonicalUri); + if (ringtoneUri == null) { + // Unrecognized or invalid Uri, don't restore + return; + } } final int ringtoneType = Settings.System.RINGTONE.equals(name) ? RingtoneManager.TYPE_RINGTONE : RingtoneManager.TYPE_NOTIFICATION; diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_in.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_in.png Binary files differnew file mode 100644 index 0000000..6ff215b --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_in.png diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_inout.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_inout.png Binary files differnew file mode 100644 index 0000000..cf5e825 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_inout.png diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_out.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_out.png Binary files differnew file mode 100644 index 0000000..5d8fd07 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/ic_qs_signal_out.png diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_wifi_in.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_wifi_in.png Binary files differnew file mode 100644 index 0000000..ebd2001 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/ic_qs_wifi_in.png diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_wifi_inout.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_wifi_inout.png Binary files differnew file mode 100644 index 0000000..cf5e825 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/ic_qs_wifi_inout.png diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_wifi_out.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_wifi_out.png Binary files differnew file mode 100644 index 0000000..5d8fd07 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/ic_qs_wifi_out.png diff --git a/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_in.png b/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_in.png Binary files differnew file mode 100644 index 0000000..e6a2f17 --- /dev/null +++ b/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_in.png diff --git a/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_inout.png b/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_inout.png Binary files differnew file mode 100644 index 0000000..fd40015 --- /dev/null +++ b/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_inout.png diff --git a/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_out.png b/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_out.png Binary files differnew file mode 100644 index 0000000..0a6d20a --- /dev/null +++ b/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_signal_out.png diff --git a/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_in.png b/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_in.png Binary files differnew file mode 100644 index 0000000..9c8f3e7 --- /dev/null +++ b/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_in.png diff --git a/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_inout.png b/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_inout.png Binary files differnew file mode 100644 index 0000000..7e773f0 --- /dev/null +++ b/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_inout.png diff --git a/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_out.png b/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_out.png Binary files differnew file mode 100644 index 0000000..2ecfd0b --- /dev/null +++ b/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_signal_out.png diff --git a/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_in.png b/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_in.png Binary files differnew file mode 100644 index 0000000..f3245a0 --- /dev/null +++ b/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_in.png diff --git a/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_inout.png b/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_inout.png Binary files differnew file mode 100644 index 0000000..9f02b9d --- /dev/null +++ b/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_inout.png diff --git a/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_out.png b/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_out.png Binary files differnew file mode 100644 index 0000000..8452087 --- /dev/null +++ b/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_signal_out.png diff --git a/packages/SystemUI/res/drawable-ldrtl-xxhdpi/ic_qs_signal_in.png b/packages/SystemUI/res/drawable-ldrtl-xxhdpi/ic_qs_signal_in.png Binary files differnew file mode 100644 index 0000000..61b0df9 --- /dev/null +++ b/packages/SystemUI/res/drawable-ldrtl-xxhdpi/ic_qs_signal_in.png diff --git a/packages/SystemUI/res/drawable-ldrtl-xxhdpi/ic_qs_signal_inout.png b/packages/SystemUI/res/drawable-ldrtl-xxhdpi/ic_qs_signal_inout.png Binary files differnew file mode 100644 index 0000000..e450506 --- /dev/null +++ b/packages/SystemUI/res/drawable-ldrtl-xxhdpi/ic_qs_signal_inout.png diff --git a/packages/SystemUI/res/drawable-ldrtl-xxhdpi/ic_qs_signal_out.png b/packages/SystemUI/res/drawable-ldrtl-xxhdpi/ic_qs_signal_out.png Binary files differnew file mode 100644 index 0000000..f8b63cb --- /dev/null +++ b/packages/SystemUI/res/drawable-ldrtl-xxhdpi/ic_qs_signal_out.png diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_in.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_in.png Binary files differnew file mode 100644 index 0000000..da4ffa2 --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_in.png diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_inout.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_inout.png Binary files differnew file mode 100644 index 0000000..e1c7972 --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_inout.png diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_out.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_out.png Binary files differnew file mode 100644 index 0000000..b8c8b4e --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/ic_qs_signal_out.png diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_wifi_in.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_wifi_in.png Binary files differnew file mode 100644 index 0000000..5d0ad7c --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/ic_qs_wifi_in.png diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_wifi_inout.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_wifi_inout.png Binary files differnew file mode 100644 index 0000000..e1c7972 --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/ic_qs_wifi_inout.png diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_wifi_out.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_wifi_out.png Binary files differnew file mode 100644 index 0000000..b8c8b4e --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/ic_qs_wifi_out.png diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_in.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_in.png Binary files differnew file mode 100644 index 0000000..46fd826 --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_in.png diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_inout.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_inout.png Binary files differnew file mode 100644 index 0000000..c824b97 --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_inout.png diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_out.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_out.png Binary files differnew file mode 100644 index 0000000..fb9ecd0 --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/ic_qs_signal_out.png diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_wifi_in.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_wifi_in.png Binary files differnew file mode 100644 index 0000000..6cf0a4b --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/ic_qs_wifi_in.png diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_wifi_inout.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_wifi_inout.png Binary files differnew file mode 100644 index 0000000..c824b97 --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/ic_qs_wifi_inout.png diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_wifi_out.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_wifi_out.png Binary files differnew file mode 100644 index 0000000..fb9ecd0 --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/ic_qs_wifi_out.png diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_signal_in.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_signal_in.png Binary files differnew file mode 100644 index 0000000..1094bc3 --- /dev/null +++ b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_signal_in.png diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_signal_inout.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_signal_inout.png Binary files differnew file mode 100644 index 0000000..1037b02 --- /dev/null +++ b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_signal_inout.png diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_signal_out.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_signal_out.png Binary files differnew file mode 100644 index 0000000..f5595e3 --- /dev/null +++ b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_signal_out.png diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_wifi_in.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_wifi_in.png Binary files differnew file mode 100644 index 0000000..7183a07 --- /dev/null +++ b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_wifi_in.png diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_wifi_inout.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_wifi_inout.png Binary files differnew file mode 100644 index 0000000..3746328 --- /dev/null +++ b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_wifi_inout.png diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_wifi_out.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_wifi_out.png Binary files differnew file mode 100644 index 0000000..dbf54ce --- /dev/null +++ b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_wifi_out.png diff --git a/packages/SystemUI/res/layout/quick_settings_tile_rssi.xml b/packages/SystemUI/res/layout/quick_settings_tile_rssi.xml index 34506b1..cabfaa5 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_rssi.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_rssi.xml @@ -13,32 +13,49 @@ See the License for the specific language governing permissions and limitations under the License. --> -<LinearLayout +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_gravity="top" - android:orientation="vertical"> + android:layout_gravity="top"> <FrameLayout + android:id="@+id/rssi_images" android:layout_marginTop="@dimen/qs_tile_margin_above_icon" android:layout_marginBottom="@dimen/qs_tile_margin_below_icon" android:layout_width="@dimen/qs_tile_icon_size" android:layout_height="@dimen/qs_tile_icon_size" android:layout_gravity="top|center_horizontal" + android:layout_centerHorizontal="true" > <ImageView android:id="@+id/rssi_image" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center" + android:layout_centerInParent="true" /> <ImageView android:id="@+id/rssi_overlay_image" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center" + android:layout_centerInParent="true" /> </FrameLayout> + <ImageView + android:id="@+id/activity_in" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_qs_signal_in" + android:layout_toRightOf="@id/rssi_images" + android:layout_alignBottom="@id/rssi_images" + /> + <ImageView + android:id="@+id/activity_out" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_qs_signal_out" + android:layout_toRightOf="@id/rssi_images" + android:layout_alignBottom="@id/rssi_images" + /> <TextView style="@style/TextAppearance.QuickSettings.TileView" android:id="@+id/rssi_textview" @@ -47,5 +64,7 @@ android:layout_gravity="top|center_horizontal" android:gravity="top|center_horizontal" android:text="@string/quick_settings_rssi_label" + android:layout_centerHorizontal="true" + android:layout_below="@id/rssi_images" /> -</LinearLayout>
\ No newline at end of file +</RelativeLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_wifi.xml b/packages/SystemUI/res/layout/quick_settings_tile_wifi.xml new file mode 100644 index 0000000..e61c595 --- /dev/null +++ b/packages/SystemUI/res/layout/quick_settings_tile_wifi.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2013 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. +--> +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="top"> + <ImageView + android:id="@+id/image" + android:layout_marginTop="@dimen/qs_tile_margin_above_icon" + android:layout_marginBottom="@dimen/qs_tile_margin_below_icon" + android:layout_width="@dimen/qs_tile_icon_size" + android:layout_height="@dimen/qs_tile_icon_size" + android:layout_gravity="top|center_horizontal" + android:layout_centerHorizontal="true" + android:scaleType="centerInside" + /> + <ImageView + android:id="@+id/activity_in" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_qs_wifi_in" + android:layout_toRightOf="@id/image" + android:layout_alignBottom="@id/image" + /> + <ImageView + android:id="@+id/activity_out" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_qs_wifi_out" + android:layout_toRightOf="@id/image" + android:layout_alignBottom="@id/image" + /> + <TextView + style="@style/TextAppearance.QuickSettings.TileView" + android:id="@+id/text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="top|center_horizontal" + android:gravity="top|center_horizontal" + android:layout_centerHorizontal="true" + android:layout_below="@id/image" + /> +</RelativeLayout>
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java index 0d591ba..68ee2b5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.phone; +import android.animation.ValueAnimator; import android.app.ActivityManagerNative; import android.app.AlertDialog; import android.app.Dialog; @@ -62,6 +63,7 @@ import android.widget.ImageView; import android.widget.TextView; import com.android.systemui.R; +import com.android.systemui.statusbar.phone.QuickSettingsModel.ActivityState; import com.android.systemui.statusbar.phone.QuickSettingsModel.BluetoothState; import com.android.systemui.statusbar.phone.QuickSettingsModel.RSSIState; import com.android.systemui.statusbar.phone.QuickSettingsModel.State; @@ -401,8 +403,9 @@ class QuickSettings { private void addSystemTiles(ViewGroup parent, LayoutInflater inflater) { // Wi-fi - final QuickSettingsBasicTile wifiTile - = new QuickSettingsBasicTile(mContext); + final QuickSettingsTileView wifiTile = (QuickSettingsTileView) + inflater.inflate(R.layout.quick_settings_tile, parent, false); + wifiTile.setContent(R.layout.quick_settings_tile_wifi, inflater); wifiTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -433,12 +436,15 @@ class QuickSettings { return true; }} ); } - mModel.addWifiTile(wifiTile, new QuickSettingsModel.RefreshCallback() { + mModel.addWifiTile(wifiTile, new NetworkActivityCallback() { @Override - public void refreshView(QuickSettingsTileView unused, State state) { + public void refreshView(QuickSettingsTileView view, State state) { WifiState wifiState = (WifiState) state; - wifiTile.setImageResource(wifiState.iconId); - wifiTile.setText(wifiState.label); + ImageView iv = (ImageView) view.findViewById(R.id.image); + iv.setImageResource(wifiState.iconId); + setActivity(view, wifiState); + TextView tv = (TextView) view.findViewById(R.id.text); + tv.setText(wifiState.label); wifiTile.setContentDescription(mContext.getString( R.string.accessibility_quick_settings_wifi, wifiState.signalContentDescription, @@ -462,7 +468,7 @@ class QuickSettings { startSettingsActivity(intent); } }); - mModel.addRSSITile(rssiTile, new QuickSettingsModel.RefreshCallback() { + mModel.addRSSITile(rssiTile, new NetworkActivityCallback() { @Override public void refreshView(QuickSettingsTileView view, State state) { RSSIState rssiState = (RSSIState) state; @@ -478,6 +484,8 @@ class QuickSettings { } else { iov.setImageDrawable(null); } + setActivity(view, rssiState); + tv.setText(state.label); view.setContentDescription(mContext.getResources().getString( R.string.accessibility_quick_settings_mobile, @@ -942,4 +950,25 @@ class QuickSettings { } }; + + private abstract static class NetworkActivityCallback + implements QuickSettingsModel.RefreshCallback { + private final long mDefaultDuration = new ValueAnimator().getDuration(); + private final long mShortDuration = mDefaultDuration / 3; + + public void setActivity(View view, ActivityState state) { + setVisibility(view.findViewById(R.id.activity_in), state.activityIn); + setVisibility(view.findViewById(R.id.activity_out), state.activityOut); + } + + private void setVisibility(View view, boolean visible) { + final float newAlpha = visible ? 1 : 0; + if (view.getAlpha() != newAlpha) { + view.animate() + .setDuration(visible ? mShortDuration : mDefaultDuration) + .alpha(newAlpha) + .start(); + } + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java index b9e3059..9d0418d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java @@ -70,13 +70,17 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, int batteryLevel; boolean pluggedIn; } - static class RSSIState extends State { + static class ActivityState extends State { + boolean activityIn; + boolean activityOut; + } + static class RSSIState extends ActivityState { int signalIconId; String signalContentDescription; int dataTypeIconId; String dataContentDescription; } - static class WifiState extends State { + static class WifiState extends ActivityState { String signalContentDescription; boolean connected; } @@ -430,6 +434,7 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, // NetworkSignalChanged callback @Override public void onWifiSignalChanged(boolean enabled, int wifiSignalIconId, + boolean activityIn, boolean activityOut, String wifiSignalContentDescription, String enabledDesc) { // TODO: If view is in awaiting state, disable Resources r = mContext.getResources(); @@ -438,6 +443,8 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, boolean wifiNotConnected = (wifiSignalIconId > 0) && (enabledDesc == null); mWifiState.enabled = enabled; mWifiState.connected = wifiConnected; + mWifiState.activityIn = enabled && activityIn; + mWifiState.activityOut = enabled && activityOut; if (wifiConnected) { mWifiState.iconId = wifiSignalIconId; mWifiState.label = removeDoubleQuotes(enabledDesc); @@ -468,7 +475,8 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, @Override public void onMobileDataSignalChanged( boolean enabled, int mobileSignalIconId, String signalContentDescription, - int dataTypeIconId, String dataContentDescription, String enabledDesc) { + int dataTypeIconId, boolean activityIn, boolean activityOut, + String dataContentDescription,String enabledDesc) { if (deviceHasMobileData()) { // TODO: If view is in awaiting state, disable Resources r = mContext.getResources(); @@ -481,6 +489,8 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, mRSSIState.dataTypeIconId = enabled && (dataTypeIconId > 0) && !mWifiState.enabled ? dataTypeIconId : 0; + mRSSIState.activityIn = enabled && activityIn; + mRSSIState.activityOut = enabled && activityOut; mRSSIState.dataContentDescription = enabled && (dataTypeIconId > 0) && !mWifiState.enabled ? dataContentDescription : r.getString(R.string.accessibility_no_data); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java index 1e7e692..a715450 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -165,9 +165,11 @@ public class NetworkController extends BroadcastReceiver implements DemoMode { public interface NetworkSignalChangedCallback { void onWifiSignalChanged(boolean enabled, int wifiSignalIconId, - String wifitSignalContentDescriptionId, String description); + boolean activityIn, boolean activityOut, + String wifiSignalContentDescriptionId, String description); void onMobileDataSignalChanged(boolean enabled, int mobileSignalIconId, String mobileSignalContentDescriptionId, int dataTypeIconId, + boolean activityIn, boolean activityOut, String dataTypeContentDescriptionId, String description); void onAirplaneModeChanged(boolean enabled); } @@ -313,22 +315,33 @@ public class NetworkController extends BroadcastReceiver implements DemoMode { boolean wifiEnabled = mWifiEnabled && (mWifiConnected || !mHasMobileDataFeature); String wifiDesc = wifiEnabled ? mWifiSsid : null; - cb.onWifiSignalChanged(wifiEnabled, mQSWifiIconId, mContentDescriptionWifi, wifiDesc); - + boolean wifiIn = wifiEnabled && mWifiSsid != null + && (mWifiActivity == WifiManager.DATA_ACTIVITY_INOUT + || mWifiActivity == WifiManager.DATA_ACTIVITY_IN); + boolean wifiOut = wifiEnabled && mWifiSsid != null + && (mWifiActivity == WifiManager.DATA_ACTIVITY_INOUT + || mWifiActivity == WifiManager.DATA_ACTIVITY_OUT); + cb.onWifiSignalChanged(wifiEnabled, mQSWifiIconId, wifiIn, wifiOut, + mContentDescriptionWifi, wifiDesc); + + boolean mobileIn = mDataConnected && (mDataActivity == TelephonyManager.DATA_ACTIVITY_INOUT + || mDataActivity == TelephonyManager.DATA_ACTIVITY_IN); + boolean mobileOut = mDataConnected && (mDataActivity == TelephonyManager.DATA_ACTIVITY_INOUT + || mDataActivity == TelephonyManager.DATA_ACTIVITY_OUT); if (isEmergencyOnly()) { cb.onMobileDataSignalChanged(false, mQSPhoneSignalIconId, - mContentDescriptionPhoneSignal, mQSDataTypeIconId, mContentDescriptionDataType, - null); + mContentDescriptionPhoneSignal, mQSDataTypeIconId, mobileIn, mobileOut, + mContentDescriptionDataType, null); } else { if (mIsWimaxEnabled && mWimaxConnected) { // Wimax is special cb.onMobileDataSignalChanged(true, mQSPhoneSignalIconId, - mContentDescriptionPhoneSignal, mQSDataTypeIconId, + mContentDescriptionPhoneSignal, mQSDataTypeIconId, mobileIn, mobileOut, mContentDescriptionDataType, mNetworkName); } else { // Normal mobile data cb.onMobileDataSignalChanged(mHasMobileDataFeature, mQSPhoneSignalIconId, - mContentDescriptionPhoneSignal, mQSDataTypeIconId, + mContentDescriptionPhoneSignal, mQSDataTypeIconId, mobileIn, mobileOut, mContentDescriptionDataType, mNetworkName); } } @@ -1125,6 +1138,11 @@ public class NetworkController extends BroadcastReceiver implements DemoMode { + " mBluetoothTetherIconId=0x" + Integer.toHexString(mBluetoothTetherIconId)); } + // update QS + for (NetworkSignalChangedCallback cb : mSignalsChangedCallbacks) { + notifySignalsChangedCallbacks(cb); + } + if (mLastPhoneSignalIconId != mPhoneSignalIconId || mLastWifiIconId != mWifiIconId || mLastWimaxIconId != mWimaxIconId @@ -1136,9 +1154,6 @@ public class NetworkController extends BroadcastReceiver implements DemoMode { for (SignalCluster cluster : mSignalClusters) { refreshSignalCluster(cluster); } - for (NetworkSignalChangedCallback cb : mSignalsChangedCallbacks) { - notifySignalsChangedCallbacks(cb); - } } if (mLastAirplaneMode != mAirplaneMode) { |