summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java104
-rw-r--r--packages/SystemUI/res/layout/quick_settings_tile_bugreport.xml25
-rw-r--r--packages/SystemUI/res/values/strings.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java20
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java46
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java35
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java42
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java43
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java19
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java3
14 files changed, 273 insertions, 96 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 9839c16..f0b8812 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -23,7 +23,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
import android.app.backup.BackupManager;
import android.content.BroadcastReceiver;
import android.content.ContentProvider;
@@ -33,20 +32,17 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
-import android.content.pm.UserInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteQueryBuilder;
-import android.database.sqlite.SQLiteStatement;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
import android.os.FileObserver;
import android.os.ParcelFileDescriptor;
-import android.os.RemoteException;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
@@ -656,53 +652,59 @@ public class SettingsProvider extends ContentProvider {
}
}
- // Note: we assume that get/put operations for moved-to-global names have already
- // been directed to the new location on the caller side (otherwise we'd fix them
- // up here).
-
- DatabaseHelper dbHelper;
- SettingsCache cache;
-
- // Get methods
- if (Settings.CALL_METHOD_GET_SYSTEM.equals(method)) {
- if (LOCAL_LOGV) Slog.v(TAG, "call(system:" + request + ") for " + callingUser);
- dbHelper = getOrEstablishDatabase(callingUser);
- cache = sSystemCaches.get(callingUser);
- return lookupValue(dbHelper, TABLE_SYSTEM, cache, request);
- }
- if (Settings.CALL_METHOD_GET_SECURE.equals(method)) {
- if (LOCAL_LOGV) Slog.v(TAG, "call(secure:" + request + ") for " + callingUser);
- dbHelper = getOrEstablishDatabase(callingUser);
- cache = sSecureCaches.get(callingUser);
- return lookupValue(dbHelper, TABLE_SECURE, cache, request);
- }
- if (Settings.CALL_METHOD_GET_GLOBAL.equals(method)) {
- if (LOCAL_LOGV) Slog.v(TAG, "call(global:" + request + ") for " + callingUser);
- // fast path: owner db & cache are immutable after onCreate() so we need not
- // guard on the attempt to look them up
- return lookupValue(getOrEstablishDatabase(UserHandle.USER_OWNER), TABLE_GLOBAL,
- sGlobalCache, request);
- }
+ // Okay, permission checks have cleared. Reset to our own identity so we can
+ // manipulate all users' data with impunity.
+ long oldId = Binder.clearCallingIdentity();
+ try {
+ // Note: we assume that get/put operations for moved-to-global names have already
+ // been directed to the new location on the caller side (otherwise we'd fix them
+ // up here).
+ DatabaseHelper dbHelper;
+ SettingsCache cache;
+
+ // Get methods
+ if (Settings.CALL_METHOD_GET_SYSTEM.equals(method)) {
+ if (LOCAL_LOGV) Slog.v(TAG, "call(system:" + request + ") for " + callingUser);
+ dbHelper = getOrEstablishDatabase(callingUser);
+ cache = sSystemCaches.get(callingUser);
+ return lookupValue(dbHelper, TABLE_SYSTEM, cache, request);
+ }
+ if (Settings.CALL_METHOD_GET_SECURE.equals(method)) {
+ if (LOCAL_LOGV) Slog.v(TAG, "call(secure:" + request + ") for " + callingUser);
+ dbHelper = getOrEstablishDatabase(callingUser);
+ cache = sSecureCaches.get(callingUser);
+ return lookupValue(dbHelper, TABLE_SECURE, cache, request);
+ }
+ if (Settings.CALL_METHOD_GET_GLOBAL.equals(method)) {
+ if (LOCAL_LOGV) Slog.v(TAG, "call(global:" + request + ") for " + callingUser);
+ // fast path: owner db & cache are immutable after onCreate() so we need not
+ // guard on the attempt to look them up
+ return lookupValue(getOrEstablishDatabase(UserHandle.USER_OWNER), TABLE_GLOBAL,
+ sGlobalCache, request);
+ }
- // Put methods - new value is in the args bundle under the key named by
- // the Settings.NameValueTable.VALUE static.
- final String newValue = (args == null)
- ? null : args.getString(Settings.NameValueTable.VALUE);
-
- final ContentValues values = new ContentValues();
- values.put(Settings.NameValueTable.NAME, request);
- values.put(Settings.NameValueTable.VALUE, newValue);
- if (Settings.CALL_METHOD_PUT_SYSTEM.equals(method)) {
- if (LOCAL_LOGV) Slog.v(TAG, "call_put(system:" + request + "=" + newValue + ") for " + callingUser);
- insertForUser(Settings.System.CONTENT_URI, values, callingUser);
- } else if (Settings.CALL_METHOD_PUT_SECURE.equals(method)) {
- if (LOCAL_LOGV) Slog.v(TAG, "call_put(secure:" + request + "=" + newValue + ") for " + callingUser);
- insertForUser(Settings.Secure.CONTENT_URI, values, callingUser);
- } else if (Settings.CALL_METHOD_PUT_GLOBAL.equals(method)) {
- if (LOCAL_LOGV) Slog.v(TAG, "call_put(global:" + request + "=" + newValue + ") for " + callingUser);
- insertForUser(Settings.Global.CONTENT_URI, values, callingUser);
- } else {
- Slog.w(TAG, "call() with invalid method: " + method);
+ // Put methods - new value is in the args bundle under the key named by
+ // the Settings.NameValueTable.VALUE static.
+ final String newValue = (args == null)
+ ? null : args.getString(Settings.NameValueTable.VALUE);
+
+ final ContentValues values = new ContentValues();
+ values.put(Settings.NameValueTable.NAME, request);
+ values.put(Settings.NameValueTable.VALUE, newValue);
+ if (Settings.CALL_METHOD_PUT_SYSTEM.equals(method)) {
+ if (LOCAL_LOGV) Slog.v(TAG, "call_put(system:" + request + "=" + newValue + ") for " + callingUser);
+ insertForUser(Settings.System.CONTENT_URI, values, callingUser);
+ } else if (Settings.CALL_METHOD_PUT_SECURE.equals(method)) {
+ if (LOCAL_LOGV) Slog.v(TAG, "call_put(secure:" + request + "=" + newValue + ") for " + callingUser);
+ insertForUser(Settings.Secure.CONTENT_URI, values, callingUser);
+ } else if (Settings.CALL_METHOD_PUT_GLOBAL.equals(method)) {
+ if (LOCAL_LOGV) Slog.v(TAG, "call_put(global:" + request + "=" + newValue + ") for " + callingUser);
+ insertForUser(Settings.Global.CONTENT_URI, values, callingUser);
+ } else {
+ Slog.w(TAG, "call() with invalid method: " + method);
+ }
+ } finally {
+ Binder.restoreCallingIdentity(oldId);
}
return null;
@@ -758,7 +760,7 @@ public class SettingsProvider extends ContentProvider {
return queryForUser(url, select, where, whereArgs, sort, UserHandle.getCallingUserId());
}
- public Cursor queryForUser(Uri url, String[] select, String where, String[] whereArgs,
+ private Cursor queryForUser(Uri url, String[] select, String where, String[] whereArgs,
String sort, int forUser) {
if (LOCAL_LOGV) Slog.v(TAG, "query(" + url + ") for user " + forUser);
SqlArguments args = new SqlArguments(url, where, whereArgs);
diff --git a/packages/SystemUI/res/layout/quick_settings_tile_bugreport.xml b/packages/SystemUI/res/layout/quick_settings_tile_bugreport.xml
new file mode 100644
index 0000000..0b6a614
--- /dev/null
+++ b/packages/SystemUI/res/layout/quick_settings_tile_bugreport.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 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.
+-->
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/TextAppearance.QuickSettings.TileView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:drawableTop="@*android:drawable/stat_sys_adb"
+ android:text="@*android:string/bugreport_title"
+ />
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 4545706..e05c9a5 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -401,6 +401,9 @@
<!-- Name of the launcher shortcut icon that allows dreams to be started immediately [CHAR LIMIT=20] -->
<string name="start_dreams">Start dreams</string>
+ <!-- Textual description of Ethernet connections -->
+ <string name="ethernet_label">Ethernet</string>
+
<!-- QuickSettings: Airplane mode [CHAR LIMIT=NONE] -->
<string name="quick_settings_airplane_mode_label">Airplane mode</string>
<!-- QuickSettings: Battery Charging [CHAR LIMIT=NONE] -->
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
index 9c3756c..291f38c 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
@@ -94,6 +94,9 @@ public class RecentsActivity extends Activity {
@Override
public void onResume() {
mForeground = true;
+ if (mRecentsPanel != null) {
+ mRecentsPanel.refreshViews();
+ }
super.onResume();
}
@@ -186,4 +189,7 @@ public class RecentsActivity extends Activity {
}
}
+ boolean isForeground() {
+ return mForeground;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 04e38a4..0caa671 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -24,7 +24,6 @@ import android.app.ActivityOptions;
import android.app.TaskStackBuilder;
import android.content.Context;
import android.content.Intent;
-import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
@@ -67,7 +66,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
StatusBarPanel, Animator.AnimatorListener {
static final String TAG = "RecentsPanelView";
static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false;
- private Context mContext;
private PopupMenu mPopup;
private View mRecentsScrim;
private View mRecentsNoApps;
@@ -203,7 +201,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
public RecentsPanelView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
- mContext = context;
updateValuesFromResources();
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RecentsPanelView,
@@ -374,7 +371,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
protected void onFinishInflate() {
super.onFinishInflate();
- mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mRecentsContainer = (ViewGroup) findViewById(R.id.recents_container);
mStatusBarTouchProxy = (StatusBarTouchProxy) findViewById(R.id.status_bar_touch_proxy);
mListAdapter = new TaskDescriptionAdapter(mContext);
@@ -488,7 +484,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
}
}
- }
+ }
showIfReady();
}
@@ -508,6 +504,12 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
}
+ public void refreshViews() {
+ mListAdapter.notifyDataSetInvalidated();
+ updateUiElements();
+ showIfReady();
+ }
+
public void refreshRecentTasksList() {
refreshRecentTasksList(null, false);
}
@@ -530,12 +532,12 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
} else {
mRecentTaskDescriptions.addAll(tasks);
}
- mListAdapter.notifyDataSetInvalidated();
- updateUiElements(getResources().getConfiguration());
- showIfReady();
+ if (((RecentsActivity)mContext).isForeground()) {
+ refreshViews();
+ }
}
- private void updateUiElements(Configuration config) {
+ private void updateUiElements() {
final int items = mRecentTaskDescriptions.size();
mRecentsContainer.setVisibility(items > 0 ? View.VISIBLE : View.GONE);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 923cd93..ecb8fed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -84,8 +84,8 @@ import java.util.ArrayList;
public abstract class BaseStatusBar extends SystemUI implements
CommandQueue.Callbacks {
- static final String TAG = "StatusBar";
- private static final boolean DEBUG = false;
+ public static final String TAG = "StatusBar";
+ public static final boolean DEBUG = false;
public static final boolean MULTIUSER_DEBUG = false;
protected static final int MSG_TOGGLE_RECENTS_PANEL = 1020;
@@ -162,6 +162,9 @@ public abstract class BaseStatusBar extends SystemUI implements
private RemoteViews.OnClickHandler mOnClickHandler = new RemoteViews.OnClickHandler() {
@Override
public boolean onClickHandler(View view, PendingIntent pendingIntent, Intent fillInIntent) {
+ if (DEBUG) {
+ Slog.v(TAG, "Notification click handler invoked for intent: " + pendingIntent);
+ }
final boolean isActivity = pendingIntent.isActivity();
if (isActivity) {
try {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
index bffb903..9a3648f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
@@ -10,22 +10,23 @@ import android.widget.FrameLayout;
public class PanelBar extends FrameLayout {
public static final boolean DEBUG = false;
- public static final String TAG = PanelView.class.getSimpleName();
+ public static final String TAG = PanelBar.class.getSimpleName();
public static final void LOG(String fmt, Object... args) {
if (!DEBUG) return;
Slog.v(TAG, String.format(fmt, args));
}
+ public static final int STATE_CLOSED = 0;
+ public static final int STATE_OPENING = 1;
+ public static final int STATE_OPEN = 2;
+
private PanelHolder mPanelHolder;
private ArrayList<PanelView> mPanels = new ArrayList<PanelView>();
protected PanelView mTouchingPanel;
- private static final int STATE_CLOSED = 0;
- private static final int STATE_TRANSITIONING = 1;
- private static final int STATE_OPEN = 2;
private int mState = STATE_CLOSED;
private boolean mTracking;
- private void go(int state) {
+ public void go(int state) {
LOG("go state: %d -> %d", mState, state);
mState = state;
}
@@ -80,18 +81,21 @@ public class PanelBar extends FrameLayout {
// figure out which panel needs to be talked to here
if (event.getAction() == MotionEvent.ACTION_DOWN) {
- mTouchingPanel = selectPanelForTouchX(event.getX());
- mPanelHolder.setSelectedPanel(mTouchingPanel);
- LOG("PanelBar.onTouch: state=%d ACTION_DOWN: panel %s", mState, mTouchingPanel.getName());
- if (mState == STATE_CLOSED || mState == STATE_OPEN) {
- go(STATE_TRANSITIONING);
- onPanelPeeked();
- }
+ final PanelView panel = selectPanelForTouchX(event.getX());
+ LOG("PanelBar.onTouch: state=%d ACTION_DOWN: panel %s", mState, panel);
+ startOpeningPanel(panel);
}
final boolean result = mTouchingPanel.getHandle().dispatchTouchEvent(event);
return result;
}
+ // called from PanelView when self-expanding, too
+ public void startOpeningPanel(PanelView panel) {
+ LOG("startOpeningPanel: " + panel);
+ mTouchingPanel = panel;
+ mPanelHolder.setSelectedPanel(mTouchingPanel);
+ }
+
public void panelExpansionChanged(PanelView panel, float frac) {
boolean fullyClosed = true;
PanelView fullyOpenedPanel = null;
@@ -99,6 +103,10 @@ public class PanelBar extends FrameLayout {
for (PanelView pv : mPanels) {
// adjust any other panels that may be partially visible
if (pv.getExpandedHeight() > 0f) {
+ if (mState == STATE_CLOSED) {
+ go(STATE_OPENING);
+ onPanelPeeked();
+ }
fullyClosed = false;
final float thisFrac = pv.getExpandedFraction();
LOG("panelExpansionChanged: -> %s: f=%.1f", pv.getName(), thisFrac);
@@ -112,7 +120,7 @@ public class PanelBar extends FrameLayout {
if (fullyOpenedPanel != null && !mTracking) {
go(STATE_OPEN);
onPanelFullyOpened(fullyOpenedPanel);
- } else if (fullyClosed && !mTracking) {
+ } else if (fullyClosed && !mTracking && mState != STATE_CLOSED) {
go(STATE_CLOSED);
onAllPanelsCollapsed();
}
@@ -122,13 +130,21 @@ public class PanelBar extends FrameLayout {
}
public void collapseAllPanels(boolean animate) {
+ boolean waiting = false;
for (PanelView pv : mPanels) {
- if (animate && pv == mTouchingPanel) {
- mTouchingPanel.collapse();
+ if (animate && !pv.isFullyCollapsed()) {
+ pv.collapse();
+ waiting = true;
} else {
pv.setExpandedFraction(0); // just in case
}
}
+ if (!waiting) {
+ // it's possible that nothing animated, so we replicate the termination
+ // conditions of panelExpansionChanged here
+ go(STATE_CLOSED);
+ onAllPanelsCollapsed();
+ }
}
public void onPanelPeeked() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 1c244d4..a4a3a6a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -9,6 +9,7 @@ import android.util.Slog;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.android.systemui.R;
@@ -18,7 +19,7 @@ import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NetworkController;
public class PanelView extends FrameLayout {
- public static final boolean DEBUG = false;
+ public static final boolean DEBUG = PanelBar.DEBUG;
public static final String TAG = PanelView.class.getSimpleName();
public final void LOG(String fmt, Object... args) {
if (!DEBUG) return;
@@ -298,10 +299,16 @@ public class PanelView extends FrameLayout {
LOG("onMeasure(%d, %d) -> (%d, %d)",
widthMeasureSpec, heightMeasureSpec, getMeasuredWidth(), getMeasuredHeight());
- mFullHeight = getMeasuredHeight();
- // if one of our children is getting smaller, we should track that
- if (!mTracking && !mRubberbanding && !mTimeAnimator.isStarted() && mExpandedHeight > 0 && mExpandedHeight != mFullHeight) {
- mExpandedHeight = mFullHeight;
+
+ // Did one of our children change size?
+ int newHeight = getMeasuredHeight();
+ if (newHeight != mFullHeight) {
+ mFullHeight = newHeight;
+ // If the user isn't actively poking us, let's rubberband to the content
+ if (!mTracking && !mRubberbanding && !mTimeAnimator.isStarted()
+ && mExpandedHeight > 0 && mExpandedHeight != mFullHeight) {
+ mExpandedHeight = mFullHeight;
+ }
}
heightMeasureSpec = MeasureSpec.makeMeasureSpec(
(int) mExpandedHeight, MeasureSpec.AT_MOST); // MeasureSpec.getMode(heightMeasureSpec));
@@ -310,6 +317,7 @@ public class PanelView extends FrameLayout {
public void setExpandedHeight(float height) {
+ mTracking = mRubberbanding = false;
post(mStopAnimator);
setExpandedHeightInternal(height);
}
@@ -326,21 +334,26 @@ public class PanelView extends FrameLayout {
// Hmm, full height hasn't been computed yet
}
- LOG("setExpansion: height=%.1f fh=%.1f tracking=%s rubber=%s", h, fh, mTracking?"T":"f", mRubberbanding?"T":"f");
-
if (h < 0) h = 0;
if (!(STRETCH_PAST_CONTENTS && (mTracking || mRubberbanding)) && h > fh) h = fh;
mExpandedHeight = h;
+ LOG("setExpansion: height=%.1f fh=%.1f tracking=%s rubber=%s", h, fh, mTracking?"T":"f", mRubberbanding?"T":"f");
+
requestLayout();
// FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
// lp.height = (int) mExpandedHeight;
// setLayoutParams(lp);
- mExpandedFraction = Math.min(1f, h / fh);
+ mExpandedFraction = Math.min(1f, (fh == 0) ? 0 : h / fh);
}
private float getFullHeight() {
+ if (mFullHeight <= 0) {
+ LOG("Forcing measure() since fullHeight=" + mFullHeight);
+ measure(MeasureSpec.makeMeasureSpec(LayoutParams.WRAP_CONTENT, MeasureSpec.EXACTLY),
+ MeasureSpec.makeMeasureSpec(LayoutParams.WRAP_CONTENT, MeasureSpec.EXACTLY));
+ }
return mFullHeight;
}
@@ -385,8 +398,12 @@ public class PanelView extends FrameLayout {
}
public void expand() {
- if (!isFullyExpanded()) {
+ if (isFullyCollapsed()) {
+ mBar.startOpeningPanel(this);
+ LOG("expand: calling fling(%s, true)", mSelfExpandVelocityPx);
fling (mSelfExpandVelocityPx, /*always=*/ true);
+ } else if (DEBUG) {
+ LOG("skipping expansion: is expanded");
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 8f6a903..c55da5d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -95,7 +95,7 @@ import java.util.ArrayList;
public class PhoneStatusBar extends BaseStatusBar {
static final String TAG = "PhoneStatusBar";
- public static final boolean DEBUG = false;
+ public static final boolean DEBUG = BaseStatusBar.DEBUG;
public static final boolean SPEW = DEBUG;
public static final boolean DUMPTRUCK = true; // extra dumpsys info
@@ -285,9 +285,6 @@ public class PhoneStatusBar extends BaseStatusBar {
mStatusBarWindow = (StatusBarWindowView) View.inflate(context,
R.layout.super_status_bar, null);
- if (DEBUG) {
- mStatusBarWindow.setBackgroundColor(0x6000FF80);
- }
mStatusBarWindow.mService = this;
mStatusBarWindow.setOnTouchListener(new View.OnTouchListener() {
@Override
@@ -1160,7 +1157,7 @@ public class PhoneStatusBar extends BaseStatusBar {
public void animateCollapse(int flags) {
if (SPEW) {
- Slog.d(TAG, "animateCollapse(): "
+ Slog.d(TAG, "animateCollapse():"
+ " mExpandedVisible=" + mExpandedVisible
+ " mAnimating=" + mAnimating
+ " mAnimatingReveal=" + mAnimatingReveal
@@ -1203,7 +1200,7 @@ public class PhoneStatusBar extends BaseStatusBar {
}
// Ensure the panel is fully collapsed (just in case; bug 6765842)
- mStatusBarView.collapseAllPanels(/*animate=*/ false);
+ // @@@ mStatusBarView.collapseAllPanels(/*animate=*/ false);
mExpandedVisible = false;
mPile.setLayoutTransitionsEnabled(false);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index 8fe525c..95b618a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -27,6 +27,7 @@ import android.graphics.Rect;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Log;
+import android.util.Slog;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@@ -41,6 +42,8 @@ import com.android.systemui.statusbar.policy.FixedSizeDrawable;
public class PhoneStatusBarView extends PanelBar {
private static final String TAG = "PhoneStatusBarView";
+ private static final boolean DEBUG = PhoneStatusBar.DEBUG;
+
PhoneStatusBar mBar;
int mScrimColor;
float mMinFlingGutter;
@@ -152,6 +155,10 @@ public class PhoneStatusBarView extends PanelBar {
public void panelExpansionChanged(PanelView pv, float frac) {
super.panelExpansionChanged(pv, frac);
+ if (DEBUG) {
+ Slog.v(TAG, "panelExpansionChanged: f=" + frac);
+ }
+
if (mFadingPanel == pv
&& mScrimColor != 0 && ActivityManager.isHighEndGfx()) {
// woo, special effects
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 1b28045..cbacb28 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
@@ -16,14 +16,17 @@
package com.android.systemui.statusbar.phone;
+import android.app.AlertDialog;
import android.app.Dialog;
import android.app.PendingIntent;
+import android.app.AlertDialog.Builder;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.CursorLoader;
import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.Loader;
@@ -37,6 +40,7 @@ import android.hardware.display.WifiDisplay;
import android.hardware.display.WifiDisplayStatus;
import android.net.Uri;
import android.os.Debug;
+import android.os.SystemProperties;
import android.provider.ContactsContract;
import android.provider.Settings;
import android.view.LayoutInflater;
@@ -521,6 +525,24 @@ class QuickSettings {
});
parent.addView(imeTile);
+ // Bug reports
+ QuickSettingsTileView bugreportTile = (QuickSettingsTileView)
+ inflater.inflate(R.layout.quick_settings_tile, parent, false);
+ bugreportTile.setContent(R.layout.quick_settings_tile_bugreport, inflater);
+ bugreportTile.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mBar.collapseAllPanels(true);
+ showBugreportDialog();
+ }
+ });
+ mModel.addBugreportTile(bugreportTile, new QuickSettingsModel.RefreshCallback() {
+ @Override
+ public void refreshView(QuickSettingsTileView view, State state) {
+ view.setVisibility(state.enabled ? View.VISIBLE : View.GONE);
+ }
+ });
+ parent.addView(bugreportTile);
/*
QuickSettingsTileView mediaTile = (QuickSettingsTileView)
inflater.inflate(R.layout.quick_settings_tile, parent, false);
@@ -575,6 +597,24 @@ class QuickSettings {
}
}
+ private void showBugreportDialog() {
+ final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
+ builder.setPositiveButton(com.android.internal.R.string.report, new OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ SystemProperties.set("ctl.start", "bugreport");
+ }
+ }
+ });
+ builder.setMessage(com.android.internal.R.string.bugreport_message);
+ builder.setTitle(com.android.internal.R.string.bugreport_title);
+ builder.setCancelable(true);
+ final Dialog dialog = builder.create();
+ dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
+ dialog.show();
+ }
+
private void updateWifiDisplayStatus() {
mWifiDisplayStatus = mDisplayManager.getWifiDisplayStatus();
applyWifiDisplayStatus();
@@ -595,4 +635,4 @@ class QuickSettings {
}
}
};
-} \ No newline at end of file
+}
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 724df34..bb89b3d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
@@ -30,6 +30,7 @@ import android.graphics.drawable.Drawable;
import android.hardware.display.WifiDisplayStatus;
import android.os.Handler;
import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.InputMethodInfo;
@@ -107,9 +108,26 @@ class QuickSettingsModel implements BluetoothStateChangeCallback,
}
}
+ /** ContentObserver to watch adb */
+ private class BugreportObserver extends ContentObserver {
+ public BugreportObserver(Handler handler) {
+ super(handler);
+ }
+
+ @Override public void onChange(boolean selfChange) {
+ onBugreportChanged();
+ }
+
+ public void startObserving() {
+ final ContentResolver cr = mContext.getContentResolver();
+ cr.registerContentObserver(
+ Settings.Secure.getUriFor(Settings.Secure.BUGREPORT_IN_POWER_MENU), false, this);
+ }
+ }
private Context mContext;
private Handler mHandler;
private NextAlarmObserver mNextAlarmObserver;
+ private BugreportObserver mBugreportObserver;
private QuickSettingsTileView mUserTile;
private RefreshCallback mUserCallback;
@@ -159,11 +177,17 @@ class QuickSettingsModel implements BluetoothStateChangeCallback,
private RefreshCallback mBrightnessCallback;
private BrightnessState mBrightnessState = new BrightnessState();
+ private QuickSettingsTileView mBugreportTile;
+ private RefreshCallback mBugreportCallback;
+ private State mBugreportState = new State();
+
public QuickSettingsModel(Context context) {
mContext = context;
mHandler = new Handler();
mNextAlarmObserver = new NextAlarmObserver(mHandler);
mNextAlarmObserver.startObserving();
+ mBugreportObserver = new BugreportObserver(mHandler);
+ mBugreportObserver.startObserving();
IntentFilter alarmIntentFilter = new IntentFilter();
alarmIntentFilter.addAction(Intent.ACTION_ALARM_CHANGED);
@@ -341,6 +365,25 @@ class QuickSettingsModel implements BluetoothStateChangeCallback,
mLocationCallback.refreshView(mLocationTile, mLocationState);
}
+ // Bug report
+ void addBugreportTile(QuickSettingsTileView view, RefreshCallback cb) {
+ mBugreportTile = view;
+ mBugreportCallback = cb;
+ onBugreportChanged();
+ }
+ // SettingsObserver callback
+ public void onBugreportChanged() {
+ final ContentResolver cr = mContext.getContentResolver();
+ boolean enabled = false;
+ try {
+ enabled = (Settings.Secure.getInt(cr, Settings.Secure.BUGREPORT_IN_POWER_MENU) != 0);
+ } catch (SettingNotFoundException e) {
+ }
+
+ mBugreportState.enabled = enabled;
+ mBugreportCallback.refreshView(mBugreportTile, mBugreportState);
+ }
+
// Wifi Display
void addWifiDisplayTile(QuickSettingsTileView view, RefreshCallback cb) {
mWifiDisplayTile = view;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index e0b7fe6..f83517b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -17,6 +17,8 @@
package com.android.systemui.statusbar.phone;
import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.Log;
import android.view.KeyEvent;
@@ -28,12 +30,14 @@ import android.widget.TextSwitcher;
import com.android.systemui.ExpandHelper;
import com.android.systemui.R;
+import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.policy.NotificationRowLayout;
public class StatusBarWindowView extends FrameLayout
{
- private static final String TAG = "StatusBarWindowView";
+ public static final String TAG = "StatusBarWindowView";
+ public static final boolean DEBUG = BaseStatusBar.DEBUG;
private ExpandHelper mExpandHelper;
private NotificationRowLayout latestItems;
@@ -44,6 +48,7 @@ public class StatusBarWindowView extends FrameLayout
public StatusBarWindowView(Context context, AttributeSet attrs) {
super(context, attrs);
setMotionEventSplittingEnabled(false);
+ setWillNotDraw(!DEBUG);
}
@Override
@@ -101,5 +106,17 @@ public class StatusBarWindowView extends FrameLayout
}
return handled;
}
+
+ @Override
+ public void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ if (DEBUG) {
+ Paint pt = new Paint();
+ pt.setColor(0x80FFFF00);
+ pt.setStrokeWidth(12.0f);
+ pt.setStyle(Paint.Style.STROKE);
+ canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), pt);
+ }
+ }
}
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 ee82777..463aacb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -1097,8 +1097,7 @@ public class NetworkController extends BroadcastReceiver {
final boolean ethernetConnected = (mConnectedNetworkType == ConnectivityManager.TYPE_ETHERNET);
if (ethernetConnected) {
- // TODO: icons and strings for Ethernet connectivity
- combinedLabel = mConnectedNetworkTypeName;
+ combinedLabel = context.getString(R.string.ethernet_label);
}
if (mAirplaneMode &&