Skip to content

Commit 8d12f4f

Browse files
author
android-build-team Robot
committed
Snap for 7255997 from 1568cae to rvc-qpr3-release
Change-Id: I29d11383e42fed8c4ec053fe54d9e76289d17716
2 parents ce6bc5e + 1568cae commit 8d12f4f

9 files changed

Lines changed: 48 additions & 18 deletions

File tree

packages/CarSystemUI/res-keyguard/layout-land/keyguard_pin_view.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
android:layout_width="@dimen/keyguard_security_width"
6161
android:layout_height="@dimen/pin_entry_height"
6262
android:gravity="center"
63+
android:focusedByDefault="true"
6364
app:scaledTextSize="@integer/password_text_view_scale"
6465
android:contentDescription="@string/keyguard_accessibility_pin_area" />
6566

packages/CarSystemUI/res-keyguard/layout/keyguard_pin_view.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
android:layout_width="@dimen/keyguard_security_width"
4848
android:layout_height="@dimen/pin_entry_height"
4949
android:gravity="center"
50+
android:focusedByDefault="true"
5051
app:scaledTextSize="@integer/password_text_view_scale"
5152
android:contentDescription="@string/keyguard_accessibility_pin_area" />
5253

packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.android.systemui.media;
1818

19+
import static android.app.Notification.safeCharSequence;
1920
import static android.provider.Settings.ACTION_MEDIA_CONTROLS_SETTINGS;
2021

2122
import android.app.PendingIntent;
@@ -261,15 +262,15 @@ public void bind(@NonNull MediaData data, String key) {
261262

262263
// Song name
263264
TextView titleText = mViewHolder.getTitleText();
264-
titleText.setText(data.getSong());
265+
titleText.setText(safeCharSequence(data.getSong()));
265266

266267
// App title
267268
TextView appName = mViewHolder.getAppName();
268269
appName.setText(data.getApp());
269270

270271
// Artist name
271272
TextView artistText = mViewHolder.getArtistText();
272-
artistText.setText(data.getArtist());
273+
artistText.setText(safeCharSequence(data.getArtist()));
273274

274275
// Transfer chip
275276
mViewHolder.getSeamless().setVisibility(View.VISIBLE);

packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import android.graphics.ColorMatrixColorFilter;
3434
import android.graphics.Paint;
3535
import android.graphics.Rect;
36+
import android.graphics.drawable.BitmapDrawable;
3637
import android.graphics.drawable.Drawable;
3738
import android.graphics.drawable.Icon;
3839
import android.os.Parcelable;
@@ -83,8 +84,15 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
8384
public static final int STATE_DOT = 1;
8485
public static final int STATE_HIDDEN = 2;
8586

86-
/** Maximum allowed width or height for an icon drawable */
87-
private static final int MAX_IMAGE_SIZE = 500;
87+
/**
88+
* Maximum allowed byte count for an icon bitmap
89+
* @see android.graphics.RecordingCanvas.MAX_BITMAP_SIZE
90+
*/
91+
private static final int MAX_BITMAP_SIZE = 100 * 1024 * 1024; // 100 MB
92+
/**
93+
* Maximum allowed width or height for an icon drawable, if we can't get byte count
94+
*/
95+
private static final int MAX_IMAGE_SIZE = 5000;
8896

8997
private static final String TAG = "StatusBarIconView";
9098
private static final Property<StatusBarIconView, Float> ICON_APPEAR_AMOUNT
@@ -382,9 +390,18 @@ private boolean updateDrawable(boolean withClear) {
382390
return false;
383391
}
384392

385-
if (drawable.getIntrinsicWidth() > MAX_IMAGE_SIZE
393+
if (drawable instanceof BitmapDrawable && ((BitmapDrawable) drawable).getBitmap() != null) {
394+
// If it's a bitmap we can check the size directly
395+
int byteCount = ((BitmapDrawable) drawable).getBitmap().getByteCount();
396+
if (byteCount > MAX_BITMAP_SIZE) {
397+
Log.w(TAG, "Drawable is too large (" + byteCount + " bytes) " + mIcon);
398+
return false;
399+
}
400+
} else if (drawable.getIntrinsicWidth() > MAX_IMAGE_SIZE
386401
|| drawable.getIntrinsicHeight() > MAX_IMAGE_SIZE) {
387-
Log.w(TAG, "Drawable is too large " + mIcon);
402+
// Otherwise, check dimensions
403+
Log.w(TAG, "Drawable is too large (" + drawable.getIntrinsicWidth() + "x"
404+
+ drawable.getIntrinsicHeight() + ") " + mIcon);
388405
return false;
389406
}
390407

packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconViewTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void testGetContrastedStaticDrawableColor() {
127127

128128
@Test
129129
public void testGiantImageNotAllowed() {
130-
Bitmap largeBitmap = Bitmap.createBitmap(1000, 1000, Bitmap.Config.ARGB_8888);
130+
Bitmap largeBitmap = Bitmap.createBitmap(6000, 6000, Bitmap.Config.ARGB_8888);
131131
Icon icon = Icon.createWithBitmap(largeBitmap);
132132
StatusBarIcon largeIcon = new StatusBarIcon(UserHandle.ALL, "mockPackage",
133133
icon, 0, 0, "");

services/core/java/com/android/server/net/NetworkPolicyManagerService.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3067,23 +3067,19 @@ private void enforceSubscriptionPlanAccess(int subId, int callingUid, String cal
30673067
// Verify they're not lying about package name
30683068
mAppOps.checkPackage(callingUid, callingPackage);
30693069

3070-
final SubscriptionManager sm;
3071-
final SubscriptionInfo si;
30723070
final PersistableBundle config;
3071+
final TelephonyManager tm;
30733072
final long token = Binder.clearCallingIdentity();
30743073
try {
3075-
sm = mContext.getSystemService(SubscriptionManager.class);
3076-
si = sm.getActiveSubscriptionInfo(subId);
30773074
config = mCarrierConfigManager.getConfigForSubId(subId);
3075+
tm = mContext.getSystemService(TelephonyManager.class);
30783076
} finally {
30793077
Binder.restoreCallingIdentity(token);
30803078
}
30813079

3082-
// First check: is caller the CarrierService?
3083-
if (si != null) {
3084-
if (si.isEmbedded() && sm.canManageSubscription(si, callingPackage)) {
3085-
return;
3086-
}
3080+
// First check: does caller have carrier privilege?
3081+
if (tm != null && tm.hasCarrierPrivileges(subId)) {
3082+
return;
30873083
}
30883084

30893085
// Second check: has the CarrierService delegated access?

telephony/java/android/telephony/SubscriptionInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,14 @@ public class SubscriptionInfo implements Parcelable {
148148

149149
/**
150150
* The access rules for this subscription, if it is embedded and defines any.
151+
* This does not include access rules for non-embedded subscriptions.
151152
*/
152153
@Nullable
153154
private UiccAccessRule[] mNativeAccessRules;
154155

155156
/**
156157
* The carrier certificates for this subscription that are saved in carrier configs.
157-
* The other carrier certificates are embedded on Uicc and stored as part of mNativeAccessRules.
158+
* This does not include access rules from the Uicc, whether embedded or non-embedded.
158159
*/
159160
@Nullable
160161
private UiccAccessRule[] mCarrierConfigAccessRules;
@@ -661,7 +662,6 @@ public boolean canManageSubscription(Context context, String packageName) {
661662
* is authorized to manage this subscription.
662663
* TODO and fix it properly in R / master: either deprecate this and have 3 APIs
663664
* native + carrier + all, or have this return all by default.
664-
* @throws UnsupportedOperationException if this subscription is not embedded.
665665
* @hide
666666
*/
667667
@SystemApi

telephony/java/android/telephony/SubscriptionManager.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,6 +2631,10 @@ public void setSubscriptionOverrideCongested(int subId, boolean overrideCongeste
26312631
* Checks whether the app with the given context is authorized to manage the given subscription
26322632
* according to its metadata.
26332633
*
2634+
* Only supported for embedded subscriptions (if {@link SubscriptionInfo#isEmbedded} returns
2635+
* true). To check for permissions for non-embedded subscription as well,
2636+
* {@see android.telephony.TelephonyManager#hasCarrierPrivileges}.
2637+
*
26342638
* @param info The subscription to check.
26352639
* @return whether the app is authorized to manage this subscription per its metadata.
26362640
*/
@@ -2643,6 +2647,10 @@ public boolean canManageSubscription(SubscriptionInfo info) {
26432647
* be authorized if it is included in the {@link android.telephony.UiccAccessRule} of the
26442648
* {@link android.telephony.SubscriptionInfo} with the access status.
26452649
*
2650+
* Only supported for embedded subscriptions (if {@link SubscriptionInfo#isEmbedded} returns
2651+
* true). To check for permissions for non-embedded subscription as well,
2652+
* {@see android.telephony.TelephonyManager#hasCarrierPrivileges}.
2653+
*
26462654
* @param info The subscription to check.
26472655
* @param packageName Package name of the app to check.
26482656
* @return whether the app is authorized to manage this subscription per its access rules.

telephony/java/android/telephony/TelephonyManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8534,6 +8534,9 @@ public boolean isTetheringApnRequired(int subId) {
85348534
* call will return true. This access is granted by the owner of the UICC
85358535
* card and does not depend on the registered carrier.
85368536
*
8537+
* Note that this API applies to both physical and embedded subscriptions and
8538+
* is a superset of the checks done in SubscriptionManager#canManageSubscription.
8539+
*
85378540
* @return true if the app has carrier privileges.
85388541
*/
85398542
public boolean hasCarrierPrivileges() {
@@ -8547,6 +8550,9 @@ public boolean hasCarrierPrivileges() {
85478550
* call will return true. This access is granted by the owner of the UICC
85488551
* card and does not depend on the registered carrier.
85498552
*
8553+
* Note that this API applies to both physical and embedded subscriptions and
8554+
* is a superset of the checks done in SubscriptionManager#canManageSubscription.
8555+
*
85508556
* @param subId The subscription to use.
85518557
* @return true if the app has carrier privileges.
85528558
* @hide

0 commit comments

Comments
 (0)