Skip to content

Commit 53455c5

Browse files
akhilnarangRadiumBot
authored andcommitted
Merge remote-tracking branch 'tr/5.1' into HEAD
Signed-off-by: Team-Radium <[email protected]>
2 parents 3ab5452 + 5c1c42f commit 53455c5

File tree

69 files changed

+682
-1546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+682
-1546
lines changed

Android.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ LOCAL_SRC_FILES += \
159159
core/java/android/hardware/ICameraServiceListener.aidl \
160160
core/java/android/hardware/ICamera.aidl \
161161
core/java/android/hardware/ICameraClient.aidl \
162-
core/java/android/hardware/ICmHardwareService.aidl \
163162
core/java/android/hardware/IConsumerIrService.aidl \
164163
core/java/android/hardware/IProCameraUser.aidl \
165164
core/java/android/hardware/IProCameraCallbacks.aidl \

core/java/android/app/ActivityThread.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,7 +1668,7 @@ Resources getTopLevelResources(String resDir, String[] splitResDirs, String[] ov
16681668
LoadedApk pkgInfo, Context context, String pkgName) {
16691669
return mResourcesManager.getTopLevelResources(resDir, splitResDirs, overlayDirs, libDirs,
16701670
displayId, pkgName, overrideConfiguration, pkgInfo.getCompatibilityInfo(), null,
1671-
context);
1671+
context, pkgInfo.getApplicationInfo().isThemeable);
16721672
}
16731673

16741674
/**
@@ -1677,7 +1677,8 @@ Resources getTopLevelResources(String resDir, String[] splitResDirs, String[] ov
16771677
Resources getTopLevelThemedResources(String resDir, int displayId, LoadedApk pkgInfo,
16781678
String pkgName, String themePkgName) {
16791679
return mResourcesManager.getTopLevelThemedResources(resDir, displayId, pkgName,
1680-
themePkgName, pkgInfo.getCompatibilityInfo(), null);
1680+
themePkgName, pkgInfo.getCompatibilityInfo(), null,
1681+
pkgInfo.getApplicationInfo().isThemeable);
16811682
}
16821683

16831684
final Handler getHandler() {

core/java/android/app/ContextImpl.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
import android.database.sqlite.SQLiteDatabase.CursorFactory;
6464
import android.graphics.Bitmap;
6565
import android.graphics.drawable.Drawable;
66-
import android.hardware.CmHardwareManager;
6766
import android.hardware.ConsumerIrManager;
6867
import android.hardware.ISerialManager;
6968
import android.hardware.SerialManager;
@@ -791,11 +790,6 @@ public Object createService(ContextImpl ctx) {
791790
final Context outerContext = ctx.getOuterContext();
792791
return new TorchManager(outerContext, service);
793792
}});
794-
795-
registerService(CMHW_SERVICE, new ServiceFetcher() {
796-
public Object createService(ContextImpl ctx) {
797-
return new CmHardwareManager(ctx);
798-
}});
799793
}
800794

801795
static ContextImpl getImpl(Context context) {
@@ -2350,9 +2344,10 @@ private ContextImpl(ContextImpl container, ActivityThread mainThread,
23502344
packageInfo.getOverlayDirs(),
23512345
packageInfo.getApplicationInfo().sharedLibraryFiles, displayId,
23522346
packageInfo.getAppDir(), overrideConfiguration, compatInfo, activityToken,
2353-
mOuterContext) :
2347+
mOuterContext, packageInfo.getApplicationInfo().isThemeable) :
23542348
mResourcesManager.getTopLevelThemedResources(packageInfo.getResDir(), displayId,
2355-
packageInfo.getPackageName(), themePackageName, compatInfo ,activityToken);
2349+
packageInfo.getPackageName(), themePackageName, compatInfo, activityToken,
2350+
packageInfo.getApplicationInfo().isThemeable);
23562351
}
23572352
}
23582353
mResources = resources;

core/java/android/app/ResourcesManager.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,8 @@ public boolean applyCompatConfiguration(int displayDensity,
174174
public Resources getTopLevelResources(String resDir, String[] splitResDirs,
175175
String[] overlayDirs, String[] libDirs, int displayId, String packageName,
176176
Configuration overrideConfiguration, CompatibilityInfo compatInfo, IBinder token,
177-
Context context) {
177+
Context context, boolean isThemeable) {
178178
final float scale = compatInfo.applicationScale;
179-
final boolean isThemeable = compatInfo.isThemeable;
180179
final ThemeConfig themeConfig = getThemeConfig();
181180
ResourcesKey key = new ResourcesKey(resDir, displayId, overrideConfiguration, scale,
182181
isThemeable, themeConfig, token);
@@ -205,7 +204,7 @@ public Resources getTopLevelResources(String resDir, String[] splitResDirs,
205204

206205
AssetManager assets = new AssetManager();
207206
assets.setAppName(packageName);
208-
assets.setThemeSupport(compatInfo.isThemeable);
207+
assets.setThemeSupport(isThemeable);
209208
// resDir can be null if the 'android' package is creating a new Resources object.
210209
// This is fine, since each AssetManager automatically loads the 'android' package
211210
// already.
@@ -260,7 +259,7 @@ public Resources getTopLevelResources(String resDir, String[] splitResDirs,
260259

261260
boolean iconsAttached = false;
262261
/* Attach theme information to the resulting AssetManager when appropriate. */
263-
if (compatInfo.isThemeable && config != null && !context.getPackageManager().isSafeMode()) {
262+
if (isThemeable && config != null && !context.getPackageManager().isSafeMode()) {
264263
if (config.themeConfig == null) {
265264
try {
266265
config.themeConfig = ThemeConfig.getBootTheme(context.getContentResolver());
@@ -311,15 +310,14 @@ public Resources getTopLevelResources(String resDir, String[] splitResDirs,
311310
*
312311
* @hide
313312
*/
314-
public Resources getTopLevelThemedResources(String resDir, int displayId,
315-
String packageName,
316-
String themePackageName,
317-
CompatibilityInfo compatInfo, IBinder token) {
313+
public Resources getTopLevelThemedResources(String resDir, int displayId, String packageName,
314+
String themePackageName, CompatibilityInfo compatInfo, IBinder token,
315+
boolean isThemeable) {
318316
Resources r;
319317

320318
AssetManager assets = new AssetManager();
321319
assets.setAppName(packageName);
322-
assets.setThemeSupport(true);
320+
assets.setThemeSupport(isThemeable);
323321
if (assets.addAssetPath(resDir) == 0) {
324322
return null;
325323
}
@@ -335,19 +333,21 @@ public Resources getTopLevelThemedResources(String resDir, int displayId,
335333
config = getConfiguration();
336334
}
337335

338-
/* Attach theme information to the resulting AssetManager when appropriate. */
339-
ThemeConfig.Builder builder = new ThemeConfig.Builder();
340-
builder.defaultOverlay(themePackageName);
341-
builder.defaultIcon(themePackageName);
342-
builder.defaultFont(themePackageName);
343-
344-
ThemeConfig themeConfig = builder.build();
345-
attachThemeAssets(assets, themeConfig);
346-
attachCommonAssets(assets, themeConfig);
347-
attachIconAssets(assets, themeConfig);
348-
336+
boolean iconsAttached = false;
337+
if (isThemeable) {
338+
/* Attach theme information to the resulting AssetManager when appropriate. */
339+
ThemeConfig.Builder builder = new ThemeConfig.Builder();
340+
builder.defaultOverlay(themePackageName);
341+
builder.defaultIcon(themePackageName);
342+
builder.defaultFont(themePackageName);
343+
344+
ThemeConfig themeConfig = builder.build();
345+
attachThemeAssets(assets, themeConfig);
346+
attachCommonAssets(assets, themeConfig);
347+
iconsAttached = attachIconAssets(assets, themeConfig);
348+
}
349349
r = new Resources(assets, dm, config, compatInfo, token);
350-
setActivityIcons(r);
350+
if (iconsAttached) setActivityIcons(r);
351351

352352
return r;
353353
}

core/java/android/bluetooth/BluetoothPan.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,19 +340,25 @@ && isValidDevice(device)) {
340340

341341
public void setBluetoothTethering(boolean value) {
342342
if (DBG) log("setBluetoothTethering(" + value + ")");
343-
try {
344-
mPanService.setBluetoothTethering(value);
345-
} catch (RemoteException e) {
346-
Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
343+
344+
if (mPanService != null && isEnabled()) {
345+
try {
346+
mPanService.setBluetoothTethering(value);
347+
} catch (RemoteException e) {
348+
Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
349+
}
347350
}
348351
}
349352

350353
public boolean isTetheringOn() {
351354
if (VDBG) log("isTetheringOn()");
352-
try {
353-
return mPanService.isTetheringOn();
354-
} catch (RemoteException e) {
355-
Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
355+
356+
if (mPanService != null && isEnabled()) {
357+
try {
358+
return mPanService.isTetheringOn();
359+
} catch (RemoteException e) {
360+
Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
361+
}
356362
}
357363
return false;
358364
}

core/java/android/content/Context.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2938,17 +2938,6 @@ public abstract boolean startInstrumentation(@NonNull ComponentName className,
29382938
*/
29392939
public static final String TORCH_SERVICE = "torch";
29402940

2941-
/**
2942-
* Use with {@link #getSystemService} to retrieve a
2943-
* {@link android.hardware.CmHardwareManager} for controlling
2944-
* hw specific features
2945-
*
2946-
* @see #getSystemService
2947-
* @see android.hardware.CmHardwareManager
2948-
* @hide
2949-
*/
2950-
public static final String CMHW_SERVICE = "cmhw";
2951-
29522941
/**
29532942
* {@link com.android.server.KillSwitchService}for accessing the kill switch service.
29542943
*

core/java/android/content/pm/PackageParser.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,8 +2577,9 @@ private boolean parseBaseApplication(Package owner, Resources res,
25772577
final ApplicationInfo ai = owner.applicationInfo;
25782578
final String pkgName = owner.applicationInfo.packageName;
25792579

2580-
// assume that this package is themeable unless explicitly set to false.
2581-
ai.isThemeable = true;
2580+
String[] nonThemeablePackages =
2581+
res.getStringArray(com.android.internal.R.array.non_themeable_packages);
2582+
ai.isThemeable = isPackageThemeable(pkgName, nonThemeablePackages);
25822583

25832584
TypedArray sa = res.obtainAttributes(attrs,
25842585
com.android.internal.R.styleable.AndroidManifestApplication);
@@ -4377,6 +4378,22 @@ private boolean parseIntent(Resources res, XmlPullParser parser, AttributeSet at
43774378
return true;
43784379
}
43794380

4381+
/**1
4382+
* Returns whether the specified package is themeable
4383+
* @param packageName Name of package to check
4384+
* @param nonThemeablePackages Array of packages that are declared as non-themeable
4385+
* @return True if the package is themeable, false otherwise
4386+
*/
4387+
private static boolean isPackageThemeable(String packageName, String[] nonThemeablePackages) {
4388+
for (String pkg : nonThemeablePackages) {
4389+
if (packageName.startsWith(pkg)) {
4390+
return false;
4391+
}
4392+
}
4393+
4394+
return true;
4395+
}
4396+
43804397
/**
43814398
* Representation of a full package parsed from APK files on disk. A package
43824399
* consists of a single base APK, and zero or more split APKs.

core/java/android/content/res/CompatibilityInfo.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,9 @@ public class CompatibilityInfo implements Parcelable {
9292
*/
9393
public final float applicationInvertedScale;
9494

95-
/**
96-
* Whether the application supports third-party theming.
97-
*/
98-
public final boolean isThemeable;
99-
10095
public CompatibilityInfo(ApplicationInfo appInfo, int screenLayout, int sw,
10196
boolean forceCompat) {
10297
int compatFlags = 0;
103-
isThemeable = appInfo.isThemeable;
10498

10599
if (appInfo.requiresSmallestWidthDp != 0 || appInfo.compatibleWidthLimitDp != 0
106100
|| appInfo.largestWidthLimitDp != 0) {
@@ -247,20 +241,17 @@ public CompatibilityInfo(ApplicationInfo appInfo, int screenLayout, int sw,
247241
mCompatibilityFlags = compatFlags;
248242
}
249243

250-
private CompatibilityInfo(int compFlags,
251-
int dens, float scale, float invertedScale, boolean isThemeable) {
244+
private CompatibilityInfo(int compFlags, int dens, float scale, float invertedScale) {
252245
mCompatibilityFlags = compFlags;
253246
applicationDensity = dens;
254247
applicationScale = scale;
255248
applicationInvertedScale = invertedScale;
256-
this.isThemeable = isThemeable;
257249
}
258250

259251
private CompatibilityInfo() {
260252
this(NEVER_NEEDS_COMPAT, DisplayMetrics.DENSITY_DEVICE,
261253
1.0f,
262-
1.0f,
263-
true);
254+
1.0f);
264255
}
265256

266257
/**
@@ -534,7 +525,6 @@ public boolean equals(Object o) {
534525
if (applicationDensity != oc.applicationDensity) return false;
535526
if (applicationScale != oc.applicationScale) return false;
536527
if (applicationInvertedScale != oc.applicationInvertedScale) return false;
537-
if (isThemeable != oc.isThemeable) return false;
538528
return true;
539529
} catch (ClassCastException e) {
540530
return false;
@@ -572,7 +562,6 @@ public int hashCode() {
572562
result = 31 * result + applicationDensity;
573563
result = 31 * result + Float.floatToIntBits(applicationScale);
574564
result = 31 * result + Float.floatToIntBits(applicationInvertedScale);
575-
result = 31 * result + (isThemeable ? 1 : 0);
576565
return result;
577566
}
578567

@@ -587,7 +576,6 @@ public void writeToParcel(Parcel dest, int flags) {
587576
dest.writeInt(applicationDensity);
588577
dest.writeFloat(applicationScale);
589578
dest.writeFloat(applicationInvertedScale);
590-
dest.writeInt(isThemeable ? 1 : 0);
591579
}
592580

593581
public static final Parcelable.Creator<CompatibilityInfo> CREATOR
@@ -608,6 +596,5 @@ private CompatibilityInfo(Parcel source) {
608596
applicationDensity = source.readInt();
609597
applicationScale = source.readFloat();
610598
applicationInvertedScale = source.readFloat();
611-
isThemeable = source.readInt() == 1 ? true : false;
612599
}
613600
}

0 commit comments

Comments
 (0)