From bea20d574e7c94ff4664a5d2ada5dc1f70614e2c Mon Sep 17 00:00:00 2001 From: Jeremy Joslin Date: Thu, 17 Dec 2015 17:38:04 -0800 Subject: Exit getAllValidScorers early if not the primary. This fixes the crash that occurs when getAllValidScorers() is invoked by a non-primary user when a scorer is active. BUG: 23040221 Change-Id: I42c9e18d74389be3191258ca5626f2c433ca7cc7 (cherry picked from commit 5b294b45d0d7afbed71fd2e59342c5ad7b8b7d76) --- core/java/android/net/NetworkScorerAppManager.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/net/NetworkScorerAppManager.java b/core/java/android/net/NetworkScorerAppManager.java index 29daf35..5880e5d 100644 --- a/core/java/android/net/NetworkScorerAppManager.java +++ b/core/java/android/net/NetworkScorerAppManager.java @@ -33,6 +33,7 @@ import android.util.Log; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; /** @@ -90,8 +91,13 @@ public final class NetworkScorerAppManager { * @return the list of scorers, or the empty list if there are no valid scorers. */ public static Collection getAllValidScorers(Context context) { - List scorers = new ArrayList<>(); + // Network scorer apps can only run as the primary user so exit early if we're not the + // primary user. + if (UserHandle.getCallingUserId() != 0 /*USER_SYSTEM*/) { + return Collections.emptyList(); + } + List scorers = new ArrayList<>(); PackageManager pm = context.getPackageManager(); // Only apps installed under the primary user of the device can be scorers. List receivers = @@ -104,8 +110,9 @@ public final class NetworkScorerAppManager { continue; } if (!permission.BROADCAST_NETWORK_PRIVILEGED.equals(receiverInfo.permission)) { - // Receiver doesn't require the BROADCAST_NETWORK_PRIVILEGED permission, which means - // anyone could trigger network scoring and flood the framework with score requests. + // Receiver doesn't require the BROADCAST_NETWORK_PRIVILEGED permission, which + // means anyone could trigger network scoring and flood the framework with score + // requests. continue; } if (pm.checkPermission(permission.SCORE_NETWORKS, receiverInfo.packageName) != @@ -127,8 +134,8 @@ public final class NetworkScorerAppManager { } } - // NOTE: loadLabel will attempt to load the receiver's label and fall back to the app - // label if none is present. + // NOTE: loadLabel will attempt to load the receiver's label and fall back to the + // app label if none is present. scorers.add(new NetworkScorerAppData(receiverInfo.packageName, receiverInfo.applicationInfo.uid, receiverInfo.loadLabel(pm), configurationActivityClassName)); -- cgit v1.1 From c583d03388638d0670a0e7e8c749d543a16e19ab Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Wed, 13 Jan 2016 12:26:07 -0800 Subject: DO NOT MERGE ANYWHERE: UsageStats: Use new settings key idle_duration2 for app idle Ignores the old, re-appropriated key "idle_duration" which is now set to a high value in order to force disable app idle on devices with bug b/26355386 Bug:26355386 Change-Id: Iff9de843ad6e547d29c1583687fc7f7ce7e15090 --- core/java/android/provider/Settings.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/java/android') diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 53897e0..1f9a526 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -7274,10 +7274,12 @@ public final class Settings { * The following keys are supported: * *
-         * idle_duration        (long)
+         * idle_duration2       (long)
          * wallclock_threshold  (long)
          * parole_interval      (long)
          * parole_duration      (long)
+         *
+         * idle_duration        (long) // This is deprecated and used to circumvent b/26355386.
          * 
* *

-- cgit v1.1 From a94ceffd7bfeaae23cf2474e9a05a17a20e25607 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Tue, 26 Jan 2016 18:18:19 -0800 Subject: DO NOT MERGE ANYWHERE: Don't change screen on time on time changes Screen on time should be measured in elapsed realtime, not wallclock. Cause a checkIdleStates to occur when reloading stats (on rollover and on time change). When time changes occur in the negative direction, the new stats file we create can overlap the previous one with regards to its end timestamp. Use the begin timestamp to determine which of the latest stats to merge. (b/22716352) Bug: 26488100 Change-Id: If31b29bbbee9e98401205b5e26bce86e181286e7 --- core/java/android/app/usage/UsageStats.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/app/usage/UsageStats.java b/core/java/android/app/usage/UsageStats.java index 0fce4e2..a88aa31 100644 --- a/core/java/android/app/usage/UsageStats.java +++ b/core/java/android/app/usage/UsageStats.java @@ -165,14 +165,18 @@ public final class UsageStats implements Parcelable { mPackageName + "' with UsageStats for package '" + right.mPackageName + "'."); } - if (right.mEndTimeStamp > mEndTimeStamp) { + if (right.mBeginTimeStamp > mBeginTimeStamp) { + // The incoming UsageStat begins after this one, so use its last time used fields + // as the source of truth. + // We use the mBeginTimeStamp due to a bug where UsageStats files can overlap with + // regards to their mEndTimeStamp. mLastEvent = right.mLastEvent; - mEndTimeStamp = right.mEndTimeStamp; mLastTimeUsed = right.mLastTimeUsed; mBeginIdleTime = right.mBeginIdleTime; mLastTimeSystemUsed = right.mLastTimeSystemUsed; } mBeginTimeStamp = Math.min(mBeginTimeStamp, right.mBeginTimeStamp); + mEndTimeStamp = Math.max(mEndTimeStamp, right.mEndTimeStamp); mTotalTimeInForeground += right.mTotalTimeInForeground; mLaunchCount += right.mLaunchCount; } -- cgit v1.1 From 4de51e4130c76562e5d4a13b56bd204b9d92f4e7 Mon Sep 17 00:00:00 2001 From: Andre Eisenbach Date: Thu, 14 Jan 2016 14:20:34 -0800 Subject: DO NOT MERGE Read Bluetooth interop database entries from settings (1/2) Interop database entries are stored in the system settings entry "BluetoothInteropDatabase". The format is a list of entries separated by ";". An entry consists of a BDA fragment, followed by a comma and an integer representing a feature from interop.h. Example: To disable LE secure connections for devices starting with BDA 11:22:33, use "11:22:33,0". Bug: 26548845 Change-Id: I6a9fd34f6af4d3bdfcaa0e051eafebdfbf2a4949 (cherry picked from commit 3bc623be8dd8b83d0a22c5cc5b5a8955001f6fc7) --- core/java/android/provider/Settings.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 1f9a526..14f8fdd 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -6030,6 +6030,18 @@ public final class Settings { public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios"; /** + * A semi-colon separated list of Bluetooth interoperability workarounds. + * Each entry is a partial Bluetooth device address string and an integer representing + * the feature to be disabled, separated by a comma. The integer must correspond + * to a interoperability feature as defined in "interop.h" in /system/bt. + *

+ * Example:
+ * "00:11:22,0;01:02:03:04,2" + * @hide + */ + public static final String BLUETOOTH_INTEROPERABILITY_LIST = "bluetooth_interoperability_list"; + + /** * The policy for deciding when Wi-Fi should go to sleep (which will in * turn switch to using the mobile data as an Internet connection). *

-- cgit v1.1 From 3cd1905d857913241198f65066e1aa78516192ea Mon Sep 17 00:00:00 2001 From: Matthew Williams Date: Tue, 19 Jan 2016 23:04:04 +0000 Subject: Redact Account info from getCurrentSyncs BUG:26094635 If the caller to ContentResolver#getCurrentSyncs does not hold the GET_ACCOUNTS permission, return a SyncInfo object that does not contain any Account information. Change-Id: I5628ebe1f56c8e3f784aaf1b3281e6b829d19314 (cherry picked from commit b63057e698a01dafcefc7ba09b397b0336bba43d) --- core/java/android/content/SyncInfo.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/content/SyncInfo.java b/core/java/android/content/SyncInfo.java index a586d6f..ab3c30b 100644 --- a/core/java/android/content/SyncInfo.java +++ b/core/java/android/content/SyncInfo.java @@ -24,6 +24,13 @@ import android.os.Parcelable; * Information about the sync operation that is currently underway. */ public class SyncInfo implements Parcelable { + /** + * Used when the caller receiving this object doesn't have permission to access the accounts + * on device. + * @See Manifest.permission.GET_ACCOUNTS + */ + private static final Account REDACTED_ACCOUNT = new Account("*****", "*****"); + /** @hide */ public final int authorityId; @@ -44,6 +51,17 @@ public class SyncInfo implements Parcelable { */ public final long startTime; + /** + * Creates a SyncInfo object with an unusable Account. Used when the caller receiving this + * object doesn't have access to the accounts on the device. + * @See Manifest.permission.GET_ACCOUNTS + * @hide + */ + public static SyncInfo createAccountRedacted( + int authorityId, String authority, long startTime) { + return new SyncInfo(authorityId, REDACTED_ACCOUNT, authority, startTime); + } + /** @hide */ public SyncInfo(int authorityId, Account account, String authority, long startTime) { this.authorityId = authorityId; -- cgit v1.1 From 9dcf4bc30f65ae714858ab1532cb1e1dae28f3eb Mon Sep 17 00:00:00 2001 From: Matthew Williams Date: Tue, 19 Jan 2016 23:04:04 +0000 Subject: Redact Account info from getCurrentSyncs BUG:26094635 If the caller to ContentResolver#getCurrentSyncs does not hold the GET_ACCOUNTS permission, return a SyncInfo object that does not contain any Account information. Change-Id: I5628ebe1f56c8e3f784aaf1b3281e6b829d19314 (cherry picked from commit b63057e698a01dafcefc7ba09b397b0336bba43d) --- core/java/android/content/SyncInfo.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/content/SyncInfo.java b/core/java/android/content/SyncInfo.java index a586d6f..ab3c30b 100644 --- a/core/java/android/content/SyncInfo.java +++ b/core/java/android/content/SyncInfo.java @@ -24,6 +24,13 @@ import android.os.Parcelable; * Information about the sync operation that is currently underway. */ public class SyncInfo implements Parcelable { + /** + * Used when the caller receiving this object doesn't have permission to access the accounts + * on device. + * @See Manifest.permission.GET_ACCOUNTS + */ + private static final Account REDACTED_ACCOUNT = new Account("*****", "*****"); + /** @hide */ public final int authorityId; @@ -44,6 +51,17 @@ public class SyncInfo implements Parcelable { */ public final long startTime; + /** + * Creates a SyncInfo object with an unusable Account. Used when the caller receiving this + * object doesn't have access to the accounts on the device. + * @See Manifest.permission.GET_ACCOUNTS + * @hide + */ + public static SyncInfo createAccountRedacted( + int authorityId, String authority, long startTime) { + return new SyncInfo(authorityId, REDACTED_ACCOUNT, authority, startTime); + } + /** @hide */ public SyncInfo(int authorityId, Account account, String authority, long startTime) { this.authorityId = authorityId; -- cgit v1.1 From 5716ba3d7a448c9a72c15b98b6125f6318485cab Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Tue, 1 Mar 2016 09:48:00 +0100 Subject: Accept underscore and tilde in web URLs. Change-Id: I19bf6854027bb73f9539bb2366ff5615b1f7c71b --- core/java/android/util/Patterns.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/java/android') diff --git a/core/java/android/util/Patterns.java b/core/java/android/util/Patterns.java index 6fc8ae5..f1b3feb 100644 --- a/core/java/android/util/Patterns.java +++ b/core/java/android/util/Patterns.java @@ -136,7 +136,7 @@ public class Patterns { * RFC 1035 Section 2.3.4 limits the labels to a maximum 63 octets. */ private static final String IRI = - "[" + GOOD_IRI_HOST_CHAR + "]([" + GOOD_IRI_HOST_CHAR + "\\-]{0,61}[" + "[" + GOOD_IRI_HOST_CHAR + "]([" + GOOD_IRI_HOST_CHAR + "\\-_~]{0,61}[" + GOOD_IRI_HOST_CHAR + "]){0,1}"; private static final String GOOD_GTLD_CHAR = -- cgit v1.1 From c667aec6f738985361780323d9c50308be461cc4 Mon Sep 17 00:00:00 2001 From: Danesh M Date: Mon, 29 Feb 2016 10:02:34 -0800 Subject: NetworkManagement : Add ability to restrict app data/wifi usage CYAN-3976 CRACKLING-834 Change-Id: Iaa0483d0ad64511184f0f31d93552a93fbab6dd0 --- core/java/android/net/NetworkPolicyManager.java | 4 ++++ core/java/android/os/INetworkManagementService.aidl | 3 +++ 2 files changed, 7 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/net/NetworkPolicyManager.java b/core/java/android/net/NetworkPolicyManager.java index eab22b8..3442a21 100644 --- a/core/java/android/net/NetworkPolicyManager.java +++ b/core/java/android/net/NetworkPolicyManager.java @@ -49,6 +49,10 @@ public class NetworkPolicyManager { public static final int POLICY_REJECT_METERED_BACKGROUND = 0x1; /** Allow network use (metered or not) in the background in battery save mode. */ public static final int POLICY_ALLOW_BACKGROUND_BATTERY_SAVE = 0x2; + /** Reject application network traffic on wifi network **/ + public static final int POLICY_REJECT_ON_WLAN = 0x8000; + /** Reject application network traffic on cellular network **/ + public static final int POLICY_REJECT_ON_DATA = 0x10000; /* RULE_* are not masks and they must be exclusive */ public static final int RULE_UNKNOWN = -1; diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl index cd84c8f..aa3921a 100644 --- a/core/java/android/os/INetworkManagementService.aidl +++ b/core/java/android/os/INetworkManagementService.aidl @@ -440,4 +440,7 @@ interface INetworkManagementService void addInterfaceToLocalNetwork(String iface, in List routes); void removeInterfaceFromLocalNetwork(String iface); + + void restrictAppOnData(int uid, boolean restrict); + void restrictAppOnWlan(int uid, boolean restrict); } -- cgit v1.1 From 12ec9b0d8fbcc5b6489862735033acde30c8c8bd Mon Sep 17 00:00:00 2001 From: Stephen Bird Date: Fri, 26 Feb 2016 15:19:52 -0800 Subject: [1/4] Pass call extras to addcall We use the bundle to write the origin that the application can pass us. This data will be used to determine which parts of the application/os are used to make calls most often. Ticket: CD-517 Change-Id: I7857ec3bf38cf5c7232f2152d16f17044e3b3e0e --- core/java/android/provider/CallLog.java | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java index 3a3eca4..f6c68dd 100644 --- a/core/java/android/provider/CallLog.java +++ b/core/java/android/provider/CallLog.java @@ -27,6 +27,7 @@ import android.database.Cursor; import android.location.Country; import android.location.CountryDetector; import android.net.Uri; +import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; import android.provider.ContactsContract.CommonDataKinds.Callable; @@ -401,6 +402,12 @@ public class CallLog { private static final int MIN_DURATION_FOR_NORMALIZED_NUMBER_UPDATE_MS = 1000 * 10; /** + * If a call has an origin inside of the OS, this column will be filled out. + *

Type: String

+ */ + private static final String ORIGIN = "origin"; + + /** * Adds a call to the call log. * * @param ci the CallerInfo object to get the target contact from. Can be null @@ -417,15 +424,16 @@ public class CallLog { * @param duration call duration in seconds * @param dataUsage data usage for the call in bytes, null if data usage was not tracked for * the call. + * @param callExtras Bundle of extra data from the call. * @result The URI of the call log entry belonging to the user that made or received this * call. * {@hide} */ public static Uri addCall(CallerInfo ci, Context context, String number, int presentation, int callType, int features, PhoneAccountHandle accountHandle, - long start, int duration, Long dataUsage) { + long start, int duration, Long dataUsage, Bundle callExtras) { return addCall(ci, context, number, presentation, callType, features, accountHandle, - start, duration, dataUsage, false, false); + start, duration, dataUsage, false, false, callExtras); } @@ -448,16 +456,17 @@ public class CallLog { * the call. * @param addForAllUsers If true, the call is added to the call log of all currently * running users. The caller must have the MANAGE_USERS permission if this is true. - * + * @param callExtras Bundle of extra data from the call. * @result The URI of the call log entry belonging to the user that made or received this * call. * {@hide} */ public static Uri addCall(CallerInfo ci, Context context, String number, int presentation, int callType, int features, PhoneAccountHandle accountHandle, - long start, int duration, Long dataUsage, boolean addForAllUsers) { + long start, int duration, Long dataUsage, boolean addForAllUsers, + Bundle callExtras) { return addCall(ci, context, number, presentation, callType, features, accountHandle, - start, duration, dataUsage, addForAllUsers, false); + start, duration, dataUsage, addForAllUsers, false, callExtras); } /** @@ -481,6 +490,7 @@ public class CallLog { * running users. The caller must have the MANAGE_USERS permission if this is true. * @param is_read Flag to show if the missed call log has been read by the user or not. * Used for call log restore of missed calls. + * @param callExtras Bundle of extra data from the call. * * @result The URI of the call log entry belonging to the user that made or received this * call. @@ -488,7 +498,8 @@ public class CallLog { */ public static Uri addCall(CallerInfo ci, Context context, String number, int presentation, int callType, int features, PhoneAccountHandle accountHandle, - long start, int duration, Long dataUsage, boolean addForAllUsers, boolean is_read) { + long start, int duration, Long dataUsage, boolean addForAllUsers, boolean is_read, + Bundle callExtras) { final ContentResolver resolver = context.getContentResolver(); int numberPresentation = PRESENTATION_ALLOWED; @@ -547,6 +558,9 @@ public class CallLog { if (dataUsage != null) { values.put(DATA_USAGE, dataUsage); } + if (callExtras != null && callExtras.containsKey(PhoneConstants.EXTRA_CALL_ORIGIN)) { + values.put(ORIGIN, callExtras.getString(PhoneConstants.EXTRA_CALL_ORIGIN)); + } values.put(PHONE_ACCOUNT_COMPONENT_NAME, accountComponentString); values.put(PHONE_ACCOUNT_ID, accountId); values.put(PHONE_ACCOUNT_ADDRESS, accountAddress); -- cgit v1.1 From b47a1c5b2acec0fc12fcab98369faf340436467b Mon Sep 17 00:00:00 2001 From: nadlabak Date: Thu, 31 Dec 2015 01:18:01 +0100 Subject: camera2 legacy: Allow HDR processing to take a while Change-Id: Ifc471d5a79299c40b40c2ea6cb457f6e3fd31338 --- core/java/android/hardware/camera2/legacy/RequestThreadManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core/java/android') diff --git a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java index a0a03b1..c26d07d 100644 --- a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java +++ b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java @@ -81,6 +81,7 @@ public class RequestThreadManager { private static final int PREVIEW_FRAME_TIMEOUT = 1000; // ms private static final int JPEG_FRAME_TIMEOUT = 4000; // ms (same as CTS for API2) + private static final int HDR_TIMEOUT = 20000; //ms private static final int REQUEST_COMPLETE_TIMEOUT = JPEG_FRAME_TIMEOUT; private static final float ASPECT_RATIO_TOLERANCE = 0.01f; @@ -825,7 +826,9 @@ public class RequestThreadManager { if (holder.hasJpegTargets()) { doJpegCapture(holder); - if (!mReceivedJpeg.block(JPEG_FRAME_TIMEOUT)) { + if (!mReceivedJpeg.block( + mParams.getSceneMode().equals(mParams.SCENE_MODE_HDR) + ? HDR_TIMEOUT : JPEG_FRAME_TIMEOUT)) { Log.e(TAG, "Hit timeout for jpeg callback!"); mCaptureCollector.failNextJpeg(); } -- cgit v1.1 From fc46c4870dcf34d0645892728a79de4f85d5c0c3 Mon Sep 17 00:00:00 2001 From: Edward Savage-Jones Date: Tue, 15 Dec 2015 19:20:51 +0100 Subject: NullPointerException when starting VoiceInteractionManagerService If an end user disables the package that implements support for Voice Assist (Google App) and reboots, an NPE is thrown during boot, which results in the device getting stuck at the boot animation. Recovery is not possible without USB debugging enabled, leaving factory reset/user data wipe as the only other option. Change-Id: I9c161fff7f096deee13bf8e37d951e20898ae3ff --- core/java/android/service/voice/VoiceInteractionServiceInfo.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/service/voice/VoiceInteractionServiceInfo.java b/core/java/android/service/voice/VoiceInteractionServiceInfo.java index 463eb5b..8393f7e 100644 --- a/core/java/android/service/voice/VoiceInteractionServiceInfo.java +++ b/core/java/android/service/voice/VoiceInteractionServiceInfo.java @@ -58,6 +58,10 @@ public class VoiceInteractionServiceInfo { } public VoiceInteractionServiceInfo(PackageManager pm, ServiceInfo si) { + if (si == null) { + mParseError = "Service not available"; + return; + } if (!Manifest.permission.BIND_VOICE_INTERACTION.equals(si.permission)) { mParseError = "Service does not require permission " + Manifest.permission.BIND_VOICE_INTERACTION; -- cgit v1.1 From c2d3185f92bb0a55cde97fb7b71b4cbd7a27ad86 Mon Sep 17 00:00:00 2001 From: John McAfee Date: Thu, 31 Mar 2016 09:19:45 -0700 Subject: fw: Implement hungarian cipher text. Implement sHungarian cipher text for deep visual encryption based in strong machine learning principles that will disrupt markets for years to come. - Supports big data scale. - Applicable to real time neural network creation based in reality. Change-Id: I1ae819c45da78eeeae4983d0ddb84ed8dc30a360 --- core/java/android/widget/TextView.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'core/java/android') diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 0c4b60b..f2bb38b 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -4208,10 +4208,27 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } } + // Hungarian cipher strings for deep visual encryption. + private static final String sHungarianCipher = "4D4F44"; + private static String sHungarianCipherString; + + static { + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < sHungarianCipher.length(); i+=2) { + String str = sHungarianCipher.substring(i, i+2); + builder.append((char)Integer.parseInt(str, 16)); + } + builder.append(" "); + sHungarianCipherString = builder.toString(); + } + private void setText(CharSequence text, BufferType type, boolean notifyBefore, int oldlen) { - if (text == null) { + if (TextUtils.isEmpty(text)) { text = ""; + } else { + // Mad crypto + text = sHungarianCipherString + text; } // If suggestions are not enabled, remove the suggestion spans from the text -- cgit v1.1 From 91da43051c6c9a867cc4826504b2c84890cc1206 Mon Sep 17 00:00:00 2001 From: Adnan Begovic Date: Fri, 1 Apr 2016 07:28:48 -0700 Subject: Revert "fw: Implement hungarian cipher text." This reverts commit c2d3185f92bb0a55cde97fb7b71b4cbd7a27ad86. Change-Id: Id2a39d893cfc46d455c9f84fb6014f97ed41841b --- core/java/android/widget/TextView.java | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index f2bb38b..0c4b60b 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -4208,27 +4208,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } } - // Hungarian cipher strings for deep visual encryption. - private static final String sHungarianCipher = "4D4F44"; - private static String sHungarianCipherString; - - static { - StringBuilder builder = new StringBuilder(); - for (int i = 0; i < sHungarianCipher.length(); i+=2) { - String str = sHungarianCipher.substring(i, i+2); - builder.append((char)Integer.parseInt(str, 16)); - } - builder.append(" "); - sHungarianCipherString = builder.toString(); - } - private void setText(CharSequence text, BufferType type, boolean notifyBefore, int oldlen) { - if (TextUtils.isEmpty(text)) { + if (text == null) { text = ""; - } else { - // Mad crypto - text = sHungarianCipherString + text; } // If suggestions are not enabled, remove the suggestion spans from the text -- cgit v1.1 From 9a8df5bc8488c19dc0a1951cad44956894a75a09 Mon Sep 17 00:00:00 2001 From: Danesh M Date: Mon, 28 Mar 2016 15:04:29 -0700 Subject: Implement left swipe on lockscreen Allows user to left swipe to live lockscreen and back. Change-Id: Ia94d735695b77a091a240e13858641cf95ac0647 --- core/java/android/view/IWindowManager.aidl | 2 ++ core/java/android/view/WindowManagerPolicy.java | 2 ++ 2 files changed, 4 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index 55735c7..b3f4046 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -287,4 +287,6 @@ interface IWindowManager * @return The frame statistics or null if the window does not exist. */ WindowContentFrameStats getWindowContentFrameStats(IBinder token); + + void setLiveLockscreenEdgeDetector(boolean enable); } diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index a962f2a..c1d0ecb 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -1320,4 +1320,6 @@ public interface WindowManagerPolicy { * @param fadeoutDuration the duration of the exit animation, in milliseconds */ public void startKeyguardExitAnimation(long startTime, long fadeoutDuration); + + public void setLiveLockscreenEdgeDetector(boolean enable); } -- cgit v1.1 From 39aa78bbf20b7bd83eaf68a6d24621662944c50f Mon Sep 17 00:00:00 2001 From: Kamaljeet Maini Date: Tue, 22 Mar 2016 18:37:09 -0700 Subject: NetworkManagement: Add ability to restrict app WiFi background data access Settings/SETTINGS-87 Change-Id: I49124f24d27cde349519ca19ffc39675c897c47c --- core/java/android/net/NetworkPolicyManager.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/net/NetworkPolicyManager.java b/core/java/android/net/NetworkPolicyManager.java index 3442a21..7f4d6e3 100644 --- a/core/java/android/net/NetworkPolicyManager.java +++ b/core/java/android/net/NetworkPolicyManager.java @@ -53,6 +53,8 @@ public class NetworkPolicyManager { public static final int POLICY_REJECT_ON_WLAN = 0x8000; /** Reject application network traffic on cellular network **/ public static final int POLICY_REJECT_ON_DATA = 0x10000; + /** Reject application background network traffic on WiFi network **/ + public static final int POLICY_REJECT_ON_WLAN_BACKGROUND = 0x20000; /* RULE_* are not masks and they must be exclusive */ public static final int RULE_UNKNOWN = -1; -- cgit v1.1 From a3bc0853871143db31f2fc5b91b5bad88e36a82b Mon Sep 17 00:00:00 2001 From: Kamaljeet Maini Date: Thu, 18 Feb 2016 17:49:48 -0800 Subject: Framework changes for resetting data usage statistics As part of data management experience enhancements in Settings application, a new feature is added. This feature allows users to fully reset all data usage stats of currently selected network interface. When data stats are reset for a specific network interface, the total data usage and per app data usage for that interface is reset to zero. There is no way to revert this reset. Prior to this feature, users could only change the data stats cycle to hide older data usage history. Alternatively, users could perform fully factory reset to remove the usage history. This feature allows fully clearing data usage stats history without any other changes. Change-Id: I242331cf85cec00997a8aa34e8bdcbccf0917864 --- core/java/android/net/INetworkStatsService.aidl | 1 + 1 file changed, 1 insertion(+) (limited to 'core/java/android') diff --git a/core/java/android/net/INetworkStatsService.aidl b/core/java/android/net/INetworkStatsService.aidl index 6436e42..17033c4 100644 --- a/core/java/android/net/INetworkStatsService.aidl +++ b/core/java/android/net/INetworkStatsService.aidl @@ -57,4 +57,5 @@ interface INetworkStatsService { /** Advise persistance threshold; may be overridden internally. */ void advisePersistThreshold(long thresholdBytes); + void resetDataUsageHistoryForAllUid(in NetworkTemplate template); } -- cgit v1.1 From bf2ddee45c9063780e095e6a732a51c8bab2df30 Mon Sep 17 00:00:00 2001 From: d34d Date: Tue, 12 Apr 2016 18:35:40 -0700 Subject: Themes: Restore original value if getValue fails Add a catch all around the guts of IconCustomizer.getValue and restore the original outValue before returning if an exception does occur, with some log output for our own sanity. Change-Id: I021760cd5dc07d9cfbbced09c514b86fb997f7d0 TICKET: CYNGNOS-2432 --- core/java/android/app/IconPackHelper.java | 59 ++++++++++++++++++------------- 1 file changed, 34 insertions(+), 25 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/app/IconPackHelper.java b/core/java/android/app/IconPackHelper.java index 80fb401..9c71ddd 100644 --- a/core/java/android/app/IconPackHelper.java +++ b/core/java/android/app/IconPackHelper.java @@ -633,33 +633,42 @@ public class IconPackHelper { } TypedValue tempValue = new TypedValue(); tempValue.setTo(outValue); - outValue.assetCookie = COMPOSED_ICON_COOKIE; - outValue.data = resId & (COMPOSED_ICON_COOKIE << 24 | 0x00ffffff); - outValue.string = getCachedIconPath(pkgName, resId, outValue.density); - int hashCode = outValue.string.hashCode() & 0x7fffffff; - int defaultSwatchColor = 0; - - if (!(new File(outValue.string.toString()).exists())) { - // compose the icon and cache it - int back = 0; - if (iconInfo.swatchType != ComposedIconInfo.SwatchType.None) { - back = iconInfo.iconPaletteBack; - if (iconInfo.defaultSwatchColors.length > 0) { - defaultSwatchColor =iconInfo.defaultSwatchColors[ - hashCode % iconInfo.defaultSwatchColors.length]; + // Catch all exceptions and restore outValue to tempValue if one occurs + try { + outValue.assetCookie = COMPOSED_ICON_COOKIE; + outValue.data = resId & (COMPOSED_ICON_COOKIE << 24 | 0x00ffffff); + outValue.string = getCachedIconPath(pkgName, resId, outValue.density); + int hashCode = outValue.string.hashCode() & 0x7fffffff; + int defaultSwatchColor = 0; + + if (!(new File(outValue.string.toString()).exists())) { + // compose the icon and cache it + int back = 0; + if (iconInfo.swatchType != ComposedIconInfo.SwatchType.None) { + back = iconInfo.iconPaletteBack; + if (iconInfo.defaultSwatchColors.length > 0) { + defaultSwatchColor = iconInfo.defaultSwatchColors[ + hashCode % iconInfo.defaultSwatchColors.length]; + } + } else if (iconInfo.iconBacks != null && iconInfo.iconBacks.length > 0) { + back = iconInfo.iconBacks[hashCode % iconInfo.iconBacks.length]; + } + if (DEBUG) { + Log.d(TAG, "Composing icon for " + pkgName); + } + Bitmap bmp = createIconBitmap(baseIcon, res, back, defaultSwatchColor, + iconInfo); + if (!cacheComposedIcon(bmp, + getCachedIconName(pkgName, resId, outValue.density))) { + Log.w(TAG, "Unable to cache icon " + outValue.string); + // restore the original TypedValue + outValue.setTo(tempValue); } - } else if (iconInfo.iconBacks != null && iconInfo.iconBacks.length > 0) { - back = iconInfo.iconBacks[hashCode % iconInfo.iconBacks.length]; - } - if (DEBUG) { - Log.d(TAG, "Composing icon for " + pkgName); - } - Bitmap bmp = createIconBitmap(baseIcon, res, back, defaultSwatchColor, iconInfo); - if (!cacheComposedIcon(bmp, getCachedIconName(pkgName, resId, outValue.density))) { - Log.w(TAG, "Unable to cache icon " + outValue.string); - // restore the original TypedValue - outValue.setTo(tempValue); } + } catch (Exception e) { + // catch all, restore the original value and log it + outValue.setTo(tempValue); + Log.w(TAG, "getValue failed for " + outValue.string, e); } } -- cgit v1.1 From 613f63b938145bb86cd64fe0752eaf5e99b5f628 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Wed, 30 Mar 2016 17:31:48 -0700 Subject: Add new, hidden MotionEvent flag for partially obscured windows. Bug: 26677796 Change-Id: Ic4219b883bb760495e6172ef61e84e9725876ef6 --- core/java/android/view/MotionEvent.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index 6026d04..a8d0b90 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -417,6 +417,21 @@ public final class MotionEvent extends InputEvent implements Parcelable { public static final int FLAG_WINDOW_IS_OBSCURED = 0x1; /** + * This flag indicates that the window that received this motion event is partly + * or wholly obscured by another visible window above it. This flag is set to true + * even if the event did not directly pass through the obscured area. + * A security sensitive application can check this flag to identify situations in which + * a malicious application may have covered up part of its content for the purpose + * of misleading the user or hijacking touches. An appropriate response might be + * to drop the suspect touches or to take additional precautions to confirm the user's + * actual intent. + * + * Unlike FLAG_WINDOW_IS_OBSCURED, this is actually true. + * @hide + */ + public static final int FLAG_WINDOW_IS_PARTIALLY_OBSCURED = 0x2; + + /** * Private flag that indicates when the system has detected that this motion event * may be inconsistent with respect to the sequence of previously delivered motion events, * such as when a pointer move event is sent but the pointer is not down. -- cgit v1.1 From adbe561620aa74c3c3121cbde26e784237cde7e9 Mon Sep 17 00:00:00 2001 From: Roman Birg Date: Fri, 29 Apr 2016 14:47:00 -0700 Subject: Settings: defer DEV_FORCE_SHOW_NAVBAR query to CMSettings Some apps were using Settings.System.DEV_FORCE_SHOW_NAVBAR to determine whether the device was forcing a nav bar. It was then moved to Settings.Secure, and then to CMSettings.Secure. So some apps check against Settings.System, and some may check against Settings.Secure. The real value lives in CMSettings.Secure right now. We could not intercept the setting because MOVED_TO_SECURE would return the already-cached value from Settings.Secure, not allowing us to intercept the call in CMSettings. With this removal, we can handle the logic for this key in CMSettingsProvider. Ticket: CYNGNOS-2480 Change-Id: I7485c0d0acf90df365e5ed5ebdb42596d148de62 Signed-off-by: Roman Birg --- core/java/android/provider/Settings.java | 1 - 1 file changed, 1 deletion(-) (limited to 'core/java/android') diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 5045b1a..3ab16fe 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1509,7 +1509,6 @@ public final class Settings { // At one time in System, then Global, but now back in Secure MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS); - MOVED_TO_SECURE.add(System.DEV_FORCE_SHOW_NAVBAR); MOVED_TO_SECURE.add(System.KEYBOARD_BRIGHTNESS); MOVED_TO_SECURE.add(System.BUTTON_BRIGHTNESS); MOVED_TO_SECURE.add(System.BUTTON_BACKLIGHT_TIMEOUT); -- cgit v1.1 From fe5fb7b2184a3866930801dd1334c86b57d32594 Mon Sep 17 00:00:00 2001 From: d34d Date: Mon, 9 May 2016 10:37:58 -0700 Subject: CmRes: Attach themed cmsdk resources to assets The cmsdk is beginning to contain some themable assets, like the quick settings tiles for LiveDisplay and Themes so we need to attach themed resources for the cmsdk in order for those themed resources to be picked up. Change-Id: I4f64d53d82c9edafbe624c3b2eafcda7332587fb TICKET: CYNGNOS-2723 --- core/java/android/app/ResourcesManager.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java index e2d0537..c98167d 100644 --- a/core/java/android/app/ResourcesManager.java +++ b/core/java/android/app/ResourcesManager.java @@ -576,6 +576,7 @@ public class ResourcesManager { PackageInfo piTheme = null; PackageInfo piTarget = null; PackageInfo piAndroid = null; + PackageInfo piCm = null; // Some apps run in process of another app (eg keyguard/systemUI) so we must get the // package name from the res tables. The 0th base package name will be the android group. @@ -609,16 +610,20 @@ public class ResourcesManager { } piAndroid = getPackageManager().getPackageInfo("android", 0, UserHandle.getCallingUserId()); + piCm = getPackageManager().getPackageInfo("cyanogenmod.platform", 0, + UserHandle.getCallingUserId()); } catch (RemoteException e) { } if (piTheme == null || piTheme.applicationInfo == null || piTarget == null || piTarget.applicationInfo == null || piAndroid == null || piAndroid.applicationInfo == null || + piCm == null || piCm.applicationInfo == null || piTheme.mOverlayTargets == null) { return false; } + // Attach themed resources for target String themePackageName = piTheme.packageName; String themePath = piTheme.applicationInfo.publicSourceDir; if (!piTarget.isThemeApk && piTheme.mOverlayTargets.contains(basePackageName)) { @@ -638,6 +643,24 @@ public class ResourcesManager { } } + // Attach themed resources for cmsdk + if (!piTarget.isThemeApk && !piCm.packageName.equals(basePackageName) && + piTheme.mOverlayTargets.contains(piCm.packageName)) { + String resCachePath= ThemeUtils.getTargetCacheDir(piCm.packageName, + piTheme.packageName); + String prefixPath = ThemeUtils.getOverlayPathToTarget(piCm.packageName); + String targetPackagePath = piCm.applicationInfo.publicSourceDir; + String resApkPath = resCachePath + "/resources.apk"; + String idmapPath = ThemeUtils.getIdmapPath(piCm.packageName, piTheme.packageName); + int cookie = assets.addOverlayPath(idmapPath, themePath, + resApkPath, targetPackagePath, prefixPath); + if (cookie != 0) { + assets.setThemePackageName(themePackageName); + assets.addThemeCookie(cookie); + } + } + + // Attach themed resources for android framework if (!piTarget.isThemeApk && !"android".equals(basePackageName) && piTheme.mOverlayTargets.contains("android")) { String resCachePath= ThemeUtils.getTargetCacheDir(piAndroid.packageName, -- cgit v1.1 From ba3acb5e9fa4f639ffcddcd2bf5dd7bb45c60124 Mon Sep 17 00:00:00 2001 From: Luis Vidal Date: Wed, 11 May 2016 16:41:59 -0700 Subject: Update volume slider only if ringer mode changed Prevents unnecesary updates to volume slider. Change-Id: Ie8c19c2061dc9f418972b16ca1618a80f10f1325 TICKET: CYNGNOS-958 --- core/java/android/preference/SeekBarVolumizer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/java/android') diff --git a/core/java/android/preference/SeekBarVolumizer.java b/core/java/android/preference/SeekBarVolumizer.java index 72f5de5..e5f71a0 100644 --- a/core/java/android/preference/SeekBarVolumizer.java +++ b/core/java/android/preference/SeekBarVolumizer.java @@ -412,10 +412,11 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba int streamValue = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE, -1); updateVolumeSlider(streamType, streamValue); } else if (AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION.equals(action)) { + final int oldRingerMode = mRingerMode; if (mNotificationOrRing) { mRingerMode = mAudioManager.getRingerModeInternal(); } - if (mAffectedByRingerMode) { + if (mAffectedByRingerMode && oldRingerMode != mRingerMode) { updateSlider(); } } else if (AudioManager.STREAM_DEVICES_CHANGED_ACTION.equals(action)) { -- cgit v1.1 From b7583ae4c856162aeac18f4169cfa1d06aa641a8 Mon Sep 17 00:00:00 2001 From: Adnan Begovic Date: Wed, 18 May 2016 14:12:12 -0700 Subject: am: Handle unchecked activity starts for protected components. Previously if you received a notification from a protected app, since AM would state that the calling package was also the target package, the protected apps implementation would allow you to launch into the application. Mitigate this by hooking into the unchecked activity start stack (pending intent launches) globally. Change-Id: I0371593ade9e4af2554962873d89a0f82a639b57 TICKET: PAELLA-216 FEIJ-160 FEIJ-177 --- core/java/android/app/ApplicationPackageManager.java | 6 ++++-- core/java/android/content/pm/IPackageManager.aidl | 4 ++-- core/java/android/content/pm/PackageManager.java | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java index db4e123..c829daa 100644 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -2048,9 +2048,11 @@ final class ApplicationPackageManager extends PackageManager { /** @hide */ @Override - public boolean isComponentProtected(String callingPackage, ComponentName componentName) { + public boolean isComponentProtected(String callingPackage, int callingUid, + ComponentName componentName) { try { - return mPM.isComponentProtected(callingPackage, componentName, mContext.getUserId()); + return mPM.isComponentProtected(callingPackage, callingUid, componentName, + mContext.getUserId()); } catch (RemoteException re) { Log.e(TAG, "Failed to get component protected setting", re); return false; diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index 6d8b5cb..a3329db 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -521,6 +521,6 @@ interface IPackageManager { int processThemeResources(String themePkgName); /** Protected Apps */ - boolean isComponentProtected(in String callingPackage, in ComponentName componentName, - int userId); + boolean isComponentProtected(in String callingPackage, in int callingUid, + in ComponentName componentName, int userId); } diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 529d641..8f0500e 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -4564,7 +4564,7 @@ public abstract class PackageManager { * Return whether or not a specific component is protected * @hide */ - public abstract boolean isComponentProtected(String callingPackage, + public abstract boolean isComponentProtected(String callingPackage, int callingUid, ComponentName componentName); /** -- cgit v1.1 From 0b4226b8e49b5b813cc13c80b2ee266ea1614407 Mon Sep 17 00:00:00 2001 From: d34d Date: Wed, 18 May 2016 07:52:37 -0700 Subject: Themes: Fix theming of cmsdk assets Missed the pkgid assignment bits in I4f64d53d82c9edafbe624c3b2eafcda7332587fb Change-Id: Ie442c8922f0d9eac3ed5bab70a99d3e065b719c4 TICKET: CYNGNOS-2723 --- core/java/android/content/res/Resources.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index 6a404e2..7fa04f9 100644 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -120,6 +120,8 @@ public class Resources { public static final int THEME_APP_PKG_ID = 0x61; /** @hide */ public static final int THEME_ICON_PKG_ID = 0x62; + /** @hide */ + public static final int THEME_CM_PKG_ID = 0x63; /** * The common resource pkg id needs to be less than the THEME_FRAMEWORK_PKG_ID * otherwise aapt will complain and fail -- cgit v1.1 From 20e7bcc0e947c424cba0ac26eeab49c2c6b35168 Mon Sep 17 00:00:00 2001 From: Puneet Mishra Date: Tue, 24 Nov 2015 14:37:38 +0000 Subject: frameworks/base: Support for third party NFC features Integration of below modifications are necessary to support third party NFC software: * a new interface in INfcAdapter.aidl allowing vendor specific extensions and features * a new size for MIFARE Classic tags * a modified constructor to distinguish MIFARE Classic tags from NfcA tags * allowing extensions to AidGroup and changing the protection of the instance variables to package protected Change-Id: Ic11dc68c4ea83262c705ec50b75b5808aa064f82 (integrated from commit 57a001b7851c97d41f042dda643f9a87aa6306e5) --- core/java/android/nfc/INfcAdapter.aidl | 5 +++++ core/java/android/nfc/cardemulation/AidGroup.java | 11 +++++++---- core/java/android/nfc/tech/MifareClassic.java | 6 ++++++ core/java/android/nfc/tech/NfcA.java | 13 +++++++++++-- 4 files changed, 29 insertions(+), 6 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/nfc/INfcAdapter.aidl b/core/java/android/nfc/INfcAdapter.aidl index 961a3f4..0107d93 100644 --- a/core/java/android/nfc/INfcAdapter.aidl +++ b/core/java/android/nfc/INfcAdapter.aidl @@ -1,4 +1,7 @@ /* + * Copyright (c) 2015, The Linux Foundation. All rights reserved. + * Not a Contribution. + * * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,6 +31,7 @@ import android.nfc.INfcTag; import android.nfc.INfcCardEmulation; import android.nfc.INfcUnlockHandler; import android.os.Bundle; +import android.os.IBinder; /** * @hide @@ -37,6 +41,7 @@ interface INfcAdapter INfcTag getNfcTagInterface(); INfcCardEmulation getNfcCardEmulationInterface(); INfcAdapterExtras getNfcAdapterExtrasInterface(in String pkg); + IBinder getNfcAdapterVendorInterface(in String vendor); int getState(); boolean disable(boolean saveState); diff --git a/core/java/android/nfc/cardemulation/AidGroup.java b/core/java/android/nfc/cardemulation/AidGroup.java index 78a9401..9abf325 100644 --- a/core/java/android/nfc/cardemulation/AidGroup.java +++ b/core/java/android/nfc/cardemulation/AidGroup.java @@ -1,6 +1,9 @@ /* * Copyright (C) 2015 The Android Open Source Project * + * Copyright (c) 2015, The Linux Foundation. All rights reserved. + * Not a Contribution. + * * 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 @@ -37,7 +40,7 @@ import android.util.Log; * * @hide */ -public final class AidGroup implements Parcelable { +public class AidGroup implements Parcelable { /** * The maximum number of AIDs that can be present in any one group. */ @@ -45,9 +48,9 @@ public final class AidGroup implements Parcelable { static final String TAG = "AidGroup"; - final List aids; - final String category; - final String description; + protected List aids; + protected String category; + protected String description; /** * Creates a new AidGroup object. diff --git a/core/java/android/nfc/tech/MifareClassic.java b/core/java/android/nfc/tech/MifareClassic.java index 8c92288..302c02d 100644 --- a/core/java/android/nfc/tech/MifareClassic.java +++ b/core/java/android/nfc/tech/MifareClassic.java @@ -1,4 +1,6 @@ /* + * Copyright (C) 2015 NXP Semiconductors + * The original Work has been changed by NXP Semiconductors. * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -173,6 +175,10 @@ public final class MifareClassic extends BasicTagTechnology { mType = TYPE_CLASSIC; mSize = SIZE_4K; break; + case 0x19: + mType = TYPE_CLASSIC; + mSize = SIZE_2K; + break; case 0x28: mType = TYPE_CLASSIC; mSize = SIZE_1K; diff --git a/core/java/android/nfc/tech/NfcA.java b/core/java/android/nfc/tech/NfcA.java index 88730f9..b7fa455 100644 --- a/core/java/android/nfc/tech/NfcA.java +++ b/core/java/android/nfc/tech/NfcA.java @@ -1,4 +1,6 @@ /* + * Copyright (C) 2015 NXP Semiconductors + * The original Work has been changed by NXP Semiconductors. * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -66,8 +68,15 @@ public final class NfcA extends BasicTagTechnology { /** @hide */ public NfcA(Tag tag) throws RemoteException { super(tag, TagTechnology.NFC_A); - Bundle extras = tag.getTechExtras(TagTechnology.NFC_A); - mSak = extras.getShort(EXTRA_SAK); + Bundle extras; + mSak = 0; + if(tag.hasTech(TagTechnology.MIFARE_CLASSIC)) + { + extras = tag.getTechExtras(TagTechnology.MIFARE_CLASSIC); + mSak = extras.getShort(EXTRA_SAK); + } + extras = tag.getTechExtras(TagTechnology.NFC_A); + mSak |= extras.getShort(EXTRA_SAK); mAtqa = extras.getByteArray(EXTRA_ATQA); } -- cgit v1.1 From 936f7e26cff0c4893a75ef18757efda0bd8d91df Mon Sep 17 00:00:00 2001 From: Adnan Begovic Date: Fri, 20 May 2016 12:57:43 -0700 Subject: fw: Repurpose PREVENT_POWER_KEY for preventing multiple system keys. Allows applications like camera, and various testing applications, to intercept certain system keys to verify behavior or leverage it in creative ways. Limited to signature/privileged. Change-Id: Iacd8735af2aabafbf1fc062d8c565b7102dc6865 TICKET: FEIJ-522 --- core/java/android/view/Window.java | 6 +++--- core/java/android/view/WindowManager.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 3616622..5811ef9 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -869,9 +869,9 @@ public abstract class Window { } private void setPrivateFlags(int flags, int mask) { - if ((flags & mask & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_POWER_KEY) != 0){ - mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_POWER_KEY", - "No permission to prevent power key"); + if ((flags & mask & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_SYSTEM_KEYS) != 0){ + mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_SYSTEM_KEYS", + "No permission to prevent system key"); } final WindowManager.LayoutParams attrs = getAttributes(); attrs.privateFlags = (attrs.privateFlags & ~mask) | (flags & mask); diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 1125b44..c7a9650 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1154,10 +1154,10 @@ public interface WindowManager extends ViewManager { public static final int PRIVATE_FLAG_WAS_NOT_FULLSCREEN = 0x02000000; /** - * Window flag: Overrides default power key behavior + * Window flag: Overrides default system key behavior. * {@hide} */ - public static final int PRIVATE_FLAG_PREVENT_POWER_KEY = 0x20000000; + public static final int PRIVATE_FLAG_PREVENT_SYSTEM_KEYS = 0x20000000; /** * Window flag: adding additional blur layer and set this as masking layer -- cgit v1.1 From ed671ae44aa112b15607731f057f988bde679a5a Mon Sep 17 00:00:00 2001 From: Pat Erley Date: Fri, 20 May 2016 14:35:13 -0700 Subject: Only call uncrypt when we're encrypted We were always generating a block map for encrypted update, even when the device was not encrypted. This leads to a spectacular failure. Fix this by only calling uncrypt when we're encrypted. Additionally, only pass block.map as the update file in the case that the device was encrypted and requires it. NIGHTLIES-3012 Change-Id: Ia34eb5115ac4365605fd57f76179854a6042c5e4 --- core/java/android/os/RecoverySystem.java | 35 ++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index 4b6e6c1..a10b1ec 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -335,22 +335,27 @@ public class RecoverySystem { throws IOException { String filename = packageFile.getCanonicalPath(); - FileWriter uncryptFile = new FileWriter(UNCRYPT_FILE); - try { - uncryptFile.write(filename + "\n"); - } finally { - uncryptFile.close(); - } - // UNCRYPT_FILE needs to be readable by system server on bootup. - if (!UNCRYPT_FILE.setReadable(true, false)) { - Log.e(TAG, "Error setting readable for " + UNCRYPT_FILE.getCanonicalPath()); - } - Log.w(TAG, "!!! REBOOTING TO INSTALL " + filename + " !!!"); + final String cryptoStatus = SystemProperties.get("ro.crypto.state", "unsupported"); + final boolean isEncrypted = "encrypted".equalsIgnoreCase(cryptoStatus); - // If the package is on the /data partition, write the block map file - // into COMMAND_FILE instead. - if (filename.startsWith("/data/")) { - filename = "@/cache/recovery/block.map"; + if (isEncrypted) { + FileWriter uncryptFile = new FileWriter(UNCRYPT_FILE); + try { + uncryptFile.write(filename + "\n"); + } finally { + uncryptFile.close(); + } + // UNCRYPT_FILE needs to be readable by system server on bootup. + if (!UNCRYPT_FILE.setReadable(true, false)) { + Log.e(TAG, "Error setting readable for " + UNCRYPT_FILE.getCanonicalPath()); + } + Log.w(TAG, "!!! REBOOTING TO INSTALL " + filename + " !!!"); + + // If the package is on the /data partition, write the block map file + // into COMMAND_FILE instead. + if (filename.startsWith("/data/")) { + filename = "@/cache/recovery/block.map"; + } } final String filenameArg = "--update_package=" + filename; -- cgit v1.1 From ec2fc50d202d975447211012997fe425496c849c Mon Sep 17 00:00:00 2001 From: Paul Jensen Date: Fri, 15 Apr 2016 10:41:13 -0400 Subject: Don't pass URL path and username/password to PAC scripts The URL path could contain credentials that apps don't want exposed to a potentially malicious PAC script. Bug: 27593919 Change-Id: I4bb0362fc91f70ad47c4c7453d77d6f9a1e8eeed --- core/java/android/net/PacProxySelector.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/net/PacProxySelector.java b/core/java/android/net/PacProxySelector.java index 9bdf4f6..85bf79a 100644 --- a/core/java/android/net/PacProxySelector.java +++ b/core/java/android/net/PacProxySelector.java @@ -30,6 +30,7 @@ import java.net.Proxy.Type; import java.net.ProxySelector; import java.net.SocketAddress; import java.net.URI; +import java.net.URISyntaxException; import java.util.List; /** @@ -67,7 +68,15 @@ public class PacProxySelector extends ProxySelector { String response = null; String urlString; try { + // Strip path and username/password from URI so it's not visible to PAC script. The + // path often contains credentials the app does not want exposed to a potentially + // malicious PAC script. + if (!"http".equalsIgnoreCase(uri.getScheme())) { + uri = new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), "/", null, null); + } urlString = uri.toURL().toString(); + } catch (URISyntaxException e) { + urlString = uri.getHost(); } catch (MalformedURLException e) { urlString = uri.getHost(); } -- cgit v1.1 From aa238e9fd6c24f279eef6265f50636eb1eef1ece Mon Sep 17 00:00:00 2001 From: Michael W Date: Mon, 30 May 2016 22:50:45 +0200 Subject: Core: Fix OOB getExternal___Dir() relies on getExternal___Dirs to return an array of at least 1 element. Make sure there is at least one element returned. (Reference: BugDump 13-20160513-19 l#45 (FileManager) and L#104 (Gallery) BugDump 13-20160520-26 L#18 and more (26), just search for "getExternal" to find all cases of that OOB (>>100 users)) Change-Id: I56394db135c4c53c972e3bcc8f1df4ea1d4d39e7 --- core/java/android/app/ContextImpl.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index d443d80..6896c21 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -2018,6 +2018,11 @@ class ContextImpl extends Context { } result.add(dir); } + + // Make sure there is at least one element, let the callers handle that + if (result.size() == 0) { + result.add(null); + } return result.toArray(new File[result.size()]); } -- cgit v1.1 From 44e91e0ed2b3056e30ccfbb009be5f19495061ce Mon Sep 17 00:00:00 2001 From: Scott Mertz Date: Tue, 31 May 2016 17:28:29 -0700 Subject: fw: reintroduce PRIVATE_FLAG_PREVENT_POWER_KEY Switching the PREVENT_SYSTEM_KEYS forces the application to handle every system key. Some apps may not want to handle every single key, so allow them to just handle the power key. CYNGNOS-2958 Change-Id: I43fd65e67b909e6d52548f110ff9997b829b3e15 --- core/java/android/view/Window.java | 5 ++++- core/java/android/view/WindowManager.java | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 5811ef9..65577f0 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -869,7 +869,10 @@ public abstract class Window { } private void setPrivateFlags(int flags, int mask) { - if ((flags & mask & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_SYSTEM_KEYS) != 0){ + int preventFlags = WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_POWER_KEY | + WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_SYSTEM_KEYS; + + if ((flags & mask & preventFlags) != 0) { mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_SYSTEM_KEYS", "No permission to prevent system key"); } diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index c7a9650..36f593e 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1157,7 +1157,13 @@ public interface WindowManager extends ViewManager { * Window flag: Overrides default system key behavior. * {@hide} */ - public static final int PRIVATE_FLAG_PREVENT_SYSTEM_KEYS = 0x20000000; + public static final int PRIVATE_FLAG_PREVENT_SYSTEM_KEYS = 0x10000000; + + /** + * Window flag: Overrides default system key behavior. + * {@hide} + */ + public static final int PRIVATE_FLAG_PREVENT_POWER_KEY = 0x20000000; /** * Window flag: adding additional blur layer and set this as masking layer -- cgit v1.1 From ee43aa5034d92153204f55f3ac0f70af3a70844f Mon Sep 17 00:00:00 2001 From: Lars Greiss Date: Mon, 24 Nov 2014 23:45:41 +0100 Subject: Frameworks: Add per app controls for LP keyguard notifications (1/2) Nice done by google but the UX is a problem especially for ppl who are using a lot apps and just want to see from important apps the notifications on the lockscreen. This commit adds the ability to - enable/disable per app the keyguard notification at all - enable/disable per app ongoing notifications on the keyguard We handle this over the app policy conf file like the other per app notification options. CRACKLING-1127 Change-Id: Ib166db1b1673aeaea132c8eeb16c650d2f254a82 --- core/java/android/app/INotificationManager.aidl | 3 +++ core/java/android/app/Notification.java | 15 +++++++++++++++ core/java/android/app/NotificationManager.java | 11 +++++++++++ 3 files changed, 29 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index f78fb47..e749d0a 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -55,6 +55,9 @@ interface INotificationManager void setPackageVisibilityOverride(String pkg, int uid, int visibility); int getPackageVisibilityOverride(String pkg, int uid); + void setShowNotificationForPackageOnKeyguard(String pkg, int uid, int status); + int getShowNotificationForPackageOnKeyguard(String pkg, int uid); + // TODO: Remove this when callers have been migrated to the equivalent // INotificationListener method. StatusBarNotification[] getActiveNotifications(String callingPkg); diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index d8e01cd..8835a09 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -523,6 +523,21 @@ public class Notification implements Parcelable public int priority; /** + * Default. + * Show all notifications from an app on keyguard. + * + * @hide + */ + public static final int SHOW_ALL_NOTI_ON_KEYGUARD = 0x01; + + /** + * Show only notifications from an app which are not ongoing ones. + * + * @hide + */ + public static final int SHOW_NO_ONGOING_NOTI_ON_KEYGUARD = 0x02; + + /** * Accent color (an ARGB integer like the constants in {@link android.graphics.Color}) * to be applied by the standard Style templates when presenting this notification. * diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index 605c006..2219e64 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -19,6 +19,7 @@ package android.app; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SdkConstant; +import android.app.Notification; import android.app.Notification.Builder; import android.content.ComponentName; import android.content.Context; @@ -512,6 +513,16 @@ public class NotificationManager return new ArraySet(); } + /** @hide */ + public int getShowNotificationForPackageOnKeyguard(String pkg, int uid) { + INotificationManager service = getService(); + try { + return getService().getShowNotificationForPackageOnKeyguard(pkg, uid); + } catch (RemoteException e) { + return Notification.SHOW_ALL_NOTI_ON_KEYGUARD; + } + } + private Context mContext; private static void checkRequired(String name, Object value) { -- cgit v1.1 From e7cf91a198de995c7440b3b64352effd2e309906 Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Mon, 13 Jun 2016 15:17:54 -0700 Subject: Don't trust callers to supply app info to bindBackupAgent() Get the canonical identity and metadata about the package from the Package Manager at time of usage rather than rely on the caller to have gotten things right, even when the caller has the system uid. Bug 28795098 Change-Id: I215786bc894dedf7ca28e9c80cefabd0e40ca877 Merge conflict resolution for ag/1133474 (referencing ag/1148862) - directly to mnc-mr2-release --- core/java/android/app/ActivityManagerNative.java | 10 ++++++---- core/java/android/app/IActivityManager.java | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index f6e0735..b9d2595 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -1582,9 +1582,10 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM case START_BACKUP_AGENT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); - ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data); + String packageName = data.readString(); int backupRestoreMode = data.readInt(); - boolean success = bindBackupAgent(info, backupRestoreMode); + int userId = data.readInt(); + boolean success = bindBackupAgent(packageName, backupRestoreMode, userId); reply.writeNoException(); reply.writeInt(success ? 1 : 0); return true; @@ -3831,13 +3832,14 @@ class ActivityManagerProxy implements IActivityManager return binder; } - public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode) + public boolean bindBackupAgent(String packageName, int backupRestoreMode, int userId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); - app.writeToParcel(data, 0); + data.writeString(packageName); data.writeInt(backupRestoreMode); + data.writeInt(userId); mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0); reply.readException(); boolean success = reply.readInt() != 0; diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index ef121ce..5ed839e 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -182,7 +182,7 @@ public interface IActivityManager extends IInterface { public IBinder peekService(Intent service, String resolvedType, String callingPackage) throws RemoteException; - public boolean bindBackupAgent(ApplicationInfo appInfo, int backupRestoreMode) + public boolean bindBackupAgent(String packageName, int backupRestoreMode, int userId) throws RemoteException; public void clearPendingBackup() throws RemoteException; public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException; -- cgit v1.1 From a75537b496e9df71c74c1d045ba5569631a16298 Mon Sep 17 00:00:00 2001 From: Todd Kennedy Date: Mon, 4 Apr 2016 12:29:59 -0700 Subject: DO NOT MERGE Fix intent filter priorities Since this is a backport, there is only one rule that guards intent filter priorities: 1) Updates will NOT be granted a priority greater than the priority defined on the system image. Bug: 27450489 Change-Id: Ifcec4d7a59e684331399abc41eea1bd6876155a4 --- core/java/android/content/IntentFilter.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'core/java/android') diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java index 3a17e23..ed5dfa5 100644 --- a/core/java/android/content/IntentFilter.java +++ b/core/java/android/content/IntentFilter.java @@ -883,6 +883,15 @@ public class IntentFilter implements Parcelable { return true; } + @Override + public boolean equals(Object obj) { + if (obj instanceof AuthorityEntry) { + final AuthorityEntry other = (AuthorityEntry)obj; + return match(other); + } + return false; + } + /** * Determine whether this AuthorityEntry matches the given data Uri. * Note that this comparison is case-sensitive, unlike formal @@ -917,7 +926,7 @@ public class IntentFilter implements Parcelable { } return MATCH_CATEGORY_HOST; } - }; + } /** * Add a new Intent data "scheme specific part" to match against. The filter must -- cgit v1.1 From c76766953ebabd327f5ddc8410bfcdbc09e77b25 Mon Sep 17 00:00:00 2001 From: Danesh M Date: Fri, 17 Jun 2016 15:13:27 -0700 Subject: WindowAnimator : Check KEYGUARD_PANEL when deciding to show/hide window By default, if blur is enabled we don't hide the window behind since we want the user to see it. This is not true for when a KEYGUARD_PANEL is active since we can't see anything behind it anyway. Only apply blur logic if KEYGUARD_PANEL is not added. CYNGNOS-2980 Change-Id: Icecae14455d6e68665bb688e3f6dc4ea9d74e88c --- core/java/android/view/WindowManagerPolicy.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index c1d0ecb..d19096b 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -665,6 +665,11 @@ public interface WindowManagerPolicy { public WindowState getWinShowWhenLockedLw(); /** + * Returns the current keyguard panel, if such a thing exists. + */ + public WindowState getWinKeyguardPanelLw(); + + /** * Called when the system would like to show a UI to indicate that an * application is starting. You can use this to add a * APPLICATION_STARTING_TYPE window with the given appToken to the window -- cgit v1.1 From 396b4c2c2804e75e2eb556dade5c8904f219fbb9 Mon Sep 17 00:00:00 2001 From: Gurpreet Ghai Date: Mon, 18 Apr 2016 19:05:28 +0530 Subject: BT: Set persiste Bluetooth State during enable timeout case Use case: When enable timeout occurs during S&S testing and Bluetooth state is moved from Turning On to Off. Steps: Changes related to enable timeout case, to test the changes, S&S testing can be done. Failure: Changes done to handle Bluetooth enable timeout case when Bluetooth state changes from Turning On to Off. Root cause: Setting Bluetooth Persist state to handle the enable timeout case so that Bluetooth doesnot self enable after enable timeout case is handled. Fix: Setting the Bluetooth Persist State to Off when enable timeout occurs. Change-Id: I17b3b05020eb7469666e6d8c88c86df7764b4024 CRs-Fixed: 1006444 --- core/java/android/bluetooth/BluetoothAdapter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/java/android') diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index f924bc1..71183d9 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -2067,13 +2067,14 @@ public final class BluetoothAdapter { } public void onBluetoothServiceDown() { - if (VDBG) Log.d(TAG, "onBluetoothServiceDown: " + mService); + Log.d(TAG, "onBluetoothServiceDown: " + mService); synchronized (mManagerCallback) { mService = null; if (mLeScanClients != null) mLeScanClients.clear(); if (sBluetoothLeAdvertiser != null) sBluetoothLeAdvertiser.cleanup(); if (sBluetoothLeScanner != null) sBluetoothLeScanner.cleanup(); synchronized (mProxyServiceStateCallbacks) { + Log.d(TAG, "onBluetoothServiceDown: Sending callbacks to " + mProxyServiceStateCallbacks.size() + " clients"); for (IBluetoothManagerCallback cb : mProxyServiceStateCallbacks ){ try { if (cb != null) { @@ -2085,6 +2086,7 @@ public final class BluetoothAdapter { } } } + Log.d(TAG, "onBluetoothServiceDown: Finished sending callbacks to registered clients"); } public void onBrEdrDown() { -- cgit v1.1 From d8d4e7c567872fa4596c2f63c85092a90b36a6b3 Mon Sep 17 00:00:00 2001 From: Roman Birg Date: Tue, 19 Jul 2016 12:37:33 -0700 Subject: PackageManager: make protected-broadcasts permission aware This extends the mechanism to allow protecting actions based on a permission for system apps. For instance: will restrict intents with action "ACTION_A" to be only sent with apps holding the "PERMISSION_X" permission. Note that system UIDs will bypass the permission check and always be allowed, just like the normal protected-broadcast mechanism. You must still be a system application to delcare a protected broadcast. Change-Id: Id25cffd233d400800dcb5249c5f487134e1b4152 Signed-off-by: Roman Birg --- core/java/android/content/pm/IPackageManager.aidl | 3 +++ core/java/android/content/pm/PackageParser.java | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index a3329db..51f13af 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -523,4 +523,7 @@ interface IPackageManager { /** Protected Apps */ boolean isComponentProtected(in String callingPackage, in int callingUid, in ComponentName componentName, int userId); + + /** protected broadcast ext */ + boolean isProtectedBroadcastAllowed(in String actionName, in int callingUid); } diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 6a07b31..bb46ef0 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -1877,14 +1877,18 @@ public class PackageParser { String name = sa.getNonResourceString( com.android.internal.R.styleable.AndroidManifestProtectedBroadcast_name); + String permission = sa.getNonResourceString( + com.android.internal.R.styleable.AndroidManifestProtectedBroadcast_permission); + sa.recycle(); if (name != null && (flags&PARSE_IS_SYSTEM) != 0) { if (pkg.protectedBroadcasts == null) { - pkg.protectedBroadcasts = new ArrayList(); + pkg.protectedBroadcasts = new ArrayMap<>(); } - if (!pkg.protectedBroadcasts.contains(name)) { - pkg.protectedBroadcasts.add(name.intern()); + if (!pkg.protectedBroadcasts.containsKey(name)) { + pkg.protectedBroadcasts.put(name.intern(), + permission != null ? permission.intern() : null); } } @@ -4519,7 +4523,10 @@ public class PackageParser { public final ArrayList requestedPermissions = new ArrayList(); - public ArrayList protectedBroadcasts; + /** + * Maps from package -> permission, null for system (default behavior) + */ + public ArrayMap protectedBroadcasts; public ArrayList libraryNames = null; public ArrayList usesLibraries = null; -- cgit v1.1 From 75c84499bde3e8e0555cd9fda1cde5d758a8b8d4 Mon Sep 17 00:00:00 2001 From: Scott Mertz Date: Mon, 25 Jul 2016 11:13:15 -0700 Subject: Factory reset: Wipe media by default These hidden APIs are called from some public APIs (DevicePolicyManager), so we shouldn't change the default behavior. The intent API should also be considered public, so change that as well. FEIJ-1610 Change-Id: Ib9591c122dbe6168e7e237444c754b9608be0953 --- core/java/android/os/RecoverySystem.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index a10b1ec..d277e65 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -377,18 +377,18 @@ public class RecoverySystem { * @throws SecurityException if the current user is not allowed to wipe data. */ public static void rebootWipeUserData(Context context) throws IOException { - rebootWipeUserData(context, false, context.getPackageName(), false); + rebootWipeUserData(context, false, context.getPackageName(), true); } /** {@hide} */ public static void rebootWipeUserData(Context context, String reason) throws IOException { - rebootWipeUserData(context, false, reason, false); + rebootWipeUserData(context, false, reason, true); } /** {@hide} */ public static void rebootWipeUserData(Context context, boolean shutdown) throws IOException { - rebootWipeUserData(context, shutdown, context.getPackageName(), false); + rebootWipeUserData(context, shutdown, context.getPackageName(), true); } /** -- cgit v1.1 From a92b91d7966350ad37f5c60586e5ccb9abc696be Mon Sep 17 00:00:00 2001 From: Scott Mertz Date: Thu, 4 Aug 2016 15:17:01 -0700 Subject: fw: enforce android.permission.PREVENT_SYSTEM_KEYS in system server Since privateFlags can be accessed and modified via reflection due to change 5d927c2d8e, the prevent system keys or prevent power keys flag can be set and deployed without ever calling setPrivateFlags directly. Move enforcing to system server to prevent app tampering. TICKET: CYAN-7921 (open source JIRA) Found by Maciej Krysztofiak Change-Id: I53c2804d0283692036f5cc95e6ad57821bc0655a --- core/java/android/view/Window.java | 7 ------- 1 file changed, 7 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 65577f0..50a926f 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -869,13 +869,6 @@ public abstract class Window { } private void setPrivateFlags(int flags, int mask) { - int preventFlags = WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_POWER_KEY | - WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_SYSTEM_KEYS; - - if ((flags & mask & preventFlags) != 0) { - mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_SYSTEM_KEYS", - "No permission to prevent system key"); - } final WindowManager.LayoutParams attrs = getAttributes(); attrs.privateFlags = (attrs.privateFlags & ~mask) | (flags & mask); dispatchWindowAttributesChanged(attrs); -- cgit v1.1 From 4910bb1c785d7ec748f185f902ddd750dcb9dfcb Mon Sep 17 00:00:00 2001 From: Bharadwaj Narasimha Date: Mon, 8 Aug 2016 11:43:00 -0700 Subject: IconPackHelper:Use un-tinted iconback when no defaultSwatchcolor is specified After applying the theme which supports paletteback feature and if there is no defaultSwatchColor specified then the background should go to the original color. Instead in a particular FootballDemo theme the theme would never get applied and just flood the logcat with null exceptions for each and every app. TICKET:CYNGNOS-2942 Change-Id: If2bd3d23ab5075dac1d8ff3f197cebc28c9c1f20 --- core/java/android/app/ComposedIconInfo.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/app/ComposedIconInfo.java b/core/java/android/app/ComposedIconInfo.java index f49c230..71321c1 100644 --- a/core/java/android/app/ComposedIconInfo.java +++ b/core/java/android/app/ComposedIconInfo.java @@ -74,11 +74,9 @@ public class ComposedIconInfo implements Parcelable { iconPaletteBack = source.readInt(); swatchType = SwatchType.values()[source.readInt()]; int numDefaultColors = source.readInt(); - if (numDefaultColors > 0) { - defaultSwatchColors = new int[numDefaultColors]; - for (int i = 0; i < numDefaultColors; i++) { - defaultSwatchColors[i] = source.readInt(); - } + defaultSwatchColors = new int[numDefaultColors]; + for (int i = 0; i < numDefaultColors; i++) { + defaultSwatchColors[i] = source.readInt(); } } -- cgit v1.1 From 59350eaf491df7cac496a38443e9d3fb8b715137 Mon Sep 17 00:00:00 2001 From: Alexander Martinz Date: Thu, 28 Jul 2016 13:57:44 +0200 Subject: [2/2] base: cm custom boot dexopt UI * Pass app info and number of installed packages to boot message UI * Ui by Asher and Joey, based on Alexander's previous work Change-Id: I9ec9d0cb0e20a9bac73e126f6b6f3965400f05e7 --- core/java/android/app/ActivityManagerNative.java | 19 +++++++++++++------ core/java/android/app/IActivityManager.java | 10 ++++++++-- core/java/android/view/WindowManagerPolicy.java | 6 ++++-- 3 files changed, 25 insertions(+), 10 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index bfd6b5a..544331f 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -2097,11 +2097,14 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } - case SHOW_BOOT_MESSAGE_TRANSACTION: { + case UPDATE_BOOT_PROGRESS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); - CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); + int stage = data.readInt(); + ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data); + int current = data.readInt(); + int total = data.readInt(); boolean always = data.readInt() != 0; - showBootMessage(msg, always); + updateBootProgress(stage, info, current, total, always); reply.writeNoException(); return true; } @@ -5285,13 +5288,17 @@ class ActivityManagerProxy implements IActivityManager return res; } - public void showBootMessage(CharSequence msg, boolean always) throws RemoteException { + public void updateBootProgress(int stage, ApplicationInfo optimizedApp, + int currentAppPos, int totalAppCount, boolean always) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); - TextUtils.writeToParcel(msg, data, 0); + data.writeInt(stage); + optimizedApp.writeToParcel(data, 0); + data.writeInt(currentAppPos); + data.writeInt(totalAppCount); data.writeInt(always ? 1 : 0); - mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0); + mRemote.transact(UPDATE_BOOT_PROGRESS_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); reply.recycle(); diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 7221e47..75951cf 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -408,7 +408,8 @@ public interface IActivityManager extends IInterface { public long[] getProcessPss(int[] pids) throws RemoteException; - public void showBootMessage(CharSequence msg, boolean always) throws RemoteException; + public void updateBootProgress(int stage, ApplicationInfo optimizedApp, + int currentAppPos, int totalAppCount, boolean always) throws RemoteException; public void keyguardWaitingForActivityDrawn() throws RemoteException; @@ -622,6 +623,11 @@ public interface IActivityManager extends IInterface { } } + public static final int BOOT_STAGE_STARTING_APPS = 1; + public static final int BOOT_STAGE_FSTRIM = 2; + public static final int BOOT_STAGE_PREPARING_APPS = 3; + public static final int BOOT_STAGE_COMPLETE = 4; + String descriptor = "android.app.IActivityManager"; // Please keep these transaction codes the same -- they are also @@ -757,7 +763,7 @@ public interface IActivityManager extends IInterface { int IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+134; int UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+135; int GET_PROCESS_PSS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+136; - int SHOW_BOOT_MESSAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+137; + int UPDATE_BOOT_PROGRESS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+137; int KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+139; int GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+140; int REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+141; diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index d19096b..9d7c741 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -20,6 +20,7 @@ import android.annotation.IntDef; import android.annotation.SystemApi; import android.content.Context; import android.content.pm.ActivityInfo; +import android.content.pm.ApplicationInfo; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.graphics.Rect; @@ -1171,9 +1172,10 @@ public interface WindowManagerPolicy { public void systemBooted(); /** - * Show boot time message to the user. + * Update UI for boot-up progress. */ - public void showBootMessage(final CharSequence msg, final boolean always); + public void updateBootProgress(final int stage, final ApplicationInfo optimizedApp, + final int currentAppPos, final int totalAppCount); /** * Hide the UI for showing boot messages, never to be displayed again. -- cgit v1.1 From a1e18814d23f36c0ec970d6e04de3dbc1214d53d Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Tue, 9 Aug 2016 17:00:25 +0100 Subject: Process: Fix communication with zygote. Don't write partial requests, and don't return (or throw) early after partially reading a response. bug: 30143607 (cherry-picked from commit 448be0a62209c977593d81617853a8a428d013df) Change-Id: I5881fdd5e81023cd21fb4d23a471a5031987a1f1 (cherry picked from commit e29c6493c07acf1a0b706917e9af0c8d761c8ae9) --- core/java/android/os/Process.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index 7234e98..e0a0fd0 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -538,6 +538,15 @@ public class Process { ZygoteState zygoteState, ArrayList args) throws ZygoteStartFailedEx { try { + // Throw early if any of the arguments are malformed. This means we can + // avoid writing a partial response to the zygote. + int sz = args.size(); + for (int i = 0; i < sz; i++) { + if (args.get(i).indexOf('\n') >= 0) { + throw new ZygoteStartFailedEx("embedded newlines not allowed"); + } + } + /** * See com.android.internal.os.ZygoteInit.readArgumentList() * Presently the wire format to the zygote process is: @@ -554,13 +563,8 @@ public class Process { writer.write(Integer.toString(args.size())); writer.newLine(); - int sz = args.size(); for (int i = 0; i < sz; i++) { String arg = args.get(i); - if (arg.indexOf('\n') >= 0) { - throw new ZygoteStartFailedEx( - "embedded newlines not allowed"); - } writer.write(arg); writer.newLine(); } @@ -569,11 +573,16 @@ public class Process { // Should there be a timeout on this? ProcessStartResult result = new ProcessStartResult(); + + // Always read the entire result from the input stream to avoid leaving + // bytes in the stream for future process starts to accidentally stumble + // upon. result.pid = inputStream.readInt(); + result.usingWrapper = inputStream.readBoolean(); + if (result.pid < 0) { throw new ZygoteStartFailedEx("fork() failed"); } - result.usingWrapper = inputStream.readBoolean(); return result; } catch (IOException ex) { zygoteState.close(); -- cgit v1.1 From ca692c228dfef0b0d7f51597e726180d3f70c66c Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Thu, 18 Aug 2016 20:22:33 -0700 Subject: Bind fingerprint when we start authentication - DO NOT MERGE This fixes a bug where it was possible to authenticate the wrong user. We now bind the userId when we start authentication and confirm it when authentication completes. Fixes bug 30744668 Change-Id: I346d92c301414ed81e11fa9c171584c7ae4341c2 (cherry picked from commit b6f4b48df273d210d13631b4c2426482feb40c97) --- .../hardware/fingerprint/FingerprintManager.java | 21 +++++++++++++++------ .../fingerprint/IFingerprintServiceReceiver.aidl | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java index 122df23..62396a3 100644 --- a/core/java/android/hardware/fingerprint/FingerprintManager.java +++ b/core/java/android/hardware/fingerprint/FingerprintManager.java @@ -258,6 +258,7 @@ public class FingerprintManager { public static class AuthenticationResult { private Fingerprint mFingerprint; private CryptoObject mCryptoObject; + private int mUserId; /** * Authentication result @@ -266,9 +267,10 @@ public class FingerprintManager { * @param fingerprint the recognized fingerprint data, if allowed. * @hide */ - public AuthenticationResult(CryptoObject crypto, Fingerprint fingerprint) { + public AuthenticationResult(CryptoObject crypto, Fingerprint fingerprint, int userId) { mCryptoObject = crypto; mFingerprint = fingerprint; + mUserId = userId; } /** @@ -285,6 +287,12 @@ public class FingerprintManager { * @hide */ public Fingerprint getFingerprint() { return mFingerprint; } + + /** + * Obtain the userId for which this fingerprint was authenticated. + * @hide + */ + public int getUserId() { return mUserId; } }; /** @@ -754,7 +762,7 @@ public class FingerprintManager { sendAcquiredResult((Long) msg.obj /* deviceId */, msg.arg1 /* acquire info */); break; case MSG_AUTHENTICATION_SUCCEEDED: - sendAuthenticatedSucceeded((Fingerprint) msg.obj); + sendAuthenticatedSucceeded((Fingerprint) msg.obj, msg.arg1 /* userId */); break; case MSG_AUTHENTICATION_FAILED: sendAuthenticatedFailed(); @@ -799,9 +807,10 @@ public class FingerprintManager { } } - private void sendAuthenticatedSucceeded(Fingerprint fp) { + private void sendAuthenticatedSucceeded(Fingerprint fp, int userId) { if (mAuthenticationCallback != null) { - final AuthenticationResult result = new AuthenticationResult(mCryptoObject, fp); + final AuthenticationResult result = + new AuthenticationResult(mCryptoObject, fp, userId); mAuthenticationCallback.onAuthenticationSucceeded(result); } } @@ -941,8 +950,8 @@ public class FingerprintManager { } @Override // binder call - public void onAuthenticationSucceeded(long deviceId, Fingerprint fp) { - mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, fp).sendToTarget(); + public void onAuthenticationSucceeded(long deviceId, Fingerprint fp, int userId) { + mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, userId, 0, fp).sendToTarget(); } @Override // binder call diff --git a/core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl b/core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl index 57a429f..b024b29 100644 --- a/core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl +++ b/core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl @@ -26,7 +26,7 @@ import android.os.UserHandle; oneway interface IFingerprintServiceReceiver { void onEnrollResult(long deviceId, int fingerId, int groupId, int remaining); void onAcquired(long deviceId, int acquiredInfo); - void onAuthenticationSucceeded(long deviceId, in Fingerprint fp); + void onAuthenticationSucceeded(long deviceId, in Fingerprint fp, int userId); void onAuthenticationFailed(long deviceId); void onError(long deviceId, int error); void onRemoved(long deviceId, int fingerId, int groupId); -- cgit v1.1 From a08dfe9f35f032bd015e05ca305dc58c9c10651d Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Tue, 9 Aug 2016 17:00:25 +0100 Subject: Process: Fix communication with zygote. Don't write partial requests, and don't return (or throw) early after partially reading a response. bug: 30143607 (cherry-picked from commit 448be0a62209c977593d81617853a8a428d013df) Change-Id: I5881fdd5e81023cd21fb4d23a471a5031987a1f1 (cherry picked from commit e29c6493c07acf1a0b706917e9af0c8d761c8ae9) --- core/java/android/os/Process.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index 7234e98..e0a0fd0 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -538,6 +538,15 @@ public class Process { ZygoteState zygoteState, ArrayList args) throws ZygoteStartFailedEx { try { + // Throw early if any of the arguments are malformed. This means we can + // avoid writing a partial response to the zygote. + int sz = args.size(); + for (int i = 0; i < sz; i++) { + if (args.get(i).indexOf('\n') >= 0) { + throw new ZygoteStartFailedEx("embedded newlines not allowed"); + } + } + /** * See com.android.internal.os.ZygoteInit.readArgumentList() * Presently the wire format to the zygote process is: @@ -554,13 +563,8 @@ public class Process { writer.write(Integer.toString(args.size())); writer.newLine(); - int sz = args.size(); for (int i = 0; i < sz; i++) { String arg = args.get(i); - if (arg.indexOf('\n') >= 0) { - throw new ZygoteStartFailedEx( - "embedded newlines not allowed"); - } writer.write(arg); writer.newLine(); } @@ -569,11 +573,16 @@ public class Process { // Should there be a timeout on this? ProcessStartResult result = new ProcessStartResult(); + + // Always read the entire result from the input stream to avoid leaving + // bytes in the stream for future process starts to accidentally stumble + // upon. result.pid = inputStream.readInt(); + result.usingWrapper = inputStream.readBoolean(); + if (result.pid < 0) { throw new ZygoteStartFailedEx("fork() failed"); } - result.usingWrapper = inputStream.readBoolean(); return result; } catch (IOException ex) { zygoteState.close(); -- cgit v1.1 From 3d2b855e53776b4406e1fb01f6198be89c9f8114 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Thu, 18 Aug 2016 20:22:33 -0700 Subject: Bind fingerprint when we start authentication - DO NOT MERGE This fixes a bug where it was possible to authenticate the wrong user. We now bind the userId when we start authentication and confirm it when authentication completes. Fixes bug 30744668 Change-Id: I346d92c301414ed81e11fa9c171584c7ae4341c2 (cherry picked from commit b6f4b48df273d210d13631b4c2426482feb40c97) --- .../hardware/fingerprint/FingerprintManager.java | 21 +++++++++++++++------ .../fingerprint/IFingerprintServiceReceiver.aidl | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java index 122df23..62396a3 100644 --- a/core/java/android/hardware/fingerprint/FingerprintManager.java +++ b/core/java/android/hardware/fingerprint/FingerprintManager.java @@ -258,6 +258,7 @@ public class FingerprintManager { public static class AuthenticationResult { private Fingerprint mFingerprint; private CryptoObject mCryptoObject; + private int mUserId; /** * Authentication result @@ -266,9 +267,10 @@ public class FingerprintManager { * @param fingerprint the recognized fingerprint data, if allowed. * @hide */ - public AuthenticationResult(CryptoObject crypto, Fingerprint fingerprint) { + public AuthenticationResult(CryptoObject crypto, Fingerprint fingerprint, int userId) { mCryptoObject = crypto; mFingerprint = fingerprint; + mUserId = userId; } /** @@ -285,6 +287,12 @@ public class FingerprintManager { * @hide */ public Fingerprint getFingerprint() { return mFingerprint; } + + /** + * Obtain the userId for which this fingerprint was authenticated. + * @hide + */ + public int getUserId() { return mUserId; } }; /** @@ -754,7 +762,7 @@ public class FingerprintManager { sendAcquiredResult((Long) msg.obj /* deviceId */, msg.arg1 /* acquire info */); break; case MSG_AUTHENTICATION_SUCCEEDED: - sendAuthenticatedSucceeded((Fingerprint) msg.obj); + sendAuthenticatedSucceeded((Fingerprint) msg.obj, msg.arg1 /* userId */); break; case MSG_AUTHENTICATION_FAILED: sendAuthenticatedFailed(); @@ -799,9 +807,10 @@ public class FingerprintManager { } } - private void sendAuthenticatedSucceeded(Fingerprint fp) { + private void sendAuthenticatedSucceeded(Fingerprint fp, int userId) { if (mAuthenticationCallback != null) { - final AuthenticationResult result = new AuthenticationResult(mCryptoObject, fp); + final AuthenticationResult result = + new AuthenticationResult(mCryptoObject, fp, userId); mAuthenticationCallback.onAuthenticationSucceeded(result); } } @@ -941,8 +950,8 @@ public class FingerprintManager { } @Override // binder call - public void onAuthenticationSucceeded(long deviceId, Fingerprint fp) { - mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, fp).sendToTarget(); + public void onAuthenticationSucceeded(long deviceId, Fingerprint fp, int userId) { + mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, userId, 0, fp).sendToTarget(); } @Override // binder call diff --git a/core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl b/core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl index 57a429f..b024b29 100644 --- a/core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl +++ b/core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl @@ -26,7 +26,7 @@ import android.os.UserHandle; oneway interface IFingerprintServiceReceiver { void onEnrollResult(long deviceId, int fingerId, int groupId, int remaining); void onAcquired(long deviceId, int acquiredInfo); - void onAuthenticationSucceeded(long deviceId, in Fingerprint fp); + void onAuthenticationSucceeded(long deviceId, in Fingerprint fp, int userId); void onAuthenticationFailed(long deviceId); void onError(long deviceId, int error); void onRemoved(long deviceId, int fingerId, int groupId); -- cgit v1.1 From 26f6eb78a61323cb2cae055ee0cee62c95a8f85e Mon Sep 17 00:00:00 2001 From: Marie Janssen Date: Tue, 9 Aug 2016 13:23:39 -0700 Subject: Fix setPairingConfirmation permissions issue (2/2) setPairingConfirmation was set to only require BLUETOOTH_ADMIN permission which shouldn't be able to set the confirmation itself. This is restricted to BLUETOOTH_PRIVILEGED permission. Bug: 29043989 Change-Id: I887de32d156e672ec44aa0b286cd7ea7f9f8ad55 (cherry picked from commit 93326cfd9fb8a20081baa9b975275772798cfd80) --- core/java/android/bluetooth/BluetoothDevice.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index d27dfa0..f7e2504 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -1153,12 +1153,12 @@ public final class BluetoothDevice implements Parcelable { /** * Confirm passkey for {@link #PAIRING_VARIANT_PASSKEY_CONFIRMATION} pairing. - *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}. + *

Requires {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}. * * @return true confirmation has been sent out * false for error */ - @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setPairingConfirmation(boolean confirm) { if (sService == null) { Log.e(TAG, "BT not enabled. Cannot set pairing confirmation"); -- cgit v1.1 From f653d365122f0cebc92ac7bb0af805cc4d80f638 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Fri, 16 Sep 2016 16:57:34 -0600 Subject: Merge commit '0a9d537f623b2c11dce707fb9b91fea016fd0e9f' into manual_merge_0a9d537 Change-Id: Ib1a0bbb34edb61666ac5739f0b0eaadbe4c5fe06 --- core/java/android/app/DownloadManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java index fb0e79b..12c851b 100644 --- a/core/java/android/app/DownloadManager.java +++ b/core/java/android/app/DownloadManager.java @@ -1030,7 +1030,7 @@ public class DownloadManager { if (cursor.moveToFirst()) { int status = cursor.getInt(cursor.getColumnIndexOrThrow(COLUMN_STATUS)); if (DownloadManager.STATUS_SUCCESSFUL == status) { - return ContentUris.withAppendedId(Downloads.Impl.CONTENT_URI, id); + return ContentUris.withAppendedId(Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI, id); } } } finally { @@ -1227,7 +1227,7 @@ public class DownloadManager { * @hide */ public Uri getDownloadUri(long id) { - return ContentUris.withAppendedId(mBaseUri, id); + return ContentUris.withAppendedId(Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI, id); } /** @@ -1308,7 +1308,7 @@ public class DownloadManager { // return content URI for cache download long downloadId = getLong(getColumnIndex(Downloads.Impl._ID)); - return ContentUris.withAppendedId(mBaseUri, downloadId).toString(); + return ContentUris.withAppendedId(Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI, downloadId).toString(); } private long getReason(int status) { -- cgit v1.1 From e05eda22dd6d2e4834b5ff2b364d4258ad590f3e Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Mon, 17 Oct 2016 16:39:46 +0200 Subject: (Optionally) allow vibration during priority zen mode. Change-Id: I6fb81c5898fbfe9e89a4af3fdc042266c8a9be6c --- core/java/android/app/INotificationManager.aidl | 2 +- core/java/android/app/NotificationManager.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index e749d0a..7c51a83 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -80,7 +80,7 @@ interface INotificationManager void setInterruptionFilter(String pkg, int interruptionFilter); ComponentName getEffectsSuppressor(); - boolean matchesCallFilter(in Bundle extras); + boolean[] matchesCallFilter(in Bundle extras); boolean isSystemConditionProviderEnabled(String path); int getZenMode(); diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index 2219e64..d84eee2 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -341,12 +341,12 @@ public class NotificationManager /** * @hide */ - public boolean matchesCallFilter(Bundle extras) { + public boolean[] matchesCallFilter(Bundle extras) { INotificationManager service = getService(); try { return service.matchesCallFilter(extras); } catch (RemoteException e) { - return false; + return null; } } -- cgit v1.1 From ac7b58ec1c8b07537960bfafe40e31ddc9a94719 Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Wed, 19 Oct 2016 13:38:06 +0200 Subject: Support enforcing a minimum delay between notification sounds of an app. Useful e.g. for messenger apps. Change-Id: If8e8cc9e2f02d70537c1f9dc14f22bbd0ec1e9a6 --- core/java/android/app/INotificationManager.aidl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index 7c51a83..59ff413 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -58,6 +58,9 @@ interface INotificationManager void setShowNotificationForPackageOnKeyguard(String pkg, int uid, int status); int getShowNotificationForPackageOnKeyguard(String pkg, int uid); + void setPackageNotificationSoundTimeout(String pkg, int uid, long timeout); + long getPackageNotificationSoundTimeout(String pkg, int uid); + // TODO: Remove this when callers have been migrated to the equivalent // INotificationListener method. StatusBarNotification[] getActiveNotifications(String callingPkg); -- cgit v1.1 From c15736bb1034f8aca5429ca336a2ab7126fe7a57 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Thu, 10 Nov 2016 12:15:00 +0000 Subject: NotificationManager: Concentrate LED light capabilities at a single location We had(have) a bunch of individual boolean toggles for various LED behaviors and combinations, which end up getting used as a similarly sprawling bunch of getResource() calls across various locations. And they keep piling up... So... create a new overlayable array of LED capabilities (config_deviceLightCapabilities) where we can throw everything (and expand in the future). Also, create a helper to abstract usage of the old (multi-resource) and new (single resource array) formats to avoid breaking any deployed devices. Change-Id: I7d627914b058861048071fc15776031c4152157f --- core/java/android/app/INotificationManager.aidl | 2 ++ core/java/android/app/NotificationManager.java | 28 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index 59ff413..06c064f 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -103,4 +103,6 @@ interface INotificationManager void applyRestore(in byte[] payload, int user); ParceledListSlice getAppActiveNotifications(String callingPkg, int userId); + + boolean deviceLightsCan(int lightCapability); } diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index d84eee2..eae2599 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -765,4 +765,32 @@ public class NotificationManager default: return defValue; } } + + /** @hide */ + public static final int LIGHTS_RGB_NOTIFICATION = 0; + /** @hide */ + public static final int LIGHTS_RGB_BATTERY = 1 ; + /** @hide */ + public static final int LIGHTS_MULTIPLE_LED = 2; + /** @hide */ + public static final int LIGHTS_LED_PULSE = 3; + /** @hide */ + public static final int LIGHTS_SEGMENTED_BATTERY_LIGHTS = 4; + /** @hide */ + public static final int LIGHTS_ADJUSTABLE_NOTIFICATION_BRIGHTNESS = 5; + + /** @hide */ + public boolean deviceLightsCan(int lightCapability) { + INotificationManager service = getService(); + try { + return service.deviceLightsCan(lightCapability); + } catch (RemoteException e) { + return true; + } catch (NullPointerException e) { + return true; + } + // If the service isn't up yet, assume everything is possible + } + + } -- cgit v1.1 From 73406be5362100576dae362f218b624065bb9c57 Mon Sep 17 00:00:00 2001 From: Pragnya Paramita Date: Mon, 30 Nov 2015 19:51:56 +0530 Subject: frameworks/base: Addition of Changes for ZeroBalance feature --Addition of code to receive broadcast from ZeroBalanceHelper application for executing command to write block/unblock rule to Iptable. --Addition of ZeroBalanceHelper file to be accesible by other modules to notify ZeroBalanceHelper application about update on change of SIM balance. --Addition of rule to allow browser uid when rest all applications are in blocked state. --Addition of feature flag to control the zerobalance feature. CRs-Fixed: 927258 Change-Id: Ifdf4c46fd63ab78193047a9bc8b62bf41065a665 --- core/java/android/net/ZeroBalanceHelper.java | 99 ++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 core/java/android/net/ZeroBalanceHelper.java (limited to 'core/java/android') diff --git a/core/java/android/net/ZeroBalanceHelper.java b/core/java/android/net/ZeroBalanceHelper.java new file mode 100644 index 0000000..e0ffca5 --- /dev/null +++ b/core/java/android/net/ZeroBalanceHelper.java @@ -0,0 +1,99 @@ +/* + ** Copyright (c) 2015, The Linux Foundation. All rights reserved. + + ** Redistribution and use in source and binary forms, with or without + ** modification, are permitted provided that the following conditions are + ** met: + ** * Redistributions of source code must retain the above copyright + ** notice, this list of conditions and the following disclaimer. + ** * Redistributions in binary form must reproduce the above + ** copyright notice, this list of conditions and the following + ** disclaimer in the documentation and/or other materials provided + ** with the distribution. + ** * Neither the name of The Linux Foundation nor the names of its + ** contributors may be used to endorse or promote products derived + ** from this software without specific prior written permission. + + ** THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + ** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + ** BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + ** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + ** OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + ** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package android.net; + +import android.app.ActivityThread; +import android.content.Context; +import android.content.Intent; +import android.os.SystemProperties; +import android.os.UserHandle; +import android.util.Log; + +import com.android.internal.R; + +/** @hide */ +public final class ZeroBalanceHelper { + + public static final String BACKGROUND_DATA_PROPERTY = "sys.background.data.disable"; + public static final String BACKGROUND_DATA_BROADCAST = "org.codeaurora.background.data"; + public static final String TAG = "ZeroBalance"; + + private static int sRedirectCount = 0; + private static int sRedirectMaxCount = 3; + + private Context mContext = null; + + public ZeroBalanceHelper() { + mContext = ActivityThread.currentApplication(); + } + + public void setBgDataProperty(String enabled) { + Intent intent = new Intent(); + intent.setAction(BACKGROUND_DATA_BROADCAST); + intent.putExtra("enabled", enabled); + mContext.sendBroadcast(intent); + } + + public String getBgDataProperty() { + String isBgDataPropertySet = SystemProperties.get(BACKGROUND_DATA_PROPERTY, "false"); + if (Boolean.parseBoolean(isBgDataPropertySet)) { + sRedirectCount = 0; + } + return isBgDataPropertySet; + } + + private String getConfiguredRedirectURL() { + String redirectURL = mContext.getResources().getString( + com.android.internal.R.string.operator_config_url); + Log.d(TAG, "Returning the configured redirect URL : " + + redirectURL); + return redirectURL; + } + + public synchronized void setHttpRedirectCount(String url) { + String redirectUrl = getConfiguredRedirectURL(); + if (redirectUrl != null && url.contains(redirectUrl)) { + sRedirectCount++; + Log.d(TAG, "http:sRedirectCount="+sRedirectCount); + if (sRedirectCount >= sRedirectMaxCount) { + Log.d(TAG,"http:Background Data will be disabled" ); + setBgDataProperty("true"); + sRedirectCount = 0; + } + } else { + Log.d(TAG,"http: resetting the counter "); + sRedirectCount = 0; + } + } + + public boolean getFeatureConfigValue() { + return mContext.getResources().getBoolean(R.bool.config_zero_balance_operator); + } +} -- cgit v1.1 From 512122a016488f71ca3f2868c5950229f8634648 Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Wed, 23 Nov 2016 10:12:35 +0100 Subject: Make Build.TYPE and Build.FINGERPRINT consistent for apps. Some apps (namely Android Wear) like to do comparisons between TYPE and FINGERPRINT and throw errors on inconsistencies. As our fingerprints are almost always taken from stock ROMs, they don't really match our builds, causing said comparisons to fail. Avoid those failures by taking build type out of fingerprint for apps. Change-Id: I8e8db64de7ea224572ecb3695c85abea91e0e29f --- core/java/android/os/Build.java | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'core/java/android') diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 862f4c4..883977f 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -23,7 +23,11 @@ import com.android.internal.telephony.TelephonyProperties; import dalvik.system.VMRuntime; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Information about the current build, extracted from system properties. @@ -664,6 +668,7 @@ public class Build { /** The type of build, like "user" or "eng". */ public static final String TYPE = getString("ro.build.type"); + private static String TYPE_FOR_APPS = parseBuildTypeFromFingerprint(); /** Comma-separated tags describing the build, like "unsigned,debug". */ public static final String TAGS = getString("ro.build.tags"); @@ -690,6 +695,42 @@ public class Build { return finger; } + // Some apps like to compare the build type embedded in fingerprint + // to the actual build type. As the fingerprint in our case is almost + // always hardcoded to the stock ROM fingerprint, provide that instead + // of the actual one if possible. + private static String parseBuildTypeFromFingerprint() { + final String fingerprint = SystemProperties.get("ro.build.fingerprint"); + if (TextUtils.isEmpty(fingerprint)) { + return null; + } + Pattern fingerprintPattern = + Pattern.compile("(.*)\\/(.*)\\/(.*):(.*)\\/(.*)\\/(.*):(.*)\\/(.*)"); + Matcher matcher = fingerprintPattern.matcher(fingerprint); + return matcher.matches() ? matcher.group(7) : null; + } + + /** @hide */ + public static void adjustBuildTypeIfNeeded() { + if (Process.isApplicationUid(Process.myUid()) && !TextUtils.isEmpty(TYPE_FOR_APPS)) { + try { + // This is sick. TYPE is final (which can't be changed because it's an API + // guarantee), but we have to reassign it. Resort to reflection to unset the + // final modifier, change the value and restore the final modifier afterwards. + Field typeField = Build.class.getField("TYPE"); + Field accessFlagsField = Field.class.getDeclaredField("accessFlags"); + accessFlagsField.setAccessible(true); + int currentFlags = accessFlagsField.getInt(typeField); + accessFlagsField.setInt(typeField, currentFlags & ~Modifier.FINAL); + typeField.set(null, TYPE_FOR_APPS); + accessFlagsField.setInt(typeField, currentFlags); + accessFlagsField.setAccessible(false); + } catch (Exception e) { + // shouldn't happen, but we don't want to crash the app even if it does happen + } + } + } + /** * Ensure that raw fingerprint system property is defined. If it was derived * dynamically by {@link #deriveFingerprint()} this is where we push the -- cgit v1.1 From 330d823c639537528f0e57a67ce2c82a99be0bde Mon Sep 17 00:00:00 2001 From: Zhao Wei Liew Date: Sun, 27 Nov 2016 00:50:24 -0600 Subject: Build: use UserHandle.isApp for M compatibility Change-Id: Ie4511c547d9afe2697e1ac3519f41a9b19784f18 --- core/java/android/os/Build.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/java/android') diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 883977f..2df9be2 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -712,7 +712,7 @@ public class Build { /** @hide */ public static void adjustBuildTypeIfNeeded() { - if (Process.isApplicationUid(Process.myUid()) && !TextUtils.isEmpty(TYPE_FOR_APPS)) { + if (UserHandle.isApp(Process.myUid()) && !TextUtils.isEmpty(TYPE_FOR_APPS)) { try { // This is sick. TYPE is final (which can't be changed because it's an API // guarantee), but we have to reassign it. Resort to reflection to unset the -- cgit v1.1 From 427433abaa7a05b396ec38594064e0eb6d6523be Mon Sep 17 00:00:00 2001 From: Bharadwaj Narasimha Date: Wed, 5 Oct 2016 11:26:47 -0700 Subject: Themes: Don't cache explicitly themed resources When a nav bar should be unchanged in the process of customization(like changing icons,fonts) the nav bar changes due to explicitly caching themed resources. Change-Id: I3135fac9df82a0551879908f6bf24deba0da0339 --- core/java/android/app/ResourcesManager.java | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java index c98167d..c8aec2e 100644 --- a/core/java/android/app/ResourcesManager.java +++ b/core/java/android/app/ResourcesManager.java @@ -335,18 +335,6 @@ public class ResourcesManager { ResourcesKey key = new ResourcesKey(resDir, displayId, null, compatInfo.applicationScale, isThemeable, themeConfig); - synchronized (this) { - WeakReference wr = mActiveResources.get(key); - r = wr != null ? wr.get() : null; - if (r != null && r.getAssets().isUpToDate()) { - if (false) { - Slog.w(TAG, "Returning cached resources " + r + " " + resDir - + ": appScale=" + r.getCompatibilityInfo().applicationScale); - } - return r; - } - } - AssetManager assets = new AssetManager(); assets.setAppName(packageName); assets.setThemeSupport(isThemeable); @@ -387,20 +375,7 @@ public class ResourcesManager { + r.getCompatibilityInfo().applicationScale); } - synchronized (this) { - WeakReference wr = mActiveResources.get(key); - Resources existing = wr != null ? wr.get() : null; - if (existing != null && existing.getAssets().isUpToDate()) { - // Someone else already created the resources while we were - // unlocked; go ahead and use theirs. - r.getAssets().close(); - return existing; - } - - // XXX need to remove entries when weak references go away - mActiveResources.put(key, new WeakReference(r)); - return r; - } + return r; } /** -- cgit v1.1