diff options
Diffstat (limited to 'packages/SystemUI/src')
7 files changed, 31 insertions, 10 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java index 330333a..cf5d3a6 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java @@ -23,7 +23,6 @@ import android.database.DataSetObserver; import android.graphics.Canvas; import android.util.AttributeSet; import android.util.DisplayMetrics; -import android.util.FloatMath; import android.util.Log; import android.view.MotionEvent; import android.view.View; @@ -368,7 +367,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView View child = mAdapter.createView(mLinearLayout); child.measure(childWidthMeasureSpec, childheightMeasureSpec); mNumItemsInOneScreenful = - (int) FloatMath.ceil(dm.widthPixels / (float) child.getMeasuredWidth()); + (int) Math.ceil(dm.widthPixels / (double) child.getMeasuredWidth()); addToRecycledViews(child); for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) { diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java index 1e247be..d518f74 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java @@ -23,7 +23,6 @@ import android.database.DataSetObserver; import android.graphics.Canvas; import android.util.AttributeSet; import android.util.DisplayMetrics; -import android.util.FloatMath; import android.util.Log; import android.view.MotionEvent; import android.view.View; @@ -378,7 +377,7 @@ public class RecentsVerticalScrollView extends ScrollView View child = mAdapter.createView(mLinearLayout); child.measure(childWidthMeasureSpec, childheightMeasureSpec); mNumItemsInOneScreenful = - (int) FloatMath.ceil(dm.heightPixels / (float) child.getMeasuredHeight()); + (int) Math.ceil(dm.heightPixels / (double) child.getMeasuredHeight()); addToRecycledViews(child); for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java index cbdd138..49693f5fe 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java @@ -37,7 +37,7 @@ public interface BluetoothController { void onBluetoothPairedDevicesChanged(); } - public static final class PairedDevice { + public static final class PairedDevice implements Comparable<PairedDevice> { public static int STATE_DISCONNECTED = 0; public static int STATE_CONNECTING = 1; public static int STATE_CONNECTED = 2; @@ -55,5 +55,9 @@ public interface BluetoothController { if (state == STATE_DISCONNECTING) return "STATE_DISCONNECTING"; return "UNKNOWN"; } + + public int compareTo(PairedDevice another) { + return name.compareTo(another.name); + } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java index 81e1e45..894f82a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java @@ -45,7 +45,6 @@ import android.os.Looper; import android.os.Message; import android.os.ParcelUuid; import android.util.ArrayMap; -import android.util.ArraySet; import android.util.Log; import android.util.SparseArray; @@ -55,6 +54,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Set; +import java.util.TreeSet; public class BluetoothControllerImpl implements BluetoothController { private static final String TAG = "BluetoothController"; @@ -194,8 +194,8 @@ public class BluetoothControllerImpl implements BluetoothController { } @Override - public ArraySet<PairedDevice> getPairedDevices() { - final ArraySet<PairedDevice> rt = new ArraySet<>(); + public Set<PairedDevice> getPairedDevices() { + final Set<PairedDevice> rt = new TreeSet<>(); for (int i = 0; i < mDeviceInfo.size(); i++) { final BluetoothDevice device = mDeviceInfo.keyAt(i); final DeviceInfo info = mDeviceInfo.valueAt(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 779ff52..04c626b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java @@ -152,7 +152,7 @@ public class Clock extends TextView implements DemoMode { final char MAGIC2 = '\uEF01'; SimpleDateFormat sdf; - String format = is24 ? d.timeFormat24 : d.timeFormat12; + String format = is24 ? d.timeFormat_Hm : d.timeFormat_hm; if (!format.equals(mClockFormatString)) { /* * Search for an unquoted "a" in the format string, so we can diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java index 2fbb812..f0dd943 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java @@ -190,7 +190,8 @@ public class SecurityControllerImpl implements SecurityController { NetworkCapabilities networkCapabilities = mConnectivityManager.getNetworkCapabilities(network); if (DEBUG) Log.d(TAG, "onAvailable " + network.netId + " : " + networkCapabilities); - if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_VPN)) { + if (networkCapabilities != null && + networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_VPN)) { setCurrentNetid(network.netId); } }; diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java index dce5c37..f804736 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java @@ -28,6 +28,7 @@ import android.os.HandlerThread; import android.os.UserHandle; import android.os.storage.StorageEventListener; import android.os.storage.StorageManager; +import android.os.storage.StorageVolume; import android.provider.Settings; import android.util.Log; @@ -198,6 +199,8 @@ public class StorageNotification extends SystemUI { */ Intent intent = new Intent(); intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class); + intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME, + getVolumeByPath(mStorageManager.getVolumeList(), path)); PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0); setMediaStorageNotification( @@ -212,6 +215,8 @@ public class StorageNotification extends SystemUI { */ Intent intent = new Intent(); intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class); + intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME, + getVolumeByPath(mStorageManager.getVolumeList(), path)); PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0); setMediaStorageNotification( @@ -247,6 +252,19 @@ public class StorageNotification extends SystemUI { } /** + * Get the corresponding StorageVolume object for a specific path. + */ + private final StorageVolume getVolumeByPath(StorageVolume[] volumes, String path) { + for (StorageVolume volume : volumes) { + if (volume.getPath().equals(path)) { + return volume; + } + } + Log.w(TAG, "No storage found"); + return null; + } + + /** * Update the state of the USB mass storage notification */ void updateUsbMassStorageNotification(boolean available) { |
