diff options
Diffstat (limited to 'packages')
22 files changed, 389 insertions, 86 deletions
diff --git a/packages/CaptivePortalLogin/Android.mk b/packages/CaptivePortalLogin/Android.mk new file mode 100644 index 0000000..576debc --- /dev/null +++ b/packages/CaptivePortalLogin/Android.mk @@ -0,0 +1,11 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := CaptivePortalLogin +LOCAL_CERTIFICATE := platform + +include $(BUILD_PACKAGE) diff --git a/packages/CaptivePortalLogin/AndroidManifest.xml b/packages/CaptivePortalLogin/AndroidManifest.xml new file mode 100644 index 0000000..5f78afe --- /dev/null +++ b/packages/CaptivePortalLogin/AndroidManifest.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* + * 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. + */ +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.captiveportallogin" > + + <uses-permission android:name="android.permission.INTERNET" /> + + <application android:label="@string/app_name" > + <activity + android:name="com.android.captiveportallogin.CaptivePortalLoginActivity" + android:label="@string/action_bar_label" + android:theme="@android:style/Theme.Holo" > + <intent-filter> + <action android:name="android.intent.action.ACTION_SEND"/> + <category android:name="android.intent.category.DEFAULT"/> + <data android:mimeType="text/plain"/> + </intent-filter> + </activity> + </application> +</manifest> diff --git a/packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml b/packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml new file mode 100644 index 0000000..d8f2928 --- /dev/null +++ b/packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml @@ -0,0 +1,20 @@ +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context="com.android.captiveportallogin.CaptivePortalLoginActivity" + tools:ignore="MergeRootFrame"> + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <WebView + android:id="@+id/webview" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_alignParentBottom="false" + android:layout_alignParentRight="false" /> + +</RelativeLayout> +</FrameLayout> diff --git a/packages/CaptivePortalLogin/res/menu/captive_portal_login.xml b/packages/CaptivePortalLogin/res/menu/captive_portal_login.xml new file mode 100644 index 0000000..1a88c5c --- /dev/null +++ b/packages/CaptivePortalLogin/res/menu/captive_portal_login.xml @@ -0,0 +1,15 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + tools:context="com.android.captiveportallogin.CaptivePortalLoginActivity" > + <item + android:id="@+id/action_do_not_use_network" + android:orderInCategory="100" + android:showAsAction="never" + android:title="@string/action_do_not_use_network"/> + <item + android:id="@+id/action_use_network" + android:orderInCategory="200" + android:showAsAction="never" + android:title="@string/action_use_network"/> + +</menu> diff --git a/packages/CaptivePortalLogin/res/values/dimens.xml b/packages/CaptivePortalLogin/res/values/dimens.xml new file mode 100644 index 0000000..55c1e59 --- /dev/null +++ b/packages/CaptivePortalLogin/res/values/dimens.xml @@ -0,0 +1,7 @@ +<resources> + + <!-- Default screen margins, per the Android Design guidelines. --> + <dimen name="activity_horizontal_margin">16dp</dimen> + <dimen name="activity_vertical_margin">16dp</dimen> + +</resources> diff --git a/packages/CaptivePortalLogin/res/values/strings.xml b/packages/CaptivePortalLogin/res/values/strings.xml new file mode 100644 index 0000000..1b0f0a4 --- /dev/null +++ b/packages/CaptivePortalLogin/res/values/strings.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <string name="app_name">CaptivePortalLogin</string> + <string name="action_use_network">Use this network as is</string> + <string name="action_do_not_use_network">Do not use this network</string> + <string name="action_bar_label">Sign-in to network</string> + +</resources> diff --git a/packages/CaptivePortalLogin/res/values/styles.xml b/packages/CaptivePortalLogin/res/values/styles.xml new file mode 100644 index 0000000..6ce89c7 --- /dev/null +++ b/packages/CaptivePortalLogin/res/values/styles.xml @@ -0,0 +1,20 @@ +<resources> + + <!-- + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Light"> + <!-- + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + --> + </style> + + <!-- Application theme. --> + <style name="AppTheme" parent="AppBaseTheme"> + <!-- All customizations that are NOT specific to a particular API-level can go here. --> + </style> + +</resources> diff --git a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java new file mode 100644 index 0000000..2c1db02 --- /dev/null +++ b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java @@ -0,0 +1,160 @@ +/* + * 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. + */ + +package com.android.captiveportallogin; + +import android.app.Activity; +import android.content.Intent; +import android.graphics.Bitmap; +import android.net.ConnectivityManager; +import android.net.Network; +import android.os.Bundle; +import android.provider.Settings; +import android.provider.Settings.Global; +import android.view.Menu; +import android.view.MenuItem; +import android.view.Window; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.lang.InterruptedException; + +public class CaptivePortalLoginActivity extends Activity { + private static final String DEFAULT_SERVER = "clients3.google.com"; + private static final int SOCKET_TIMEOUT_MS = 10000; + + // Keep this in sync with NetworkMonitor. + // Intent broadcast to ConnectivityService indicating sign-in is complete. + // Extras: + // EXTRA_TEXT = netId + // LOGGED_IN_RESULT = "1" if we should use network, "0" if not. + private static final String ACTION_CAPTIVE_PORTAL_LOGGED_IN = + "android.net.netmon.captive_portal_logged_in"; + private static final String LOGGED_IN_RESULT = "result"; + + private URL mURL; + private int mNetId; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + String server = Settings.Global.getString(getContentResolver(), "captive_portal_server"); + if (server == null) server = DEFAULT_SERVER; + try { + mURL = new URL("http://" + server + "/generate_204"); + } catch (MalformedURLException e) { + done(true); + } + + requestWindowFeature(Window.FEATURE_PROGRESS); + setContentView(R.layout.activity_captive_portal_login); + + getActionBar().setDisplayShowHomeEnabled(false); + + mNetId = Integer.parseInt(getIntent().getStringExtra(Intent.EXTRA_TEXT)); + ConnectivityManager.setProcessDefaultNetwork(new Network(mNetId)); + + WebView myWebView = (WebView) findViewById(R.id.webview); + WebSettings webSettings = myWebView.getSettings(); + webSettings.setJavaScriptEnabled(true); + myWebView.setWebViewClient(new MyWebViewClient()); + myWebView.setWebChromeClient(new MyWebChromeClient()); + myWebView.loadUrl(mURL.toString()); + } + + private void done(boolean use_network) { + Intent intent = new Intent(ACTION_CAPTIVE_PORTAL_LOGGED_IN); + intent.putExtra(Intent.EXTRA_TEXT, String.valueOf(mNetId)); + intent.putExtra(LOGGED_IN_RESULT, use_network ? "1" : "0"); + sendBroadcast(intent); + finish(); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.captive_portal_login, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + if (id == R.id.action_use_network) { + done(true); + return true; + } + if (id == R.id.action_do_not_use_network) { + done(false); + return true; + } + return super.onOptionsItemSelected(item); + } + + private void testForCaptivePortal() { + new Thread(new Runnable() { + public void run() { + // Give time for captive portal to open. + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + } + HttpURLConnection urlConnection = null; + int httpResponseCode = 500; + try { + urlConnection = (HttpURLConnection) mURL.openConnection(); + urlConnection.setInstanceFollowRedirects(false); + urlConnection.setConnectTimeout(SOCKET_TIMEOUT_MS); + urlConnection.setReadTimeout(SOCKET_TIMEOUT_MS); + urlConnection.setUseCaches(false); + urlConnection.getInputStream(); + httpResponseCode = urlConnection.getResponseCode(); + } catch (IOException e) { + } finally { + if (urlConnection != null) urlConnection.disconnect(); + } + if (httpResponseCode == 204) { + done(true); + } + } + }).start(); + } + + private class MyWebViewClient extends WebViewClient { + @Override + public void onPageStarted(WebView view, String url, Bitmap favicon) { + testForCaptivePortal(); + } + + @Override + public void onPageFinished(WebView view, String url) { + testForCaptivePortal(); + } + } + + private class MyWebChromeClient extends WebChromeClient { + @Override + public void onProgressChanged(WebView view, int newProgress) { + setProgress(newProgress*100); + } + } +} diff --git a/packages/SystemUI/res/layout/status_bar_expanded_header.xml b/packages/SystemUI/res/layout/status_bar_expanded_header.xml index 2fd7bc4..8b79dbf 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded_header.xml @@ -69,7 +69,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginStart="8dp" - android:paddingEnd="4dp" + android:paddingEnd="@dimen/battery_level_padding_end" android:textColor="#ffffff" android:textSize="12sp"/> </LinearLayout> diff --git a/packages/SystemUI/res/layout/zen_mode_panel.xml b/packages/SystemUI/res/layout/zen_mode_panel.xml index 9d959fa..11f50ee 100644 --- a/packages/SystemUI/res/layout/zen_mode_panel.xml +++ b/packages/SystemUI/res/layout/zen_mode_panel.xml @@ -56,7 +56,6 @@ android:id="@+id/zen_subhead_expanded" android:layout_width="wrap_content" android:layout_height="32dp" - android:clickable="true" android:gravity="center_vertical" android:textAppearance="@style/TextAppearance.QS.Subhead" /> @@ -79,15 +78,4 @@ android:orientation="vertical" android:paddingTop="3dp" /> - <TextView - android:id="@+id/zen_alarm_warning" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingBottom="8dp" - android:paddingLeft="@dimen/qs_panel_padding" - android:paddingRight="@dimen/qs_panel_padding" - android:paddingTop="8dp" - android:text="@string/zen_alarm_warning" - android:textAppearance="@style/TextAppearance.QS.Warning" /> - </com.android.systemui.volume.ZenModePanel>
\ No newline at end of file diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 0bad2c3..e20947f 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -232,8 +232,9 @@ <!-- Space reserved for the cards behind the top card in the bottom stack --> <dimen name="bottom_stack_peek_amount">12dp</dimen> - <!-- bottom_stack_peek_amount + notification_min_height --> - <dimen name="min_stack_height">76dp</dimen> + <!-- bottom_stack_peek_amount + notification_min_height + + notification_collapse_second_card_padding --> + <dimen name="min_stack_height">84dp</dimen> <!-- The height of the area before the bottom stack in which the notifications slow down --> <dimen name="bottom_stack_slow_down_length">12dp</dimen> @@ -354,4 +355,7 @@ <!-- The font size of the time when expanded in QS --> <dimen name="qs_time_expanded_size">20sp</dimen> + + <!-- Battery level padding end when in expanded QS (but not on Keyguard) --> + <dimen name="battery_level_padding_end">4dp</dimen> </resources> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index ff60f1d..848fdf8 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -595,8 +595,8 @@ <!-- Description of the left direction in which one can to slide the handle in the Slide unlock screen. [CHAR LIMIT=NONE] --> <string name="description_direction_left">"Slide left for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string> - <!-- Zen mode: Alarm warning. [CHAR LIMIT=40] --> - <string name="zen_alarm_warning">You won\'t hear alarms or timers</string> + <!-- Zen mode: No interruptions title, with a warning about alarms and timers. [CHAR LIMIT=60] --> + <string name="zen_no_interruptions_with_warning">No interruptions, including alarms and timers</string> <!-- Zen mode: No interruptions. [CHAR LIMIT=40] --> <string name="zen_no_interruptions">No interruptions</string> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index d4acb11..f99b68b 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -185,11 +185,6 @@ <item name="android:textColor">@color/qs_subhead</item> </style> - <style name="TextAppearance.QS.Warning"> - <item name="android:textSize">12sp</item> - <item name="android:textColor">@color/qs_subhead</item> - </style> - <style name="TextAppearance.QS.SegmentedButton"> <item name="android:textSize">12sp</item> <item name="android:textAllCaps">true</item> @@ -259,11 +254,6 @@ <item name="android:layout_width">match_parent</item> </style> - <style name="QSWhiteTheme" parent="@android:style/Theme.DeviceDefault"> - <item name="android:colorControlNormal">#ffffffff</item> - <item name="android:colorControlActivated">#ffffffff</item> - </style> - <style name="QSBorderlessButton"> <item name="android:padding">12dp</item> <item name="android:background">@drawable/btn_borderless_rect</item> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java index 06cb318..597bb93 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java @@ -190,6 +190,7 @@ public class QSTileView extends ViewGroup { @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { final int w = getMeasuredWidth(); + final int h = getMeasuredHeight(); int top = 0; top += mTileSpacingPx; @@ -199,8 +200,8 @@ public class QSTileView extends ViewGroup { if (mRipple != null) { // center the touch feedback on the center of the icon, and dial it down a bit final int cx = w / 2; - final int cy = mIcon.getTop() + mIcon.getHeight() / 2; - final int rad = (int)(mIcon.getHeight() * 1.5); + final int cy = mDual ? mIcon.getTop() + mIcon.getHeight() / 2 : h / 2; + final int rad = (int)(mIcon.getHeight() * 1.25); mRipple.setHotspotBounds(cx - rad, cy - rad, cx + rad, cy + rad); } top = mIcon.getBottom(); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java index 9e86a1e..2876607 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -90,6 +90,10 @@ public class WifiTile extends QSTile<QSTile.SignalState> { @Override protected void handleSecondaryClick() { + if (!mState.enabled) { + mController.setWifiEnabled(true); + mState.enabled = true; + } showDetail(true); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index 57f4565..d1efb57 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -106,6 +106,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView public void run() { // Mark Recents as no longer visible AlternateRecentsComponent.notifyVisibilityChanged(false); + mVisible = false; // Finish Recents if (mLaunchIntent != null) { if (mLaunchOpts != null) { @@ -170,7 +171,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); - if (action.equals(Intent.ACTION_SCREEN_OFF)) { + if (action.equals(Intent.ACTION_SCREEN_OFF) && mVisible) { mFinishLaunchHomeRunnable.run(); } else if (action.equals(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED)) { // Refresh the search widget @@ -518,8 +519,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView if (mConfig.searchBarAppWidgetId >= 0) { mAppWidgetHost.stopListening(); } - - mVisible = false; } @Override @@ -641,6 +640,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView public void onTaskViewClicked() { // Mark recents as no longer visible AlternateRecentsComponent.notifyVisibilityChanged(false); + mVisible = false; } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java index 9921c55..ed3ebf5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java @@ -75,16 +75,18 @@ public class NotificationData { } private final ArrayList<Entry> mEntries = new ArrayList<Entry>(); - private RankingMap mRanking; + private RankingMap mRankingMap; + private final Ranking mTmpRanking = new Ranking(); private final Comparator<Entry> mRankingComparator = new Comparator<Entry>() { + private final Ranking mRankingA = new Ranking(); + private final Ranking mRankingB = new Ranking(); + @Override public int compare(Entry a, Entry b) { - if (mRanking != null) { - Ranking aRanking = mRanking.getRanking(a.key); - Ranking bRanking = mRanking.getRanking(b.key); - int aRank = aRanking != null ? aRanking.getRank() : -1; - int bRank = bRanking != null ? bRanking.getRank() : -1; - return aRank - bRank; + if (mRankingMap != null) { + mRankingMap.getRanking(a.key, mRankingA); + mRankingMap.getRanking(b.key, mRankingB); + return mRankingA.getRank() - mRankingB.getRank(); } final StatusBarNotification na = a.notification; @@ -138,7 +140,7 @@ public class NotificationData { public boolean isAmbient(String key) { // TODO: Remove when switching to NotificationListener. - if (mRanking == null) { + if (mRankingMap == null) { for (Entry entry : mEntries) { if (key.equals(entry.key)) { return entry.notification.getNotification().priority == @@ -146,15 +148,15 @@ public class NotificationData { } } } else { - Ranking ranking = mRanking.getRanking(key); - return ranking != null && ranking.isAmbient(); + mRankingMap.getRanking(key, mTmpRanking); + return mTmpRanking.isAmbient(); } return false; } private void updateRankingAndSort(RankingMap ranking) { if (ranking != null) { - mRanking = ranking; + mRankingMap = ranking; } Collections.sort(mEntries, mRankingComparator); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index e0a1ef1..55b3088 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -126,6 +126,8 @@ public class NotificationPanelView extends PanelView implements private boolean mBlockTouches; private ArrayList<View> mSwipeTranslationViews = new ArrayList<>(); private int mNotificationScrimWaitDistance; + private boolean mTwoFingerQsExpand; + private boolean mTwoFingerQsExpandPossible; /** * If we are in a panel collapsing motion, we reset scrollY of our scroll view but still @@ -487,7 +489,7 @@ public class NotificationPanelView extends PanelView implements if (mExpandedHeight != 0) { handleQsDown(event); } - if (mQsTracking || mQsExpanded) { + if (!mTwoFingerQsExpand && (mQsTracking || mQsExpanded)) { onQsTouch(event); if (!mConflictingQsExpansionGesture) { return true; @@ -497,6 +499,15 @@ public class NotificationPanelView extends PanelView implements || event.getActionMasked() == MotionEvent.ACTION_UP) { mConflictingQsExpansionGesture = false; } + if (event.getActionMasked() == MotionEvent.ACTION_DOWN && mExpandedHeight == 0) { + mTwoFingerQsExpandPossible = true; + } + if (mTwoFingerQsExpandPossible && event.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN + && event.getPointerCount() == 2 + && event.getY(event.getActionIndex()) < mStatusBarMinHeight) { + mTwoFingerQsExpand = true; + requestPanelHeightUpdate(); + } super.onTouchEvent(event); return true; } @@ -842,7 +853,7 @@ public class NotificationPanelView extends PanelView implements min = Math.max(min, minHeight); } int maxHeight; - if (mQsExpanded || mIsExpanding && mQsExpandedWhenExpandingStarted) { + if (mTwoFingerQsExpand || mQsExpanded || mIsExpanding && mQsExpandedWhenExpandingStarted) { maxHeight = (int) calculatePanelHeightQsExpanded(); } else { int emptyBottomMargin = mNotificationStackScroller.getEmptyBottomMargin(); @@ -863,7 +874,7 @@ public class NotificationPanelView extends PanelView implements if (!mQsExpanded) { positionClockAndNotifications(); } - if (mQsExpanded && !mQsTracking && mQsExpansionAnimator == null + if (mTwoFingerQsExpand || mQsExpanded && !mQsTracking && mQsExpansionAnimator == null && !mQsExpansionFromOverscroll) { float panelHeightQsCollapsed = mNotificationStackScroller.getIntrinsicPadding() + mNotificationStackScroller.getMinStackHeight() @@ -1049,6 +1060,8 @@ public class NotificationPanelView extends PanelView implements mHeader.setListening(true); mQsPanel.setListening(true); } + mTwoFingerQsExpand = false; + mTwoFingerQsExpandPossible = false; } @Override @@ -1060,7 +1073,7 @@ public class NotificationPanelView extends PanelView implements @Override protected void setOverExpansion(float overExpansion, boolean isPixels) { - if (mConflictingQsExpansionGesture) { + if (mConflictingQsExpansionGesture || mTwoFingerQsExpand) { return; } if (mStatusBar.getBarState() != StatusBarState.KEYGUARD) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java index b95b88f..0fbdeeb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java @@ -46,6 +46,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL private boolean mListening; private boolean mOverscrolled; private boolean mKeyguardShowing; + private boolean mCharging; private ViewGroup mSystemIconsContainer; private View mSystemIconsSuperContainer; @@ -80,6 +81,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL private int mClockMarginBottomExpanded; private int mMultiUserSwitchWidthCollapsed; private int mMultiUserSwitchWidthExpanded; + private int mBatteryPaddingEnd; /** * In collapsed QS, the clock and avatar are scaled down a bit post-layout to allow for a nice @@ -164,6 +166,8 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL mClockCollapsedScaleFactor = getResources().getDimensionPixelSize(R.dimen.qs_time_collapsed_size) / mClock.getTextSize(); + mBatteryPaddingEnd = + getResources().getDimensionPixelSize(R.dimen.battery_level_padding_end); } public void setActivityStarter(ActivityStarter activityStarter) { @@ -210,6 +214,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL updateClockScale(); updateAvatarScale(); updateClockLp(); + updateBatteryLevelPaddingEnd(); } } @@ -273,12 +278,13 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL ? VISIBLE : GONE); mMultiUserSwitch.setVisibility(mExpanded || !mKeyguardUserSwitcherShowing ? VISIBLE : GONE); - mBatteryLevel.setVisibility(mExpanded && !mOverscrolled ? View.VISIBLE : View.GONE); + mBatteryLevel.setVisibility(mKeyguardShowing && mCharging || mExpanded && !mOverscrolled + ? View.VISIBLE : View.GONE); } private void updateSystemIconsLayoutParams() { RelativeLayout.LayoutParams lp = (LayoutParams) mSystemIconsSuperContainer.getLayoutParams(); - lp.addRule(RelativeLayout.START_OF, mExpanded + lp.addRule(RelativeLayout.START_OF, mExpanded && !mOverscrolled ? mSettingsButton.getId() : mMultiUserSwitch.getId()); lp.removeRule(ALIGN_PARENT_START); @@ -318,9 +324,19 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL } } + private void updateBatteryLevelPaddingEnd() { + mBatteryLevel.setPaddingRelative(0, 0, + mKeyguardShowing && !mExpanded ? 0 : mBatteryPaddingEnd, 0); + } + @Override public void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) { mBatteryLevel.setText(getResources().getString(R.string.battery_level_template, level)); + boolean changed = mCharging != charging; + mCharging = charging; + if (changed) { + updateVisibilities(); + } } private void updateClickTargets() { @@ -361,14 +377,16 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL private void updateMultiUserSwitch() { int marginEnd; - if (mExpanded) { + if (mExpanded && !mOverscrolled) { marginEnd = mMultiUserExpandedMargin; } else if (mKeyguardShowing) { marginEnd = mMultiUserKeyguardMargin; } else { marginEnd = mMultiUserCollapsedMargin; } - int width = mExpanded ? mMultiUserSwitchWidthExpanded : mMultiUserSwitchWidthCollapsed; + int width = mExpanded && !mOverscrolled + ? mMultiUserSwitchWidthExpanded + : mMultiUserSwitchWidthCollapsed; MarginLayoutParams lp = (MarginLayoutParams) mMultiUserSwitch.getLayoutParams(); if (marginEnd != lp.getMarginEnd() || lp.width != width) { lp.setMarginEnd(marginEnd); @@ -421,6 +439,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL updatePadding(); updateMultiUserSwitch(); updateClickTargets(); + updateBatteryLevelPaddingEnd(); } public void setUserInfoController(UserInfoController userInfoController) { @@ -484,6 +503,12 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL return !mKeyguardShowing || mExpanded; } + @Override + protected void dispatchSetPressed(boolean pressed) { + // We don't want that everything lights up when we click on the header, so block the request + // here. + } + private final QSPanel.Callback mQsPanelCallback = new QSPanel.Callback() { @Override public void onToggleStateChanged(final boolean state) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index 799b41f..2b08902 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -34,6 +34,7 @@ import android.os.Message; import android.os.Messenger; import android.provider.Settings; import android.telephony.PhoneStateListener; +import android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.telephony.TelephonyManager; @@ -474,8 +475,8 @@ public class NetworkControllerImpl extends BroadcastReceiver PhoneStateListener mPhoneStateListener = new PhoneStateListener() { @Override public void onSignalStrengthsChanged(SignalStrength signalStrength) { - if (DEBUG) { - Log.d(TAG, "onSignalStrengthsChanged signalStrength=" + signalStrength + + if (true/*DEBUG*/) { + Rlog.d(TAG, "onSignalStrengthsChanged signalStrength=" + signalStrength + ((signalStrength == null) ? "" : (" level=" + signalStrength.getLevel()))); } mSignalStrength = signalStrength; @@ -485,8 +486,8 @@ public class NetworkControllerImpl extends BroadcastReceiver @Override public void onServiceStateChanged(ServiceState state) { - if (DEBUG) { - Log.d(TAG, "onServiceStateChanged voiceState=" + state.getVoiceRegState() + if (true/*DEBUG*/) { + Rlog.d(TAG, "onServiceStateChanged voiceState=" + state.getVoiceRegState() + " dataState=" + state.getDataRegState()); } mServiceState = state; @@ -498,8 +499,8 @@ public class NetworkControllerImpl extends BroadcastReceiver @Override public void onCallStateChanged(int state, String incomingNumber) { - if (DEBUG) { - Log.d(TAG, "onCallStateChanged state=" + state); + if (true/*DEBUG*/) { + Rlog.d(TAG, "onCallStateChanged state=" + state); } // In cdma, if a voice call is made, RSSI should switch to 1x. if (isCdma()) { @@ -510,8 +511,8 @@ public class NetworkControllerImpl extends BroadcastReceiver @Override public void onDataConnectionStateChanged(int state, int networkType) { - if (DEBUG) { - Log.d(TAG, "onDataConnectionStateChanged: state=" + state + if (true/*DEBUG*/) { + Rlog.d(TAG, "onDataConnectionStateChanged: state=" + state + " type=" + networkType); } mDataState = state; @@ -523,8 +524,8 @@ public class NetworkControllerImpl extends BroadcastReceiver @Override public void onDataActivity(int direction) { - if (DEBUG) { - Log.d(TAG, "onDataActivity: direction=" + direction); + if (true/*DEBUG*/) { + Rlog.d(TAG, "onDataActivity: direction=" + direction); } mDataActivity = direction; updateDataIcon(); @@ -555,6 +556,7 @@ public class NetworkControllerImpl extends BroadcastReceiver } else { mSimState = IccCardConstants.State.UNKNOWN; } + Rlog.d(TAG, "updateSimState: mSimState=" + mSimState); } private boolean isCdma() { @@ -562,6 +564,7 @@ public class NetworkControllerImpl extends BroadcastReceiver } private boolean hasService() { + boolean retVal; if (mServiceState != null) { // Consider the device to be in service if either voice or data service is available. // Some SIM cards are marketed as data-only and do not support voice service, and on @@ -569,16 +572,18 @@ public class NetworkControllerImpl extends BroadcastReceiver // service" or "emergency calls only" text that indicates that voice is not available. switch(mServiceState.getVoiceRegState()) { case ServiceState.STATE_POWER_OFF: - return false; + retVal = false; case ServiceState.STATE_OUT_OF_SERVICE: case ServiceState.STATE_EMERGENCY_ONLY: - return mServiceState.getDataRegState() == ServiceState.STATE_IN_SERVICE; + retVal = mServiceState.getDataRegState() == ServiceState.STATE_IN_SERVICE; default: - return true; + retVal = true; } } else { - return false; + retVal = false; } + Rlog.d(TAG, "hasService: mServiceState=" + mServiceState + " retVal=" + retVal); + return retVal; } private void updateAirplaneMode() { @@ -591,14 +596,15 @@ public class NetworkControllerImpl extends BroadcastReceiver } private final void updateTelephonySignalStrength() { - if (!hasService()) { + Rlog.d(TAG, "updateTelephonySignalStrength: hasService=" + hasService() + " ss=" + mSignalStrength); + if (false/*!hasService()*/) { if (CHATTY) Log.d(TAG, "updateTelephonySignalStrength: !hasService()"); mPhoneSignalIconId = R.drawable.stat_sys_signal_null; mQSPhoneSignalIconId = R.drawable.ic_qs_signal_no_signal; mDataSignalIconId = R.drawable.stat_sys_signal_null; } else { if (mSignalStrength == null) { - if (CHATTY) Log.d(TAG, "updateTelephonySignalStrength: mSignalStrength == null"); + if (true/*CHATTY*/) Rlog.d(TAG, "updateTelephonySignalStrength: mSignalStrength == null"); mPhoneSignalIconId = R.drawable.stat_sys_signal_null; mQSPhoneSignalIconId = R.drawable.ic_qs_signal_no_signal; mDataSignalIconId = R.drawable.stat_sys_signal_null; @@ -609,7 +615,7 @@ public class NetworkControllerImpl extends BroadcastReceiver int[] iconList; if (isCdma() && mAlwaysShowCdmaRssi) { mLastSignalLevel = iconLevel = mSignalStrength.getCdmaLevel(); - if(DEBUG) Log.d(TAG, "mAlwaysShowCdmaRssi=" + mAlwaysShowCdmaRssi + if(true/*DEBUG*/) Rlog.d(TAG, "updateTelephonySignalStrength: mAlwaysShowCdmaRssi=" + mAlwaysShowCdmaRssi + " set to cdmaLevel=" + mSignalStrength.getCdmaLevel() + " instead of level=" + mSignalStrength.getLevel()); } else { @@ -636,6 +642,7 @@ public class NetworkControllerImpl extends BroadcastReceiver mContentDescriptionPhoneSignal = mContext.getString( AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[iconLevel]); mDataSignalIconId = TelephonyIcons.DATA_SIGNAL_STRENGTH[mInetCondition][iconLevel]; + Rlog.d(TAG, "updateTelephonySignalStrength: iconLevel=" + iconLevel); } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 1721ec4..9bcffd1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -1317,7 +1317,8 @@ public class NotificationStackScrollLayout extends ViewGroup } public int getPeekHeight() { - return mIntrinsicPadding + mCollapsedSize + mBottomStackPeekSize; + return mIntrinsicPadding + mCollapsedSize + mBottomStackPeekSize + + mCollapseSecondCardPadding; } private int clampPadding(int desiredPadding) { @@ -1795,11 +1796,11 @@ public class NotificationStackScrollLayout extends ViewGroup } public int getEmptyBottomMargin() { - int emptyMargin = mMaxLayoutHeight - mContentHeight; + int emptyMargin = mMaxLayoutHeight - mContentHeight - mBottomStackPeekSize; if (needsHeightAdaption()) { - emptyMargin = emptyMargin - mBottomStackSlowDownHeight - mBottomStackPeekSize; + emptyMargin -= mBottomStackSlowDownHeight; } else { - emptyMargin = emptyMargin - mBottomStackPeekSize; + emptyMargin -= mCollapseSecondCardPadding; } return Math.max(emptyMargin, 0); } diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java index b9d07d5..6bb9765 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java +++ b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java @@ -85,7 +85,6 @@ public class ZenModePanel extends LinearLayout { private TextView mZenSubheadExpanded; private View mMoreSettings; private LinearLayout mZenConditions; - private View mAlarmWarning; private Callback mCallback; private ZenModeController mController; @@ -100,7 +99,7 @@ public class ZenModePanel extends LinearLayout { super(context, attrs); mContext = context; mFavorites = new Favorites(); - mInflater = LayoutInflater.from(new ContextThemeWrapper(context, R.style.QSWhiteTheme)); + mInflater = LayoutInflater.from(mContext.getApplicationContext()); mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(mContext, android.R.interpolator.fast_out_slow_in); updateTag(); @@ -134,13 +133,6 @@ public class ZenModePanel extends LinearLayout { }); mZenSubheadExpanded = (TextView) findViewById(R.id.zen_subhead_expanded); - mZenSubheadExpanded.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - setExpanded(false); - fireInteraction(); - } - }); mMoreSettings = findViewById(R.id.zen_more_settings); mMoreSettings.setOnClickListener(new View.OnClickListener() { @@ -152,8 +144,6 @@ public class ZenModePanel extends LinearLayout { }); mZenConditions = (LinearLayout) findViewById(R.id.zen_conditions); - - mAlarmWarning = findViewById(R.id.zen_alarm_warning); } @Override @@ -273,16 +263,16 @@ public class ZenModePanel extends LinearLayout { final boolean zenOff = zen == Global.ZEN_MODE_OFF; final boolean zenImportant = zen == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS; final boolean zenNone = zen == Global.ZEN_MODE_NO_INTERRUPTIONS; + final boolean foreverSelected = mExitConditionId == null; - mZenSubhead.setVisibility(!zenOff ? VISIBLE : GONE); + mZenSubhead.setVisibility(!zenOff && (mExpanded || !foreverSelected) ? VISIBLE : GONE); mZenSubheadExpanded.setVisibility(mExpanded ? VISIBLE : GONE); mZenSubheadCollapsed.setVisibility(!mExpanded ? VISIBLE : GONE); mMoreSettings.setVisibility(zenImportant && mExpanded ? VISIBLE : GONE); mZenConditions.setVisibility(!zenOff && mExpanded ? VISIBLE : GONE); - mAlarmWarning.setVisibility(zenNone && mExpanded ? VISIBLE : GONE); if (zenNone) { - mZenSubheadExpanded.setText(R.string.zen_no_interruptions); + mZenSubheadExpanded.setText(R.string.zen_no_interruptions_with_warning); mZenSubheadCollapsed.setText(mExitConditionText); } else if (zenImportant) { mZenSubheadExpanded.setText(R.string.zen_important_interruptions); |