diff options
| -rw-r--r-- | config/hiddenapi-light-greylist.txt | 3 | ||||
| -rw-r--r-- | media/java/android/media/ExifInterface.java | 31 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java | 75 |
3 files changed, 74 insertions, 35 deletions
diff --git a/config/hiddenapi-light-greylist.txt b/config/hiddenapi-light-greylist.txt index 8a9c73820520..0afc1cec7606 100644 --- a/config/hiddenapi-light-greylist.txt +++ b/config/hiddenapi-light-greylist.txt @@ -330,8 +330,6 @@ Landroid/app/StatusBarManager;->getService()Lcom/android/internal/statusbar/ISta Landroid/app/TaskStackListener;-><init>()V Landroid/app/TimePickerDialog;->mTimePicker:Landroid/widget/TimePicker; Landroid/app/trust/ITrustManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V -Landroid/app/usage/StorageStatsManager;->getFreeBytes(Ljava/lang/String;)J -Landroid/app/usage/StorageStatsManager;->getTotalBytes(Ljava/lang/String;)J Landroid/app/usage/UsageStatsManager;->mService:Landroid/app/usage/IUsageStatsManager; Landroid/app/usage/UsageStats;->mLastEvent:I Landroid/app/usage/UsageStats;->mTotalTimeInForeground:J @@ -1357,7 +1355,6 @@ Landroid/os/storage/VolumeInfo;->getFsUuid()Ljava/lang/String; Landroid/os/storage/VolumeInfo;->getPath()Ljava/io/File; Landroid/os/storage/VolumeInfo;->getState()I Landroid/os/storage/VolumeInfo;->getType()I -Landroid/os/storage/VolumeInfo;->isMountedReadable()Z Landroid/os/storage/VolumeInfo;->isPrimary()Z Landroid/os/storage/VolumeInfo;->isVisible()Z Landroid/os/StrictMode;->disableDeathOnFileUriExposure()V diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java index 91754162180f..bc0e43b5e9c6 100644 --- a/media/java/android/media/ExifInterface.java +++ b/media/java/android/media/ExifInterface.java @@ -3226,9 +3226,18 @@ public class ExifInterface { if (stripOffsetsAttribute != null && stripByteCountsAttribute != null) { long[] stripOffsets = - (long[]) stripOffsetsAttribute.getValue(mExifByteOrder); + convertToLongArray(stripOffsetsAttribute.getValue(mExifByteOrder)); long[] stripByteCounts = - (long[]) stripByteCountsAttribute.getValue(mExifByteOrder); + convertToLongArray(stripByteCountsAttribute.getValue(mExifByteOrder)); + + if (stripOffsets == null) { + Log.w(TAG, "stripOffsets should not be null."); + return; + } + if (stripByteCounts == null) { + Log.w(TAG, "stripByteCounts should not be null."); + return; + } // Set thumbnail byte array data for non-consecutive strip bytes byte[] totalStripBytes = @@ -4025,4 +4034,22 @@ public class ExifInterface { } return false; } + + /** + * Convert given int[] to long[]. If long[] is given, just return it. + * Return null for other types of input. + */ + private static long[] convertToLongArray(Object inputObj) { + if (inputObj instanceof int[]) { + int[] input = (int[]) inputObj; + long[] result = new long[input.length]; + for (int i = 0; i < input.length; i++) { + result[i] = input[i]; + } + return result; + } else if (inputObj instanceof long[]) { + return (long[]) inputObj; + } + return null; + } } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index d24675c67188..1bab36be8cd8 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -68,7 +68,6 @@ import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener; import android.telephony.TelephonyManager; import android.util.Log; -import android.util.Slog; import android.util.SparseBooleanArray; import android.util.SparseIntArray; @@ -88,6 +87,7 @@ import java.io.PrintWriter; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map.Entry; @@ -400,16 +400,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { // Hack level over 9000: Because the subscription id is not yet valid when we see the // first update in handleSimStateChange, we need to force refresh all all SIM states // so the subscription id for them is consistent. - ArrayList<SubscriptionInfo> changedSubscriptions = new ArrayList<>(); - for (int i = 0; i < subscriptionInfos.size(); i++) { - SubscriptionInfo info = subscriptionInfos.get(i); - boolean changed = refreshSimState(info.getSubscriptionId(), info.getSimSlotIndex()); - if (changed) { - changedSubscriptions.add(info); - } - } - for (int i = 0; i < changedSubscriptions.size(); i++) { - SimData data = mSimDatas.get(changedSubscriptions.get(i).getSubscriptionId()); + List<Integer> changedSubscriptionIds = refreshSimState(subscriptionInfos); + for (int i = 0; i < changedSubscriptionIds.size(); i++) { + SimData data = mSimDatas.get(changedSubscriptionIds.get(i)); for (int j = 0; j < mCallbacks.size(); j++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(j).get(); if (cb != null) { @@ -1846,34 +1839,56 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { }; /** - * @return true if and only if the state has changed for the specified {@code slotId} + * @return A list of changed subscriptions, maybe empty but never null */ - private boolean refreshSimState(int subId, int slotId) { + private List<Integer> refreshSimState(final List<SubscriptionInfo> activeSubscriptionInfos) { // This is awful. It exists because there are two APIs for getting the SIM status // that don't return the complete set of values and have different types. In Keyguard we // need IccCardConstants, but TelephonyManager would only give us // TelephonyManager.SIM_STATE*, so we retrieve it manually. final TelephonyManager tele = TelephonyManager.from(mContext); - int simState = tele.getSimState(slotId); - State state; - try { - state = State.intToState(simState); - } catch(IllegalArgumentException ex) { - Log.w(TAG, "Unknown sim state: " + simState); - state = State.UNKNOWN; + ArrayList<Integer> changedSubscriptionIds = new ArrayList<>(); + HashSet<Integer> activeSubIds = new HashSet<>(); + + for (SubscriptionInfo info : activeSubscriptionInfos) { + int subId = info.getSubscriptionId(); + int slotId = info.getSimSlotIndex(); + int simState = tele.getSimState(slotId); + State state; + try { + state = State.intToState(simState); + } catch(IllegalArgumentException ex) { + Log.w(TAG, "Unknown sim state: " + simState); + state = State.UNKNOWN; + } + + SimData data = mSimDatas.get(subId); + final boolean changed; + if (data == null) { + data = new SimData(state, slotId, subId); + mSimDatas.put(subId, data); + changed = true; // no data yet; force update + } else { + changed = data.simState != state; + data.simState = state; + } + if (changed) { + changedSubscriptionIds.add(subId); + } + + activeSubIds.add(subId); } - SimData data = mSimDatas.get(subId); - final boolean changed; - if (data == null) { - data = new SimData(state, slotId, subId); - mSimDatas.put(subId, data); - changed = true; // no data yet; force update - } else { - changed = data.simState != state; - data.simState = state; + + for (SimData data : mSimDatas.values()) { + if (!activeSubIds.contains(data.subId) && data.simState != State.ABSENT) { + // for the inactive subscriptions, reset state to ABSENT + data.simState = State.ABSENT; + changedSubscriptionIds.add(data.subId); + } } - return changed; + + return changedSubscriptionIds; } public static boolean isSimPinSecure(IccCardConstants.State state) { |