summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java2
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java13
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java4
-rw-r--r--packages/SystemUI/res/layout-sw600dp/navigation_bar.xml4
-rw-r--r--packages/SystemUI/res/layout/navigation_bar.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java41
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java54
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java10
17 files changed, 155 insertions, 70 deletions
diff --git a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
index cf56cba..731a09c 100644
--- a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
+++ b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
@@ -80,7 +80,7 @@ import libcore.io.StructStatFs;
*/
public class DefaultContainerService extends IntentService {
private static final String TAG = "DefContainer";
- private static final boolean localLOGV = true;
+ private static final boolean localLOGV = false;
private static final String LIB_DIR_NAME = "lib";
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index b649b43..4e5fc37 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -21,6 +21,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
+import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.res.XmlResourceParser;
import android.database.Cursor;
@@ -31,6 +32,8 @@ import android.media.AudioManager;
import android.media.AudioService;
import android.net.ConnectivityManager;
import android.os.Environment;
+import android.os.RemoteException;
+import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
@@ -171,7 +174,15 @@ public class DatabaseHelper extends SQLiteOpenHelper {
db.execSQL("CREATE INDEX bookmarksIndex2 ON bookmarks (shortcut);");
// Populate bookmarks table with initial bookmarks
- loadBookmarks(db);
+ boolean onlyCore = false;
+ try {
+ onlyCore = IPackageManager.Stub.asInterface(ServiceManager.getService(
+ "package")).isOnlyCoreApps();
+ } catch (RemoteException e) {
+ }
+ if (!onlyCore) {
+ loadBookmarks(db);
+ }
// Load initial volume levels into DB
loadVolumeLevels(db);
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 8086bbc..f18338a 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -455,8 +455,8 @@ public class SettingsProvider extends ContentProvider {
cache.setFullyMatchesDisk(false);
Log.d(TAG, "row count exceeds max cache entries for table " + table);
}
- Log.d(TAG, "cache for settings table '" + table + "' rows=" + rows + "; fullycached=" +
- cache.fullyMatchesDisk());
+ if (LOCAL_LOGV) Log.d(TAG, "cache for settings table '" + table
+ + "' rows=" + rows + "; fullycached=" + cache.fullyMatchesDisk());
}
} finally {
c.close();
diff --git a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
index 2669c7e..b1104cc 100644
--- a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
+++ b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
@@ -141,7 +141,7 @@
/>
</LinearLayout>
- <ImageView
+ <com.android.systemui.statusbar.policy.KeyButtonView
android:layout_width="128dp"
android:id="@+id/search_light"
android:layout_height="match_parent"
@@ -282,7 +282,7 @@
/>
</LinearLayout>
- <ImageView
+ <com.android.systemui.statusbar.policy.KeyButtonView
android:layout_width="162dp"
android:id="@+id/search_light"
android:layout_height="match_parent"
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index 440a4e1..da52d89 100644
--- a/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/packages/SystemUI/res/layout/navigation_bar.xml
@@ -145,7 +145,7 @@
/>
</LinearLayout>
- <ImageView
+ <com.android.systemui.statusbar.policy.KeyButtonView
android:layout_width="80dp"
android:id="@+id/search_light"
android:layout_height="match_parent"
@@ -289,7 +289,7 @@
/>
</LinearLayout>
- <ImageView
+ <com.android.systemui.statusbar.policy.KeyButtonView
android:id="@+id/search_light"
android:layout_height="80dp"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
index 4338fa0..9281c75 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
@@ -138,6 +138,10 @@ public class RecentTasksLoader implements View.OnTouchListener {
return mLoadedTasks;
}
+ public void remove(TaskDescription td) {
+ mLoadedTasks.remove(td);
+ }
+
public boolean isFirstScreenful() {
return mFirstScreenful;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 6cb7dec..3330301 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -336,19 +336,6 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
});
}
- @Override
- protected void onVisibilityChanged(View changedView, int visibility) {
- super.onVisibilityChanged(changedView, visibility);
- // scroll to bottom after reloading
- if (visibility == View.VISIBLE && changedView == this) {
- post(new Runnable() {
- public void run() {
- update();
- }
- });
- }
- }
-
public void setAdapter(TaskDescriptionAdapter adapter) {
mAdapter = adapter;
mAdapter.registerDataSetObserver(new DataSetObserver() {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index cd3bc42..9a1e38d 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -77,9 +77,10 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
private boolean mShowing;
private boolean mWaitingToShow;
- private int mNumItemsWaitingForThumbnailsAndIcons;
private ViewHolder mItemToAnimateInWhenWindowAnimationIsFinished;
+ private boolean mAnimateIconOfFirstTask;
private boolean mWaitingForWindowAnimation;
+ private long mWindowAnimationStartTime;
private RecentTasksLoader mRecentTasksLoader;
private ArrayList<TaskDescription> mRecentTaskDescriptions;
@@ -174,10 +175,9 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
if (td.isLoaded()) {
updateThumbnail(holder, td.getThumbnail(), true, false);
updateIcon(holder, td.getIcon(), true, false);
- mNumItemsWaitingForThumbnailsAndIcons--;
}
if (index == 0) {
- if (mWaitingForWindowAnimation) {
+ if (mAnimateIconOfFirstTask) {
if (mItemToAnimateInWhenWindowAnimationIsFinished != null) {
holder.iconView.setAlpha(1f);
holder.iconView.setTranslationX(0f);
@@ -206,6 +206,9 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
holder.iconView.setAlpha(0f);
holder.iconView.setTranslationY(translation);
}
+ if (!mWaitingForWindowAnimation) {
+ animateInIconOfFirstTask();
+ }
}
}
@@ -220,7 +223,9 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
updateThumbnail(holder, mRecentTasksLoader.getDefaultThumbnail(), false, false);
holder.iconView.setImageBitmap(mRecentTasksLoader.getDefaultIcon());
holder.iconView.setVisibility(INVISIBLE);
+ holder.iconView.animate().cancel();
holder.labelView.setText(null);
+ holder.labelView.animate().cancel();
holder.thumbnailView.setContentDescription(null);
holder.thumbnailView.setTag(null);
holder.thumbnailView.setOnLongClickListener(null);
@@ -235,6 +240,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
holder.calloutLine.setAlpha(1f);
holder.calloutLine.setTranslationX(0f);
holder.calloutLine.setTranslationY(0f);
+ holder.calloutLine.animate().cancel();
}
holder.taskDescription = null;
holder.loadedThumbnailAndIcon = false;
@@ -291,8 +297,9 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
public void show(boolean show, ArrayList<TaskDescription> recentTaskDescriptions,
- boolean firstScreenful, boolean waitingForWindowAnimation) {
- mWaitingForWindowAnimation = waitingForWindowAnimation;
+ boolean firstScreenful, boolean animateIconOfFirstTask) {
+ mAnimateIconOfFirstTask = animateIconOfFirstTask;
+ mWaitingForWindowAnimation = animateIconOfFirstTask;
if (show) {
mWaitingToShow = true;
refreshRecentTasksList(recentTaskDescriptions, firstScreenful);
@@ -527,7 +534,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
updateIcon(h, td.getIcon(), true, animateShow);
updateThumbnail(h, td.getThumbnail(), true, animateShow);
h.loadedThumbnailAndIcon = true;
- mNumItemsWaitingForThumbnailsAndIcons--;
}
}
}
@@ -536,9 +542,14 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
showIfReady();
}
- public void onWindowAnimationStart() {
- if (mItemToAnimateInWhenWindowAnimationIsFinished != null) {
- final int startDelay = 150;
+ private void animateInIconOfFirstTask() {
+ if (mItemToAnimateInWhenWindowAnimationIsFinished != null &&
+ !mRecentTasksLoader.isFirstScreenful()) {
+ int timeSinceWindowAnimation =
+ (int) (System.currentTimeMillis() - mWindowAnimationStartTime);
+ final int minStartDelay = 150;
+ final int startDelay = Math.max(0, Math.min(
+ minStartDelay - timeSinceWindowAnimation, minStartDelay));
final int duration = 250;
final ViewHolder holder = mItemToAnimateInWhenWindowAnimationIsFinished;
final TimeInterpolator cubic = new DecelerateInterpolator(1.5f);
@@ -550,10 +561,16 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
}
mItemToAnimateInWhenWindowAnimationIsFinished = null;
- mWaitingForWindowAnimation = false;
+ mAnimateIconOfFirstTask = false;
}
}
+ public void onWindowAnimationStart() {
+ mWaitingForWindowAnimation = false;
+ mWindowAnimationStartTime = System.currentTimeMillis();
+ animateInIconOfFirstTask();
+ }
+
public void clearRecentTasksList() {
// Clear memory used by screenshots
if (mRecentTaskDescriptions != null) {
@@ -590,9 +607,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
public void onTasksLoaded(ArrayList<TaskDescription> tasks, boolean firstScreenful) {
- mNumItemsWaitingForThumbnailsAndIcons = firstScreenful
- ? tasks.size() : mRecentTaskDescriptions == null
- ? 0 : mRecentTaskDescriptions.size();
if (mRecentTaskDescriptions == null) {
mRecentTaskDescriptions = new ArrayList<TaskDescription>(tasks);
} else {
@@ -689,6 +703,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
if (DEBUG) Log.v(TAG, "Jettison " + ad.getLabel());
mRecentTaskDescriptions.remove(ad);
+ mRecentTasksLoader.remove(ad);
// Handled by widget containers to enable LayoutTransitions properly
// mListAdapter.notifyDataSetChanged();
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 47b0113..b3adbaf 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -345,19 +345,6 @@ public class RecentsVerticalScrollView extends ScrollView
});
}
- @Override
- protected void onVisibilityChanged(View changedView, int visibility) {
- super.onVisibilityChanged(changedView, visibility);
- // scroll to bottom after reloading
- if (visibility == View.VISIBLE && changedView == this) {
- post(new Runnable() {
- public void run() {
- update();
- }
- });
- }
- }
-
public void setAdapter(TaskDescriptionAdapter adapter) {
mAdapter = adapter;
mAdapter.registerDataSetObserver(new DataSetObserver() {
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 248a516..2bad353 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -31,7 +31,7 @@ import com.android.systemui.statusbar.GestureRecorder;
public class NotificationPanelView extends PanelView {
Drawable mHandleBar;
- float mHandleBarHeight;
+ int mHandleBarHeight;
View mHandleView;
int mFingers;
PhoneStatusBar mStatusBar;
@@ -51,7 +51,7 @@ public class NotificationPanelView extends PanelView {
Resources resources = getContext().getResources();
mHandleBar = resources.getDrawable(R.drawable.status_bar_close);
- mHandleBarHeight = resources.getDimension(R.dimen.close_handle_height);
+ mHandleBarHeight = resources.getDimensionPixelSize(R.dimen.close_handle_height);
mHandleView = findViewById(R.id.handle);
setContentDescription(resources.getString(R.string.accessibility_desc_notification_shade));
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 7371ce2..30af333 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -298,7 +298,7 @@ public class PhoneStatusBar extends BaseStatusBar {
if (MULTIUSER_DEBUG) Slog.d(TAG, String.format("User setup changed: " +
"selfChange=%s userSetup=%s mUserSetup=%s",
selfChange, userSetup, mUserSetup));
- if (mSettingsButton != null && !mHasSettingsPanel) {
+ if (mSettingsButton != null && mHasFlipSettings) {
mSettingsButton.setVisibility(userSetup ? View.VISIBLE : View.INVISIBLE);
}
if (mSettingsPanel != null) {
@@ -1488,6 +1488,9 @@ public class PhoneStatusBar extends BaseStatusBar {
return;
}
+ // Settings are not available in setup
+ if (!mUserSetup) return;
+
if (mHasFlipSettings) {
mNotificationPanel.expand();
if (mFlipSettingsView.getVisibility() != View.VISIBLE) {
@@ -1501,6 +1504,9 @@ public class PhoneStatusBar extends BaseStatusBar {
}
public void switchToSettings() {
+ // Settings are not available in setup
+ if (!mUserSetup) return;
+
mFlipSettingsView.setScaleX(1f);
mFlipSettingsView.setVisibility(View.VISIBLE);
mSettingsButton.setVisibility(View.GONE);
@@ -1512,6 +1518,9 @@ public class PhoneStatusBar extends BaseStatusBar {
}
public void flipToSettings() {
+ // Settings are not available in setup
+ if (!mUserSetup) return;
+
if (mFlipSettingsViewAnim != null) mFlipSettingsViewAnim.cancel();
if (mScrollViewAnim != null) mScrollViewAnim.cancel();
if (mSettingsButtonAnim != null) mSettingsButtonAnim.cancel();
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 cc9c601..9b0a320 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
@@ -55,6 +55,7 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.LevelListDrawable;
import android.hardware.display.DisplayManager;
import android.hardware.display.WifiDisplayStatus;
+import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.RemoteException;
@@ -85,6 +86,8 @@ class QuickSettings {
private static final String TAG = "QuickSettings";
public static final boolean SHOW_IME_TILE = false;
+ public static final boolean LONG_PRESS_TOGGLES = true;
+
private Context mContext;
private PanelBar mBar;
private QuickSettingsModel mModel;
@@ -94,6 +97,8 @@ class QuickSettings {
private WifiDisplayStatus mWifiDisplayStatus;
private PhoneStatusBar mStatusBarService;
private BluetoothState mBluetoothState;
+ private BluetoothAdapter mBluetoothAdapter;
+ private WifiManager mWifiManager;
private BrightnessController mBrightnessController;
private BluetoothController mBluetoothController;
@@ -131,6 +136,9 @@ class QuickSettings {
mModel = new QuickSettingsModel(context);
mWifiDisplayStatus = new WifiDisplayStatus();
mBluetoothState = new QuickSettingsModel.BluetoothState();
+ mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
+
mHandler = new Handler();
Resources r = mContext.getResources();
@@ -297,8 +305,7 @@ class QuickSettings {
(UserManager) mContext.getSystemService(Context.USER_SERVICE);
if (um.getUsers(true).size() > 1) {
try {
- WindowManagerGlobal.getWindowManagerService().lockNow(
- LockPatternUtils.USER_SWITCH_LOCK_OPTIONS);
+ WindowManagerGlobal.getWindowManagerService().lockNow(null);
} catch (RemoteException e) {
Log.e(TAG, "Couldn't show user switcher", e);
}
@@ -391,7 +398,7 @@ class QuickSettings {
private void addSystemTiles(ViewGroup parent, LayoutInflater inflater) {
// Wi-fi
- QuickSettingsTileView wifiTile = (QuickSettingsTileView)
+ 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() {
@@ -400,6 +407,30 @@ class QuickSettings {
startSettingsActivity(android.provider.Settings.ACTION_WIFI_SETTINGS);
}
});
+ if (LONG_PRESS_TOGGLES) {
+ wifiTile.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ final boolean enable =
+ (mWifiManager.getWifiState() != WifiManager.WIFI_STATE_ENABLED);
+ new AsyncTask<Void, Void, Void>() {
+ @Override
+ protected Void doInBackground(Void... args) {
+ // Disable tethering if enabling Wifi
+ final int wifiApState = mWifiManager.getWifiApState();
+ if (enable && ((wifiApState == WifiManager.WIFI_AP_STATE_ENABLING) ||
+ (wifiApState == WifiManager.WIFI_AP_STATE_ENABLED))) {
+ mWifiManager.setWifiApEnabled(null, false);
+ }
+
+ mWifiManager.setWifiEnabled(enable);
+ return null;
+ }
+ }.execute();
+ wifiTile.setPressed(false);
+ return true;
+ }} );
+ }
mModel.addWifiTile(wifiTile, new QuickSettingsModel.RefreshCallback() {
@Override
public void refreshView(QuickSettingsTileView view, State state) {
@@ -415,7 +446,7 @@ class QuickSettings {
});
parent.addView(wifiTile);
- if (mModel.deviceSupportsTelephony()) {
+ if (mModel.deviceHasMobileData()) {
// RSSI
QuickSettingsTileView rssiTile = (QuickSettingsTileView)
inflater.inflate(R.layout.quick_settings_tile, parent, false);
@@ -538,7 +569,7 @@ class QuickSettings {
// Bluetooth
if (mModel.deviceSupportsBluetooth()) {
- QuickSettingsTileView bluetoothTile = (QuickSettingsTileView)
+ final QuickSettingsTileView bluetoothTile = (QuickSettingsTileView)
inflater.inflate(R.layout.quick_settings_tile, parent, false);
bluetoothTile.setContent(R.layout.quick_settings_tile_bluetooth, inflater);
bluetoothTile.setOnClickListener(new View.OnClickListener() {
@@ -547,6 +578,19 @@ class QuickSettings {
startSettingsActivity(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS);
}
});
+ if (LONG_PRESS_TOGGLES) {
+ bluetoothTile.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ if (mBluetoothAdapter.isEnabled()) {
+ mBluetoothAdapter.disable();
+ } else {
+ mBluetoothAdapter.enable();
+ }
+ bluetoothTile.setPressed(false);
+ return true;
+ }});
+ }
mModel.addBluetoothTile(bluetoothTile, new QuickSettingsModel.RefreshCallback() {
@Override
public void refreshView(QuickSettingsTileView view, State state) {
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 4513dcb..ec42883 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
@@ -29,6 +29,7 @@ import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.drawable.Drawable;
import android.hardware.display.WifiDisplayStatus;
+import android.net.ConnectivityManager;
import android.os.Handler;
import android.os.UserHandle;
import android.provider.Settings;
@@ -171,6 +172,8 @@ class QuickSettingsModel implements BluetoothStateChangeCallback,
private final BugreportObserver mBugreportObserver;
private final BrightnessObserver mBrightnessObserver;
+ private final boolean mHasMobileData;
+
private QuickSettingsTileView mUserTile;
private RefreshCallback mUserCallback;
private UserState mUserState = new UserState();
@@ -249,6 +252,10 @@ class QuickSettingsModel implements BluetoothStateChangeCallback,
mBrightnessObserver = new BrightnessObserver(mHandler);
mBrightnessObserver.startObserving();
+ ConnectivityManager cm = (ConnectivityManager)
+ context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ mHasMobileData = cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
+
IntentFilter alarmIntentFilter = new IntentFilter();
alarmIntentFilter.addAction(Intent.ACTION_ALARM_CHANGED);
context.registerReceiver(mAlarmIntentReceiver, alarmIntentFilter);
@@ -403,22 +410,22 @@ class QuickSettingsModel implements BluetoothStateChangeCallback,
mWifiCallback.refreshView(mWifiTile, mWifiState);
}
+ boolean deviceHasMobileData() {
+ return mHasMobileData;
+ }
+
// RSSI
void addRSSITile(QuickSettingsTileView view, RefreshCallback cb) {
mRSSITile = view;
mRSSICallback = cb;
mRSSICallback.refreshView(mRSSITile, mRSSIState);
}
- boolean deviceSupportsTelephony() {
- PackageManager pm = mContext.getPackageManager();
- return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
- }
// NetworkSignalChanged callback
@Override
public void onMobileDataSignalChanged(
boolean enabled, int mobileSignalIconId, String signalContentDescription,
int dataTypeIconId, String dataContentDescription, String enabledDesc) {
- if (deviceSupportsTelephony()) {
+ if (deviceHasMobileData()) {
// TODO: If view is in awaiting state, disable
Resources r = mContext.getResources();
mRSSIState.signalIconId = enabled && (mobileSignalIconId > 0)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java
index a58eb22..bbb8455 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java
@@ -41,7 +41,7 @@ public class SettingsPanelView extends PanelView {
private QuickSettingsContainerView mQSContainer;
Drawable mHandleBar;
- float mHandleBarHeight;
+ int mHandleBarHeight;
View mHandleView;
public SettingsPanelView(Context context, AttributeSet attrs) {
@@ -56,7 +56,7 @@ public class SettingsPanelView extends PanelView {
Resources resources = getContext().getResources();
mHandleBar = resources.getDrawable(R.drawable.status_bar_close);
- mHandleBarHeight = resources.getDimension(R.dimen.close_handle_height);
+ mHandleBarHeight = resources.getDimensionPixelSize(R.dimen.close_handle_height);
mHandleView = findViewById(R.id.handle);
setContentDescription(resources.getString(R.string.accessibility_desc_quick_settings));
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
index 7f9bcac..716341f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
@@ -68,9 +68,20 @@ public class BatteryController extends BroadcastReceiver {
final String action = intent.getAction();
if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
final int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
- final boolean plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) != 0;
- final int icon = plugged ? R.drawable.stat_sys_battery_charge
+ final int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS,
+ BatteryManager.BATTERY_STATUS_UNKNOWN);
+
+ boolean plugged = false;
+ switch (status) {
+ case BatteryManager.BATTERY_STATUS_CHARGING:
+ case BatteryManager.BATTERY_STATUS_FULL:
+ plugged = true;
+ break;
+ }
+
+ final int icon = plugged ? R.drawable.stat_sys_battery_charge
: R.drawable.stat_sys_battery;
+
int N = mIconViews.size();
for (int i=0; i<N; i++) {
ImageView v = mIconViews.get(i);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
index ffc18c7..e41de47 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
@@ -40,19 +40,20 @@ import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.Calendar;
+import java.util.Locale;
import java.util.TimeZone;
import com.android.internal.R;
/**
- * This widget display an analogic clock with two hands for hours and
- * minutes.
+ * Digital clock for the status bar.
*/
public class Clock extends TextView {
private boolean mAttached;
private Calendar mCalendar;
private String mClockFormatString;
private SimpleDateFormat mClockFormat;
+ private Locale mLocale;
private static final int AM_PM_STYLE_NORMAL = 0;
private static final int AM_PM_STYLE_SMALL = 1;
@@ -84,6 +85,7 @@ public class Clock extends TextView {
filter.addAction(Intent.ACTION_TIME_CHANGED);
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
+ filter.addAction(Intent.ACTION_USER_SWITCHED);
getContext().registerReceiver(mIntentReceiver, filter, null, getHandler());
}
@@ -117,6 +119,12 @@ public class Clock extends TextView {
if (mClockFormat != null) {
mClockFormat.setTimeZone(mCalendar.getTimeZone());
}
+ } else if (action.equals(Intent.ACTION_CONFIGURATION_CHANGED)) {
+ final Locale newLocale = getResources().getConfiguration().locale;
+ if (! newLocale.equals(mLocale)) {
+ mLocale = newLocale;
+ mClockFormatString = ""; // force refresh
+ }
}
updateClock();
}
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index 91fc67a..06696fe 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -33,6 +33,7 @@ import android.util.Slog;
public class StorageNotification extends StorageEventListener {
private static final String TAG = "StorageNotification";
+ private static final boolean DEBUG = false;
private static final boolean POP_UMS_ACTIVITY_ON_CONNECT = true;
@@ -70,8 +71,8 @@ public class StorageNotification extends StorageEventListener {
mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
final boolean connected = mStorageManager.isUsbMassStorageConnected();
- Slog.d(TAG, String.format( "Startup with UMS connection %s (media state %s)", mUmsAvailable,
- Environment.getExternalStorageState()));
+ if (DEBUG) Slog.d(TAG, String.format( "Startup with UMS connection %s (media state %s)",
+ mUmsAvailable, Environment.getExternalStorageState()));
HandlerThread thr = new HandlerThread("SystemUI StorageNotification");
thr.start();
@@ -101,7 +102,8 @@ public class StorageNotification extends StorageEventListener {
*/
String st = Environment.getExternalStorageState();
- Slog.i(TAG, String.format("UMS connection changed to %s (media state %s)", connected, st));
+ if (DEBUG) Slog.i(TAG, String.format("UMS connection changed to %s (media state %s)",
+ connected, st));
if (connected && (st.equals(
Environment.MEDIA_REMOVED) || st.equals(Environment.MEDIA_CHECKING))) {
@@ -127,7 +129,7 @@ public class StorageNotification extends StorageEventListener {
}
private void onStorageStateChangedAsync(String path, String oldState, String newState) {
- Slog.i(TAG, String.format(
+ if (DEBUG) Slog.i(TAG, String.format(
"Media {%s} state changed from {%s} -> {%s}", path, oldState, newState));
if (newState.equals(Environment.MEDIA_SHARED)) {
/*