Merge "Encapsulate parsing class fields"
This commit is contained in:
committed by
Android (Google) Code Review
commit
eb2e459ecb
@@ -273,16 +273,16 @@ public class PackageInfoWithoutStateUtils {
|
||||
pi.requestedPermissionsFlags = new int[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
final ParsedUsesPermission usesPermission = usesPermissions.get(i);
|
||||
pi.requestedPermissions[i] = usesPermission.name;
|
||||
pi.requestedPermissions[i] = usesPermission.getName();
|
||||
// The notion of required permissions is deprecated but for compatibility.
|
||||
pi.requestedPermissionsFlags[i] |=
|
||||
PackageInfo.REQUESTED_PERMISSION_REQUIRED;
|
||||
if (grantedPermissions != null
|
||||
&& grantedPermissions.contains(usesPermission.name)) {
|
||||
&& grantedPermissions.contains(usesPermission.getName())) {
|
||||
pi.requestedPermissionsFlags[i] |=
|
||||
PackageInfo.REQUESTED_PERMISSION_GRANTED;
|
||||
}
|
||||
if ((usesPermission.usesPermissionFlags
|
||||
if ((usesPermission.getUsesPermissionFlags()
|
||||
& ParsedUsesPermission.FLAG_NEVER_FOR_LOCATION) != 0) {
|
||||
pi.requestedPermissionsFlags[i] |=
|
||||
PackageInfo.REQUESTED_PERMISSION_NEVER_FOR_LOCATION;
|
||||
@@ -750,7 +750,7 @@ public class PackageInfoWithoutStateUtils {
|
||||
@Nullable
|
||||
public static Attribution generateAttribution(ParsedAttribution pa) {
|
||||
if (pa == null) return null;
|
||||
return new Attribution(pa.tag, pa.label);
|
||||
return new Attribution(pa.getTag(), pa.getLabel());
|
||||
}
|
||||
|
||||
private static boolean checkUseInstalledOrHidden(int flags, @NonNull PackageUserState state,
|
||||
|
||||
@@ -716,7 +716,8 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
|
||||
// Continue populating legacy data structures to avoid performance
|
||||
// issues until all that code can be migrated
|
||||
this.requestedPermissions = CollectionUtils.add(this.requestedPermissions, permission.name);
|
||||
this.requestedPermissions = CollectionUtils.add(this.requestedPermissions,
|
||||
permission.getName());
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1307,8 +1307,8 @@ public class ParsingPackageUtils {
|
||||
final int size = usesPermissions.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
final ParsedUsesPermission usesPermission = usesPermissions.get(i);
|
||||
if (Objects.equals(usesPermission.name, name)) {
|
||||
if (usesPermission.usesPermissionFlags != usesPermissionFlags) {
|
||||
if (Objects.equals(usesPermission.getName(), name)) {
|
||||
if (usesPermission.getUsesPermissionFlags() != usesPermissionFlags) {
|
||||
return input.error("Conflicting uses-permissions flags: "
|
||||
+ name + " in package: " + pkg.getPackageName() + " at: "
|
||||
+ parser.getPositionDescription());
|
||||
@@ -2807,8 +2807,8 @@ public class ParsingPackageUtils {
|
||||
if (pkg.getTargetSdkVersion() >= info.sdkVersion) {
|
||||
break;
|
||||
}
|
||||
if (!pkg.getRequestedPermissions().contains(info.name)) {
|
||||
pkg.addImplicitPermission(info.name);
|
||||
if (!pkg.getRequestedPermissions().contains(info.getName())) {
|
||||
pkg.addImplicitPermission(info.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class ComponentParseUtils {
|
||||
@Nullable
|
||||
public static CharSequence getNonLocalizedLabel(
|
||||
ParsedComponent component) {
|
||||
return component.nonLocalizedLabel;
|
||||
return component.getNonLocalizedLabel();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,7 +161,7 @@ public class ComponentParseUtils {
|
||||
* This is a method of the utility class to discourage use.
|
||||
*/
|
||||
public static int getIcon(ParsedComponent component) {
|
||||
return component.icon;
|
||||
return component.getIcon();
|
||||
}
|
||||
|
||||
public static boolean isMatch(PackageUserState state, boolean isSystem,
|
||||
|
||||
@@ -38,8 +38,8 @@ import com.android.internal.util.Parcelling.BuiltIn.ForInternedString;
|
||||
/** @hide **/
|
||||
public class ParsedActivity extends ParsedMainComponent {
|
||||
|
||||
int theme;
|
||||
int uiOptions;
|
||||
private int theme;
|
||||
private int uiOptions;
|
||||
|
||||
@Nullable
|
||||
@DataClass.ParcelWith(ForInternedString.class)
|
||||
@@ -49,22 +49,22 @@ public class ParsedActivity extends ParsedMainComponent {
|
||||
@DataClass.ParcelWith(ForInternedString.class)
|
||||
private String parentActivityName;
|
||||
@Nullable
|
||||
String taskAffinity;
|
||||
int privateFlags;
|
||||
private String taskAffinity;
|
||||
private int privateFlags;
|
||||
@Nullable
|
||||
@DataClass.ParcelWith(ForInternedString.class)
|
||||
private String permission;
|
||||
|
||||
int launchMode;
|
||||
int documentLaunchMode;
|
||||
int maxRecents;
|
||||
int configChanges;
|
||||
int softInputMode;
|
||||
int persistableMode;
|
||||
int lockTaskLaunchMode;
|
||||
private int launchMode;
|
||||
private int documentLaunchMode;
|
||||
private int maxRecents;
|
||||
private int configChanges;
|
||||
private int softInputMode;
|
||||
private int persistableMode;
|
||||
private int lockTaskLaunchMode;
|
||||
|
||||
int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||
int resizeMode = ActivityInfo.RESIZE_MODE_RESIZEABLE;
|
||||
private int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||
private int resizeMode = ActivityInfo.RESIZE_MODE_RESIZEABLE;
|
||||
|
||||
@Nullable
|
||||
private Float maxAspectRatio;
|
||||
@@ -75,12 +75,12 @@ public class ParsedActivity extends ParsedMainComponent {
|
||||
private boolean supportsSizeChanges;
|
||||
|
||||
@Nullable
|
||||
String requestedVrComponent;
|
||||
int rotationAnimation = -1;
|
||||
int colorMode;
|
||||
private String requestedVrComponent;
|
||||
private int rotationAnimation = -1;
|
||||
private int colorMode;
|
||||
|
||||
@Nullable
|
||||
ActivityInfo.WindowLayout windowLayout;
|
||||
private ActivityInfo.WindowLayout windowLayout;
|
||||
|
||||
public ParsedActivity(ParsedActivity other) {
|
||||
super(other);
|
||||
@@ -188,6 +188,35 @@ public class ParsedActivity extends ParsedMainComponent {
|
||||
// alias.metaData = target.metaData;
|
||||
}
|
||||
|
||||
public boolean isSupportsSizeChanges() {
|
||||
return supportsSizeChanges;
|
||||
}
|
||||
|
||||
public ParsedActivity setColorMode(int colorMode) {
|
||||
this.colorMode = colorMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setConfigChanges(int configChanges) {
|
||||
this.configChanges = configChanges;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setDocumentLaunchMode(int documentLaunchMode) {
|
||||
this.documentLaunchMode = documentLaunchMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setLaunchMode(int launchMode) {
|
||||
this.launchMode = launchMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setLockTaskLaunchMode(int lockTaskLaunchMode) {
|
||||
this.lockTaskLaunchMode = lockTaskLaunchMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setMaxAspectRatio(int resizeMode, float maxAspectRatio) {
|
||||
if (resizeMode == ActivityInfo.RESIZE_MODE_RESIZEABLE
|
||||
|| resizeMode == ActivityInfo.RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION) {
|
||||
@@ -204,6 +233,16 @@ public class ParsedActivity extends ParsedMainComponent {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setMaxAspectRatio(Float maxAspectRatio) {
|
||||
this.maxAspectRatio = maxAspectRatio;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setMaxRecents(int maxRecents) {
|
||||
this.maxRecents = maxRecents;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setMinAspectRatio(int resizeMode, float minAspectRatio) {
|
||||
if (resizeMode == RESIZE_MODE_RESIZEABLE
|
||||
|| resizeMode == RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION) {
|
||||
@@ -220,13 +259,48 @@ public class ParsedActivity extends ParsedMainComponent {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setSupportsSizeChanges(boolean supportsSizeChanges) {
|
||||
this.supportsSizeChanges = supportsSizeChanges;
|
||||
public ParsedActivity setMinAspectRatio(Float minAspectRatio) {
|
||||
this.minAspectRatio = minAspectRatio;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setFlags(int flags) {
|
||||
this.flags = flags;
|
||||
public ParsedActivity setParentActivityName(String parentActivityName) {
|
||||
this.parentActivityName = parentActivityName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setPersistableMode(int persistableMode) {
|
||||
this.persistableMode = persistableMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setPrivateFlags(int privateFlags) {
|
||||
this.privateFlags = privateFlags;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setRequestedVrComponent(String requestedVrComponent) {
|
||||
this.requestedVrComponent = requestedVrComponent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setRotationAnimation(int rotationAnimation) {
|
||||
this.rotationAnimation = rotationAnimation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setScreenOrientation(int screenOrientation) {
|
||||
this.screenOrientation = screenOrientation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setSoftInputMode(int softInputMode) {
|
||||
this.softInputMode = softInputMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setSupportsSizeChanges(boolean supportsSizeChanges) {
|
||||
this.supportsSizeChanges = supportsSizeChanges;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -240,17 +314,32 @@ public class ParsedActivity extends ParsedMainComponent {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setParentActivity(String parentActivity) {
|
||||
this.parentActivityName = TextUtils.safeIntern(parentActivity);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setPermission(String permission) {
|
||||
// Empty string must be converted to null
|
||||
this.permission = TextUtils.isEmpty(permission) ? null : permission.intern();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setTaskAffinity(String taskAffinity) {
|
||||
this.taskAffinity = taskAffinity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setTheme(int theme) {
|
||||
this.theme = theme;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setUiOptions(int uiOptions) {
|
||||
this.uiOptions = uiOptions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedActivity setWindowLayout(ActivityInfo.WindowLayout windowLayout) {
|
||||
this.windowLayout = windowLayout;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(128);
|
||||
sb.append("Activity{");
|
||||
|
||||
@@ -120,58 +120,58 @@ public class ParsedActivityUtils {
|
||||
// Multi-lining them to fit within the column restriction makes it hard to tell what
|
||||
// field is assigned where.
|
||||
// @formatter:off
|
||||
activity.theme = sa.getResourceId(R.styleable.AndroidManifestActivity_theme, 0);
|
||||
activity.uiOptions = sa.getInt(R.styleable.AndroidManifestActivity_uiOptions, pkg.getUiOptions());
|
||||
activity.setTheme(sa.getResourceId(R.styleable.AndroidManifestActivity_theme, 0))
|
||||
.setUiOptions(sa.getInt(R.styleable.AndroidManifestActivity_uiOptions, pkg.getUiOptions()));
|
||||
|
||||
activity.flags |= flag(ActivityInfo.FLAG_ALLOW_TASK_REPARENTING, R.styleable.AndroidManifestActivity_allowTaskReparenting, pkg.isAllowTaskReparenting(), sa)
|
||||
| flag(ActivityInfo.FLAG_ALWAYS_RETAIN_TASK_STATE, R.styleable.AndroidManifestActivity_alwaysRetainTaskState, sa)
|
||||
| flag(ActivityInfo.FLAG_CLEAR_TASK_ON_LAUNCH, R.styleable.AndroidManifestActivity_clearTaskOnLaunch, sa)
|
||||
| flag(ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS, R.styleable.AndroidManifestActivity_excludeFromRecents, sa)
|
||||
| flag(ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS, R.styleable.AndroidManifestActivity_finishOnCloseSystemDialogs, sa)
|
||||
| flag(ActivityInfo.FLAG_FINISH_ON_TASK_LAUNCH, R.styleable.AndroidManifestActivity_finishOnTaskLaunch, sa)
|
||||
| flag(ActivityInfo.FLAG_IMMERSIVE, R.styleable.AndroidManifestActivity_immersive, sa)
|
||||
| flag(ActivityInfo.FLAG_MULTIPROCESS, R.styleable.AndroidManifestActivity_multiprocess, sa)
|
||||
| flag(ActivityInfo.FLAG_NO_HISTORY, R.styleable.AndroidManifestActivity_noHistory, sa)
|
||||
| flag(ActivityInfo.FLAG_SHOW_FOR_ALL_USERS, R.styleable.AndroidManifestActivity_showForAllUsers, sa)
|
||||
| flag(ActivityInfo.FLAG_SHOW_FOR_ALL_USERS, R.styleable.AndroidManifestActivity_showOnLockScreen, sa)
|
||||
| flag(ActivityInfo.FLAG_STATE_NOT_NEEDED, R.styleable.AndroidManifestActivity_stateNotNeeded, sa)
|
||||
| flag(ActivityInfo.FLAG_SYSTEM_USER_ONLY, R.styleable.AndroidManifestActivity_systemUserOnly, sa);
|
||||
activity.setFlags(activity.getFlags() | (flag(ActivityInfo.FLAG_ALLOW_TASK_REPARENTING, R.styleable.AndroidManifestActivity_allowTaskReparenting, pkg.isAllowTaskReparenting(), sa)
|
||||
| flag(ActivityInfo.FLAG_ALWAYS_RETAIN_TASK_STATE, R.styleable.AndroidManifestActivity_alwaysRetainTaskState, sa)
|
||||
| flag(ActivityInfo.FLAG_CLEAR_TASK_ON_LAUNCH, R.styleable.AndroidManifestActivity_clearTaskOnLaunch, sa)
|
||||
| flag(ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS, R.styleable.AndroidManifestActivity_excludeFromRecents, sa)
|
||||
| flag(ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS, R.styleable.AndroidManifestActivity_finishOnCloseSystemDialogs, sa)
|
||||
| flag(ActivityInfo.FLAG_FINISH_ON_TASK_LAUNCH, R.styleable.AndroidManifestActivity_finishOnTaskLaunch, sa)
|
||||
| flag(ActivityInfo.FLAG_IMMERSIVE, R.styleable.AndroidManifestActivity_immersive, sa)
|
||||
| flag(ActivityInfo.FLAG_MULTIPROCESS, R.styleable.AndroidManifestActivity_multiprocess, sa)
|
||||
| flag(ActivityInfo.FLAG_NO_HISTORY, R.styleable.AndroidManifestActivity_noHistory, sa)
|
||||
| flag(ActivityInfo.FLAG_SHOW_FOR_ALL_USERS, R.styleable.AndroidManifestActivity_showForAllUsers, sa)
|
||||
| flag(ActivityInfo.FLAG_SHOW_FOR_ALL_USERS, R.styleable.AndroidManifestActivity_showOnLockScreen, sa)
|
||||
| flag(ActivityInfo.FLAG_STATE_NOT_NEEDED, R.styleable.AndroidManifestActivity_stateNotNeeded, sa)
|
||||
| flag(ActivityInfo.FLAG_SYSTEM_USER_ONLY, R.styleable.AndroidManifestActivity_systemUserOnly, sa)));
|
||||
|
||||
if (!receiver) {
|
||||
activity.flags |= flag(ActivityInfo.FLAG_HARDWARE_ACCELERATED, R.styleable.AndroidManifestActivity_hardwareAccelerated, pkg.isBaseHardwareAccelerated(), sa)
|
||||
| flag(ActivityInfo.FLAG_ALLOW_EMBEDDED, R.styleable.AndroidManifestActivity_allowEmbedded, sa)
|
||||
| flag(ActivityInfo.FLAG_ALWAYS_FOCUSABLE, R.styleable.AndroidManifestActivity_alwaysFocusable, sa)
|
||||
| flag(ActivityInfo.FLAG_AUTO_REMOVE_FROM_RECENTS, R.styleable.AndroidManifestActivity_autoRemoveFromRecents, sa)
|
||||
| flag(ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY, R.styleable.AndroidManifestActivity_relinquishTaskIdentity, sa)
|
||||
| flag(ActivityInfo.FLAG_RESUME_WHILE_PAUSING, R.styleable.AndroidManifestActivity_resumeWhilePausing, sa)
|
||||
| flag(ActivityInfo.FLAG_SHOW_WHEN_LOCKED, R.styleable.AndroidManifestActivity_showWhenLocked, sa)
|
||||
| flag(ActivityInfo.FLAG_SUPPORTS_PICTURE_IN_PICTURE, R.styleable.AndroidManifestActivity_supportsPictureInPicture, sa)
|
||||
| flag(ActivityInfo.FLAG_TURN_SCREEN_ON, R.styleable.AndroidManifestActivity_turnScreenOn, sa)
|
||||
| flag(ActivityInfo.FLAG_PREFER_MINIMAL_POST_PROCESSING, R.styleable.AndroidManifestActivity_preferMinimalPostProcessing, sa);
|
||||
activity.setFlags(activity.getFlags() | (flag(ActivityInfo.FLAG_HARDWARE_ACCELERATED, R.styleable.AndroidManifestActivity_hardwareAccelerated, pkg.isBaseHardwareAccelerated(), sa)
|
||||
| flag(ActivityInfo.FLAG_ALLOW_EMBEDDED, R.styleable.AndroidManifestActivity_allowEmbedded, sa)
|
||||
| flag(ActivityInfo.FLAG_ALWAYS_FOCUSABLE, R.styleable.AndroidManifestActivity_alwaysFocusable, sa)
|
||||
| flag(ActivityInfo.FLAG_AUTO_REMOVE_FROM_RECENTS, R.styleable.AndroidManifestActivity_autoRemoveFromRecents, sa)
|
||||
| flag(ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY, R.styleable.AndroidManifestActivity_relinquishTaskIdentity, sa)
|
||||
| flag(ActivityInfo.FLAG_RESUME_WHILE_PAUSING, R.styleable.AndroidManifestActivity_resumeWhilePausing, sa)
|
||||
| flag(ActivityInfo.FLAG_SHOW_WHEN_LOCKED, R.styleable.AndroidManifestActivity_showWhenLocked, sa)
|
||||
| flag(ActivityInfo.FLAG_SUPPORTS_PICTURE_IN_PICTURE, R.styleable.AndroidManifestActivity_supportsPictureInPicture, sa)
|
||||
| flag(ActivityInfo.FLAG_TURN_SCREEN_ON, R.styleable.AndroidManifestActivity_turnScreenOn, sa)
|
||||
| flag(ActivityInfo.FLAG_PREFER_MINIMAL_POST_PROCESSING, R.styleable.AndroidManifestActivity_preferMinimalPostProcessing, sa)));
|
||||
|
||||
activity.privateFlags |= flag(ActivityInfo.FLAG_INHERIT_SHOW_WHEN_LOCKED,
|
||||
R.styleable.AndroidManifestActivity_inheritShowWhenLocked, sa)
|
||||
| flag(ActivityInfo.PRIVATE_FLAG_HOME_TRANSITION_SOUND,
|
||||
R.styleable.AndroidManifestActivity_playHomeTransitionSound, true, sa);
|
||||
activity.setPrivateFlags(activity.getPrivateFlags() | (flag(ActivityInfo.FLAG_INHERIT_SHOW_WHEN_LOCKED,
|
||||
R.styleable.AndroidManifestActivity_inheritShowWhenLocked, sa)
|
||||
| flag(ActivityInfo.PRIVATE_FLAG_HOME_TRANSITION_SOUND,
|
||||
R.styleable.AndroidManifestActivity_playHomeTransitionSound, true, sa)));
|
||||
|
||||
activity.colorMode = sa.getInt(R.styleable.AndroidManifestActivity_colorMode, ActivityInfo.COLOR_MODE_DEFAULT);
|
||||
activity.documentLaunchMode = sa.getInt(R.styleable.AndroidManifestActivity_documentLaunchMode, ActivityInfo.DOCUMENT_LAUNCH_NONE);
|
||||
activity.launchMode = sa.getInt(R.styleable.AndroidManifestActivity_launchMode, ActivityInfo.LAUNCH_MULTIPLE);
|
||||
activity.lockTaskLaunchMode = sa.getInt(R.styleable.AndroidManifestActivity_lockTaskMode, 0);
|
||||
activity.maxRecents = sa.getInt(R.styleable.AndroidManifestActivity_maxRecents, ActivityTaskManager.getDefaultAppRecentsLimitStatic());
|
||||
activity.persistableMode = sa.getInteger(R.styleable.AndroidManifestActivity_persistableMode, ActivityInfo.PERSIST_ROOT_ONLY);
|
||||
activity.requestedVrComponent = sa.getString(R.styleable.AndroidManifestActivity_enableVrMode);
|
||||
activity.rotationAnimation = sa.getInt(R.styleable.AndroidManifestActivity_rotationAnimation, WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED);
|
||||
activity.softInputMode = sa.getInt(R.styleable.AndroidManifestActivity_windowSoftInputMode, 0);
|
||||
|
||||
activity.configChanges = getActivityConfigChanges(
|
||||
sa.getInt(R.styleable.AndroidManifestActivity_configChanges, 0),
|
||||
sa.getInt(R.styleable.AndroidManifestActivity_recreateOnConfigChanges, 0));
|
||||
activity.setColorMode(sa.getInt(R.styleable.AndroidManifestActivity_colorMode, ActivityInfo.COLOR_MODE_DEFAULT))
|
||||
.setDocumentLaunchMode(sa.getInt(R.styleable.AndroidManifestActivity_documentLaunchMode, ActivityInfo.DOCUMENT_LAUNCH_NONE))
|
||||
.setLaunchMode(sa.getInt(R.styleable.AndroidManifestActivity_launchMode, ActivityInfo.LAUNCH_MULTIPLE))
|
||||
.setLockTaskLaunchMode(sa.getInt(R.styleable.AndroidManifestActivity_lockTaskMode, 0))
|
||||
.setMaxRecents(sa.getInt(R.styleable.AndroidManifestActivity_maxRecents, ActivityTaskManager.getDefaultAppRecentsLimitStatic()))
|
||||
.setPersistableMode(sa.getInteger(R.styleable.AndroidManifestActivity_persistableMode, ActivityInfo.PERSIST_ROOT_ONLY))
|
||||
.setRequestedVrComponent(sa.getString(R.styleable.AndroidManifestActivity_enableVrMode))
|
||||
.setRotationAnimation(sa.getInt(R.styleable.AndroidManifestActivity_rotationAnimation, WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED))
|
||||
.setSoftInputMode(sa.getInt(R.styleable.AndroidManifestActivity_windowSoftInputMode, 0))
|
||||
.setConfigChanges(getActivityConfigChanges(
|
||||
sa.getInt(R.styleable.AndroidManifestActivity_configChanges, 0),
|
||||
sa.getInt(R.styleable.AndroidManifestActivity_recreateOnConfigChanges, 0))
|
||||
);
|
||||
|
||||
int screenOrientation = sa.getInt(R.styleable.AndroidManifestActivity_screenOrientation, SCREEN_ORIENTATION_UNSPECIFIED);
|
||||
int resizeMode = getActivityResizeMode(pkg, sa, screenOrientation);
|
||||
activity.screenOrientation = screenOrientation;
|
||||
activity.resizeMode = resizeMode;
|
||||
activity.setScreenOrientation(screenOrientation)
|
||||
.setResizeMode(resizeMode);
|
||||
|
||||
if (sa.hasValue(R.styleable.AndroidManifestActivity_maxAspectRatio)
|
||||
&& sa.getType(R.styleable.AndroidManifestActivity_maxAspectRatio)
|
||||
@@ -189,9 +189,9 @@ public class ParsedActivityUtils {
|
||||
0 /*default*/));
|
||||
}
|
||||
} else {
|
||||
activity.launchMode = ActivityInfo.LAUNCH_MULTIPLE;
|
||||
activity.configChanges = 0;
|
||||
activity.flags |= flag(ActivityInfo.FLAG_SINGLE_USER, R.styleable.AndroidManifestActivity_singleUser, sa);
|
||||
activity.setLaunchMode(ActivityInfo.LAUNCH_MULTIPLE)
|
||||
.setConfigChanges(0)
|
||||
.setFlags(activity.getFlags()|flag(ActivityInfo.FLAG_SINGLE_USER, R.styleable.AndroidManifestActivity_singleUser, sa));
|
||||
}
|
||||
// @formatter:on
|
||||
|
||||
@@ -205,11 +205,11 @@ public class ParsedActivityUtils {
|
||||
return input.error(affinityNameResult);
|
||||
}
|
||||
|
||||
activity.taskAffinity = affinityNameResult.getResult();
|
||||
activity.setTaskAffinity(affinityNameResult.getResult());
|
||||
|
||||
boolean visibleToEphemeral = sa.getBoolean(R.styleable.AndroidManifestActivity_visibleToInstantApps, false);
|
||||
if (visibleToEphemeral) {
|
||||
activity.flags |= ActivityInfo.FLAG_VISIBLE_TO_INSTANT_APP;
|
||||
activity.setFlags(activity.getFlags() | ActivityInfo.FLAG_VISIBLE_TO_INSTANT_APP);
|
||||
pkg.setVisibleToInstantApps(true);
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ public class ParsedActivityUtils {
|
||||
Log.e(TAG, "Activity " + activity.getName()
|
||||
+ " specified invalid parentActivityName " + parentActivityName);
|
||||
} else {
|
||||
activity.setParentActivity(parentClassName);
|
||||
activity.setParentActivityName(parentClassName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ public class ParsedActivityUtils {
|
||||
|
||||
final boolean setExported = array.hasValue(exportedAttr);
|
||||
if (setExported) {
|
||||
activity.exported = array.getBoolean(exportedAttr, false);
|
||||
activity.setExported(array.getBoolean(exportedAttr, false));
|
||||
}
|
||||
|
||||
final int depth = parser.getDepth();
|
||||
@@ -355,7 +355,7 @@ public class ParsedActivityUtils {
|
||||
if (intentResult.isSuccess()) {
|
||||
ParsedIntentInfo intent = intentResult.getResult();
|
||||
if (intent != null) {
|
||||
activity.order = Math.max(intent.getOrder(), activity.order);
|
||||
activity.setOrder(Math.max(intent.getOrder(), activity.getOrder()));
|
||||
activity.addIntent(intent);
|
||||
if (LOG_UNSAFE_BROADCASTS && isReceiver
|
||||
&& pkg.getTargetSdkVersion() >= Build.VERSION_CODES.O) {
|
||||
@@ -396,7 +396,7 @@ public class ParsedActivityUtils {
|
||||
ParseResult<ActivityInfo.WindowLayout> layoutResult =
|
||||
parseActivityWindowLayout(resources, parser, input);
|
||||
if (layoutResult.isSuccess()) {
|
||||
activity.windowLayout = layoutResult.getResult();
|
||||
activity.setWindowLayout(layoutResult.getResult());
|
||||
}
|
||||
result = layoutResult;
|
||||
} else {
|
||||
@@ -408,13 +408,13 @@ public class ParsedActivityUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if (!isAlias && activity.launchMode != LAUNCH_SINGLE_INSTANCE_PER_TASK
|
||||
&& activity.metaData != null && activity.metaData.containsKey(
|
||||
if (!isAlias && activity.getLaunchMode() != LAUNCH_SINGLE_INSTANCE_PER_TASK
|
||||
&& activity.getMetaData() != null && activity.getMetaData().containsKey(
|
||||
ParsingPackageUtils.METADATA_ACTIVITY_LAUNCH_MODE)) {
|
||||
final String launchMode = activity.metaData.getString(
|
||||
final String launchMode = activity.getMetaData().getString(
|
||||
ParsingPackageUtils.METADATA_ACTIVITY_LAUNCH_MODE);
|
||||
if (launchMode != null && launchMode.equals("singleInstancePerTask")) {
|
||||
activity.launchMode = LAUNCH_SINGLE_INSTANCE_PER_TASK;
|
||||
activity.setLaunchMode(LAUNCH_SINGLE_INSTANCE_PER_TASK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ public class ParsedActivityUtils {
|
||||
if (layoutResult.isError()) {
|
||||
return input.error(layoutResult);
|
||||
}
|
||||
activity.windowLayout = layoutResult.getResult();
|
||||
activity.setWindowLayout(layoutResult.getResult());
|
||||
|
||||
if (!setExported) {
|
||||
boolean hasIntentFilters = activity.getIntents().size() > 0;
|
||||
@@ -437,7 +437,7 @@ public class ParsedActivityUtils {
|
||||
return input.error(exportedCheckResult);
|
||||
}
|
||||
}
|
||||
activity.exported = hasIntentFilters;
|
||||
activity.setExported(hasIntentFilters);
|
||||
}
|
||||
|
||||
return input.success(activity);
|
||||
@@ -459,10 +459,11 @@ public class ParsedActivityUtils {
|
||||
ParsedIntentInfo intent = result.getResult();
|
||||
if (intent != null) {
|
||||
if (intent.isVisibleToInstantApp()) {
|
||||
activity.flags |= ActivityInfo.FLAG_VISIBLE_TO_INSTANT_APP;
|
||||
activity.setFlags(activity.getFlags() | ActivityInfo.FLAG_VISIBLE_TO_INSTANT_APP);
|
||||
}
|
||||
if (intent.isImplicitlyVisibleToInstantApp()) {
|
||||
activity.flags |= ActivityInfo.FLAG_IMPLICITLY_VISIBLE_TO_INSTANT_APP;
|
||||
activity.setFlags(
|
||||
activity.getFlags() | ActivityInfo.FLAG_IMPLICITLY_VISIBLE_TO_INSTANT_APP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,19 +554,19 @@ public class ParsedActivityUtils {
|
||||
private static ParseResult<ActivityInfo.WindowLayout> resolveActivityWindowLayout(
|
||||
ParsedActivity activity, ParseInput input) {
|
||||
// There isn't a metadata for us to fall back. Whatever is in layout is correct.
|
||||
if (activity.metaData == null || !activity.metaData.containsKey(
|
||||
if (activity.getMetaData() == null || !activity.getMetaData().containsKey(
|
||||
ParsingPackageUtils.METADATA_ACTIVITY_WINDOW_LAYOUT_AFFINITY)) {
|
||||
return input.success(activity.windowLayout);
|
||||
return input.success(activity.getWindowLayout());
|
||||
}
|
||||
|
||||
// Layout already specifies a value. We should just use that one.
|
||||
if (activity.windowLayout != null && activity.windowLayout.windowLayoutAffinity != null) {
|
||||
return input.success(activity.windowLayout);
|
||||
if (activity.getWindowLayout() != null && activity.getWindowLayout().windowLayoutAffinity != null) {
|
||||
return input.success(activity.getWindowLayout());
|
||||
}
|
||||
|
||||
String windowLayoutAffinity = activity.metaData.getString(
|
||||
String windowLayoutAffinity = activity.getMetaData().getString(
|
||||
ParsingPackageUtils.METADATA_ACTIVITY_WINDOW_LAYOUT_AFFINITY);
|
||||
ActivityInfo.WindowLayout layout = activity.windowLayout;
|
||||
ActivityInfo.WindowLayout layout = activity.getWindowLayout();
|
||||
if (layout == null) {
|
||||
layout = new ActivityInfo.WindowLayout(-1 /* width */, -1 /* widthFraction */,
|
||||
-1 /* height */, -1 /* heightFraction */, Gravity.NO_GRAVITY,
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.List;
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@DataClass(genAidl = false)
|
||||
@DataClass(genAidl = false, genSetters = true, genBuilder = false)
|
||||
public class ParsedAttribution implements Parcelable {
|
||||
/** Maximum length of attribution tag */
|
||||
public static final int MAX_ATTRIBUTION_TAG_LEN = 50;
|
||||
@@ -43,13 +43,15 @@ public class ParsedAttribution implements Parcelable {
|
||||
private static final int MAX_NUM_ATTRIBUTIONS = 10000;
|
||||
|
||||
/** Tag of the attribution */
|
||||
public final @NonNull String tag;
|
||||
private @NonNull String tag;
|
||||
|
||||
/** User visible label fo the attribution */
|
||||
public final @StringRes int label;
|
||||
private @StringRes int label;
|
||||
|
||||
/** Ids of previously declared attributions this attribution inherits from */
|
||||
public final @NonNull List<String> inheritFrom;
|
||||
private @NonNull List<String> inheritFrom;
|
||||
|
||||
public ParsedAttribution() {}
|
||||
|
||||
/**
|
||||
* @return Is this set of attributions a valid combination for a single package?
|
||||
@@ -160,6 +162,63 @@ public class ParsedAttribution implements Parcelable {
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag of the attribution
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* User visible label fo the attribution
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @StringRes int getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ids of previously declared attributions this attribution inherits from
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull List<String> getInheritFrom() {
|
||||
return inheritFrom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag of the attribution
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull ParsedAttribution setTag(@NonNull String value) {
|
||||
tag = value;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, tag);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* User visible label fo the attribution
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull ParsedAttribution setLabel(@StringRes int value) {
|
||||
label = value;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
StringRes.class, null, label);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ids of previously declared attributions this attribution inherits from
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull ParsedAttribution setInheritFrom(@NonNull List<String> value) {
|
||||
inheritFrom = value;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, inheritFrom);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
@@ -215,10 +274,10 @@ public class ParsedAttribution implements Parcelable {
|
||||
};
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1618351459610L,
|
||||
time = 1624050667337L,
|
||||
codegenVersion = "1.0.23",
|
||||
sourceFile = "frameworks/base/core/java/android/content/pm/parsing/component/ParsedAttribution.java",
|
||||
inputSignatures = "public static final int MAX_ATTRIBUTION_TAG_LEN\nprivate static final int MAX_NUM_ATTRIBUTIONS\npublic final @android.annotation.NonNull java.lang.String tag\npublic final @android.annotation.StringRes int label\npublic final @android.annotation.NonNull java.util.List<java.lang.String> inheritFrom\npublic static boolean isCombinationValid(java.util.List<android.content.pm.parsing.component.ParsedAttribution>)\nclass ParsedAttribution extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genAidl=false)")
|
||||
inputSignatures = "public static final int MAX_ATTRIBUTION_TAG_LEN\nprivate static final int MAX_NUM_ATTRIBUTIONS\nprivate @android.annotation.NonNull java.lang.String tag\nprivate @android.annotation.StringRes int label\nprivate @android.annotation.NonNull java.util.List<java.lang.String> inheritFrom\npublic static boolean isCombinationValid(java.util.List<android.content.pm.parsing.component.ParsedAttribution>)\nclass ParsedAttribution extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genAidl=false, genSetters=true, genBuilder=false)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
@@ -48,33 +48,33 @@ public abstract class ParsedComponent implements Parcelable {
|
||||
|
||||
@NonNull
|
||||
@DataClass.ParcelWith(ForInternedString.class)
|
||||
private String name;
|
||||
int icon;
|
||||
int labelRes;
|
||||
protected String name;
|
||||
protected int icon;
|
||||
protected int labelRes;
|
||||
@Nullable
|
||||
CharSequence nonLocalizedLabel;
|
||||
int logo;
|
||||
int banner;
|
||||
int descriptionRes;
|
||||
protected CharSequence nonLocalizedLabel;
|
||||
protected int logo;
|
||||
protected int banner;
|
||||
protected int descriptionRes;
|
||||
|
||||
// TODO(b/135203078): Replace flags with individual booleans, scoped by subclass
|
||||
int flags;
|
||||
protected int flags;
|
||||
|
||||
@NonNull
|
||||
@DataClass.ParcelWith(ForInternedString.class)
|
||||
private String packageName;
|
||||
protected String packageName;
|
||||
|
||||
@Nullable
|
||||
@DataClass.PluralOf("intent")
|
||||
@DataClass.ParcelWith(ParsedIntentInfo.ListParceler.class)
|
||||
private List<ParsedIntentInfo> intents;
|
||||
protected List<ParsedIntentInfo> intents;
|
||||
|
||||
private ComponentName componentName;
|
||||
protected ComponentName componentName;
|
||||
|
||||
@Nullable
|
||||
protected Bundle metaData;
|
||||
|
||||
private Map<String, Property> mProperties = emptyMap();
|
||||
protected Map<String, Property> mProperties = emptyMap();
|
||||
|
||||
ParsedComponent() {
|
||||
|
||||
@@ -112,11 +112,51 @@ public abstract class ParsedComponent implements Parcelable {
|
||||
return intents != null ? intents : Collections.emptyList();
|
||||
}
|
||||
|
||||
public ParsedComponent setBanner(int banner) {
|
||||
this.banner = banner;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedComponent setDescriptionRes(int descriptionRes) {
|
||||
this.descriptionRes = descriptionRes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedComponent setFlags(int flags) {
|
||||
this.flags = flags;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedComponent setIcon(int icon) {
|
||||
this.icon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedComponent setLabelRes(int labelRes) {
|
||||
this.labelRes = labelRes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedComponent setLogo(int logo) {
|
||||
this.logo = logo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedComponent setMetaData(Bundle metaData) {
|
||||
this.metaData = metaData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedComponent setName(String name) {
|
||||
this.name = TextUtils.safeIntern(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedComponent setNonLocalizedLabel(CharSequence nonLocalizedLabel) {
|
||||
this.nonLocalizedLabel = nonLocalizedLabel;
|
||||
return this;
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
public void setPackageName(@NonNull String packageName) {
|
||||
this.packageName = TextUtils.safeIntern(packageName);
|
||||
|
||||
@@ -56,40 +56,40 @@ class ParsedComponentUtils {
|
||||
}
|
||||
|
||||
//noinspection ConstantConditions; null check done above with isEmpty
|
||||
component.setName(className);
|
||||
component.setPackageName(packageName);
|
||||
component.setName(className)
|
||||
.setPackageName(packageName);
|
||||
|
||||
int roundIconVal = useRoundIcon ? array.getResourceId(roundIconAttr, 0) : 0;
|
||||
if (roundIconVal != 0) {
|
||||
component.icon = roundIconVal;
|
||||
component.nonLocalizedLabel = null;
|
||||
component.setIcon(roundIconVal)
|
||||
.setNonLocalizedLabel(null);
|
||||
} else {
|
||||
int iconVal = array.getResourceId(iconAttr, 0);
|
||||
if (iconVal != 0) {
|
||||
component.icon = iconVal;
|
||||
component.nonLocalizedLabel = null;
|
||||
component.setIcon(iconVal);
|
||||
component.setNonLocalizedLabel(null);
|
||||
}
|
||||
}
|
||||
|
||||
int logoVal = array.getResourceId(logoAttr, 0);
|
||||
if (logoVal != 0) {
|
||||
component.logo = logoVal;
|
||||
component.setLogo(logoVal);
|
||||
}
|
||||
|
||||
int bannerVal = array.getResourceId(bannerAttr, 0);
|
||||
if (bannerVal != 0) {
|
||||
component.banner = bannerVal;
|
||||
component.setBanner(bannerVal);
|
||||
}
|
||||
|
||||
if (descriptionAttr != null) {
|
||||
component.descriptionRes = array.getResourceId(descriptionAttr, 0);
|
||||
component.setDescriptionRes(array.getResourceId(descriptionAttr, 0));
|
||||
}
|
||||
|
||||
TypedValue v = array.peekValue(labelAttr);
|
||||
if (v != null) {
|
||||
component.labelRes = v.resourceId;
|
||||
component.setLabelRes(v.resourceId);
|
||||
if (v.resourceId == 0) {
|
||||
component.nonLocalizedLabel = v.coerceToString();
|
||||
component.setNonLocalizedLabel(v.coerceToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,9 +105,9 @@ class ParsedComponentUtils {
|
||||
}
|
||||
final Property property = result.getResult();
|
||||
if (property != null) {
|
||||
component.metaData = property.toBundle(component.metaData);
|
||||
component.setMetaData(property.toBundle(component.getMetaData()));
|
||||
}
|
||||
return input.success(component.metaData);
|
||||
return input.success(component.getMetaData());
|
||||
}
|
||||
|
||||
static ParseResult<Property> addProperty(ParsedComponent component, ParsingPackage pkg,
|
||||
|
||||
@@ -36,18 +36,30 @@ public class ParsedInstrumentation extends ParsedComponent {
|
||||
@Nullable
|
||||
@DataClass.ParcelWith(ForInternedString.class)
|
||||
private String targetProcesses;
|
||||
boolean handleProfiling;
|
||||
boolean functionalTest;
|
||||
private boolean handleProfiling;
|
||||
private boolean functionalTest;
|
||||
|
||||
public ParsedInstrumentation() {
|
||||
}
|
||||
|
||||
public void setTargetPackage(@Nullable String targetPackage) {
|
||||
this.targetPackage = TextUtils.safeIntern(targetPackage);
|
||||
public ParsedInstrumentation setFunctionalTest(boolean functionalTest) {
|
||||
this.functionalTest = functionalTest;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setTargetProcesses(@Nullable String targetProcesses) {
|
||||
public ParsedInstrumentation setHandleProfiling(boolean handleProfiling) {
|
||||
this.handleProfiling = handleProfiling;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedInstrumentation setTargetPackage(@Nullable String targetPackage) {
|
||||
this.targetPackage = TextUtils.safeIntern(targetPackage);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedInstrumentation setTargetProcesses(@Nullable String targetProcesses) {
|
||||
this.targetProcesses = TextUtils.safeIntern(targetProcesses);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
@@ -59,10 +59,10 @@ public class ParsedInstrumentationUtils {
|
||||
// @formatter:off
|
||||
// Note: don't allow this value to be a reference to a resource
|
||||
// that may change.
|
||||
instrumentation.setTargetPackage(sa.getNonResourceString(R.styleable.AndroidManifestInstrumentation_targetPackage));
|
||||
instrumentation.setTargetProcesses(sa.getNonResourceString(R.styleable.AndroidManifestInstrumentation_targetProcesses));
|
||||
instrumentation.handleProfiling = sa.getBoolean(R.styleable.AndroidManifestInstrumentation_handleProfiling, false);
|
||||
instrumentation.functionalTest = sa.getBoolean(R.styleable.AndroidManifestInstrumentation_functionalTest, false);
|
||||
instrumentation.setTargetPackage(sa.getNonResourceString(R.styleable.AndroidManifestInstrumentation_targetPackage))
|
||||
.setTargetProcesses(sa.getNonResourceString(R.styleable.AndroidManifestInstrumentation_targetProcesses))
|
||||
.setHandleProfiling(sa.getBoolean(R.styleable.AndroidManifestInstrumentation_handleProfiling, false))
|
||||
.setFunctionalTest(sa.getBoolean(R.styleable.AndroidManifestInstrumentation_functionalTest, false));
|
||||
// @formatter:on
|
||||
} finally {
|
||||
sa.recycle();
|
||||
|
||||
@@ -31,6 +31,26 @@ public final class ParsedIntentInfo extends IntentFilter {
|
||||
|
||||
public static final Parceler PARCELER = new Parceler();
|
||||
|
||||
public ParsedIntentInfo setHasDefault(boolean hasDefault) {
|
||||
this.hasDefault = hasDefault;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedIntentInfo setIcon(int icon) {
|
||||
this.icon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedIntentInfo setLabelRes(int labelRes) {
|
||||
this.labelRes = labelRes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedIntentInfo setNonLocalizedLabel(CharSequence nonLocalizedLabel) {
|
||||
this.nonLocalizedLabel = nonLocalizedLabel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static class Parceler implements Parcelling<ParsedIntentInfo> {
|
||||
|
||||
@Override
|
||||
@@ -135,11 +155,11 @@ public final class ParsedIntentInfo extends IntentFilter {
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasDefault;
|
||||
int labelRes;
|
||||
private boolean hasDefault;
|
||||
private int labelRes;
|
||||
@Nullable
|
||||
CharSequence nonLocalizedLabel;
|
||||
int icon;
|
||||
private CharSequence nonLocalizedLabel;
|
||||
private int icon;
|
||||
|
||||
public ParsedIntentInfo() {
|
||||
}
|
||||
|
||||
@@ -60,19 +60,20 @@ public class ParsedIntentInfoUtils {
|
||||
|
||||
TypedValue v = sa.peekValue(R.styleable.AndroidManifestIntentFilter_label);
|
||||
if (v != null) {
|
||||
intentInfo.labelRes = v.resourceId;
|
||||
intentInfo.setLabelRes(v.resourceId);
|
||||
if (v.resourceId == 0) {
|
||||
intentInfo.nonLocalizedLabel = v.coerceToString();
|
||||
intentInfo.setNonLocalizedLabel(v.coerceToString());
|
||||
}
|
||||
}
|
||||
|
||||
if (ParsingPackageUtils.sUseRoundIcon) {
|
||||
intentInfo.icon = sa.getResourceId(
|
||||
R.styleable.AndroidManifestIntentFilter_roundIcon, 0);
|
||||
intentInfo.setIcon(sa.getResourceId(
|
||||
R.styleable.AndroidManifestIntentFilter_roundIcon, 0));
|
||||
}
|
||||
|
||||
if (intentInfo.icon == 0) {
|
||||
intentInfo.icon = sa.getResourceId(R.styleable.AndroidManifestIntentFilter_icon, 0);
|
||||
if (intentInfo.getIcon() == 0) {
|
||||
intentInfo.setIcon(
|
||||
sa.getResourceId(R.styleable.AndroidManifestIntentFilter_icon, 0));
|
||||
}
|
||||
|
||||
if (allowAutoVerify) {
|
||||
@@ -140,7 +141,7 @@ public class ParsedIntentInfoUtils {
|
||||
}
|
||||
}
|
||||
|
||||
intentInfo.hasDefault = intentInfo.hasCategory(Intent.CATEGORY_DEFAULT);
|
||||
intentInfo.setHasDefault(intentInfo.hasCategory(Intent.CATEGORY_DEFAULT));
|
||||
|
||||
if (DEBUG) {
|
||||
final StringBuilder cats = new StringBuilder("Intent d=");
|
||||
|
||||
@@ -31,16 +31,16 @@ public class ParsedMainComponent extends ParsedComponent {
|
||||
|
||||
@Nullable
|
||||
@DataClass.ParcelWith(ForInternedString.class)
|
||||
private String processName;
|
||||
boolean directBootAware;
|
||||
boolean enabled = true;
|
||||
boolean exported;
|
||||
int order;
|
||||
protected String processName;
|
||||
protected boolean directBootAware;
|
||||
protected boolean enabled = true;
|
||||
protected boolean exported;
|
||||
protected int order;
|
||||
|
||||
@Nullable
|
||||
String splitName;
|
||||
protected String splitName;
|
||||
@Nullable
|
||||
String[] attributionTags;
|
||||
protected String[] attributionTags;
|
||||
|
||||
public ParsedMainComponent() {
|
||||
}
|
||||
@@ -56,6 +56,11 @@ public class ParsedMainComponent extends ParsedComponent {
|
||||
this.attributionTags = other.attributionTags;
|
||||
}
|
||||
|
||||
public ParsedMainComponent setOrder(int order) {
|
||||
this.order = order;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedMainComponent setProcessName(String processName) {
|
||||
this.processName = TextUtils.safeIntern(processName);
|
||||
return this;
|
||||
|
||||
@@ -58,14 +58,14 @@ class ParsedMainComponentUtils {
|
||||
}
|
||||
|
||||
if (directBootAwareAttr != null) {
|
||||
component.directBootAware = array.getBoolean(directBootAwareAttr, false);
|
||||
component.setDirectBootAware(array.getBoolean(directBootAwareAttr, false));
|
||||
if (component.isDirectBootAware()) {
|
||||
pkg.setPartiallyDirectBootAware(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (enabledAttr != null) {
|
||||
component.enabled = array.getBoolean(enabledAttr, true);
|
||||
component.setEnabled(array.getBoolean(enabledAttr, true));
|
||||
}
|
||||
|
||||
if (processAttr != null) {
|
||||
@@ -92,13 +92,13 @@ class ParsedMainComponentUtils {
|
||||
}
|
||||
|
||||
if (splitNameAttr != null) {
|
||||
component.splitName = array.getNonConfigurationString(splitNameAttr, 0);
|
||||
component.setSplitName(array.getNonConfigurationString(splitNameAttr, 0));
|
||||
}
|
||||
|
||||
if (attributionTagsAttr != null) {
|
||||
final String attributionTags = array.getNonConfigurationString(attributionTagsAttr, 0);
|
||||
if (attributionTags != null) {
|
||||
component.attributionTags = attributionTags.split("\\|");
|
||||
component.setAttributionTags(attributionTags.split("\\|"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,17 +38,17 @@ public class ParsedPermission extends ParsedComponent {
|
||||
private static ForStringSet sForStringSet = Parcelling.Cache.getOrCreate(ForStringSet.class);
|
||||
|
||||
@Nullable
|
||||
String backgroundPermission;
|
||||
private String backgroundPermission;
|
||||
@Nullable
|
||||
@DataClass.ParcelWith(ForInternedString.class)
|
||||
private String group;
|
||||
int requestRes;
|
||||
int protectionLevel;
|
||||
boolean tree;
|
||||
private int requestRes;
|
||||
private int protectionLevel;
|
||||
private boolean tree;
|
||||
@Nullable
|
||||
private ParsedPermissionGroup parsedPermissionGroup;
|
||||
@Nullable
|
||||
Set<String> knownCerts;
|
||||
private Set<String> knownCerts;
|
||||
|
||||
@VisibleForTesting
|
||||
public ParsedPermission() {
|
||||
@@ -64,13 +64,13 @@ public class ParsedPermission extends ParsedComponent {
|
||||
this.parsedPermissionGroup = other.parsedPermissionGroup;
|
||||
}
|
||||
|
||||
public ParsedPermission setGroup(String group) {
|
||||
this.group = TextUtils.safeIntern(group);
|
||||
public ParsedPermission setBackgroundPermission(String backgroundPermission) {
|
||||
this.backgroundPermission = backgroundPermission;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedPermission setFlags(int flags) {
|
||||
this.flags = flags;
|
||||
public ParsedPermission setGroup(String group) {
|
||||
this.group = TextUtils.safeIntern(group);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -116,6 +116,21 @@ public class ParsedPermission extends ParsedComponent {
|
||||
return size;
|
||||
}
|
||||
|
||||
public ParsedPermission setKnownCerts(Set<String> knownCerts) {
|
||||
this.knownCerts = knownCerts;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedPermission setRequestRes(int requestRes) {
|
||||
this.requestRes = requestRes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedPermission setTree(boolean tree) {
|
||||
this.tree = tree;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Permission{"
|
||||
+ Integer.toHexString(System.identityHashCode(this))
|
||||
|
||||
@@ -22,17 +22,15 @@ import android.os.Parcelable;
|
||||
import com.android.internal.util.DataClass;
|
||||
|
||||
/** @hide */
|
||||
@DataClass(genGetters = true, genSetters = true, genBuilder = false, genParcelable = true,
|
||||
genAidl = false)
|
||||
public class ParsedPermissionGroup extends ParsedComponent {
|
||||
|
||||
int requestDetailResourceId;
|
||||
int backgroundRequestResourceId;
|
||||
int backgroundRequestDetailResourceId;
|
||||
int requestRes;
|
||||
int priority;
|
||||
|
||||
public void setPriority(int priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
private int requestDetailResourceId;
|
||||
private int backgroundRequestResourceId;
|
||||
private int backgroundRequestDetailResourceId;
|
||||
private int requestRes;
|
||||
private int priority;
|
||||
|
||||
public String toString() {
|
||||
return "PermissionGroup{"
|
||||
@@ -40,63 +38,162 @@ public class ParsedPermissionGroup extends ParsedComponent {
|
||||
+ " " + getName() + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeInt(this.requestDetailResourceId);
|
||||
dest.writeInt(this.backgroundRequestResourceId);
|
||||
dest.writeInt(this.backgroundRequestDetailResourceId);
|
||||
dest.writeInt(this.requestRes);
|
||||
dest.writeInt(this.priority);
|
||||
}
|
||||
|
||||
public ParsedPermissionGroup() {
|
||||
}
|
||||
|
||||
protected ParsedPermissionGroup(Parcel in) {
|
||||
super(in);
|
||||
this.requestDetailResourceId = in.readInt();
|
||||
this.backgroundRequestResourceId = in.readInt();
|
||||
this.backgroundRequestDetailResourceId = in.readInt();
|
||||
this.requestRes = in.readInt();
|
||||
this.priority = in.readInt();
|
||||
|
||||
|
||||
// Code below generated by codegen v1.0.23.
|
||||
//
|
||||
// DO NOT MODIFY!
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
//
|
||||
// To regenerate run:
|
||||
// $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/parsing/component/ParsedPermissionGroup.java
|
||||
//
|
||||
// To exclude the generated code from IntelliJ auto-formatting enable (one-time):
|
||||
// Settings > Editor > Code Style > Formatter Control
|
||||
//@formatter:off
|
||||
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public ParsedPermissionGroup(
|
||||
int requestDetailResourceId,
|
||||
int backgroundRequestResourceId,
|
||||
int backgroundRequestDetailResourceId,
|
||||
int requestRes,
|
||||
int priority) {
|
||||
this.requestDetailResourceId = requestDetailResourceId;
|
||||
this.backgroundRequestResourceId = backgroundRequestResourceId;
|
||||
this.backgroundRequestDetailResourceId = backgroundRequestDetailResourceId;
|
||||
this.requestRes = requestRes;
|
||||
this.priority = priority;
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ParsedPermissionGroup> CREATOR =
|
||||
new Parcelable.Creator<ParsedPermissionGroup>() {
|
||||
@Override
|
||||
public ParsedPermissionGroup createFromParcel(Parcel source) {
|
||||
return new ParsedPermissionGroup(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsedPermissionGroup[] newArray(int size) {
|
||||
return new ParsedPermissionGroup[size];
|
||||
}
|
||||
};
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public int getRequestDetailResourceId() {
|
||||
return requestDetailResourceId;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public int getBackgroundRequestResourceId() {
|
||||
return backgroundRequestResourceId;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public int getBackgroundRequestDetailResourceId() {
|
||||
return backgroundRequestDetailResourceId;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public int getRequestRes() {
|
||||
return requestRes;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public int getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @android.annotation.NonNull ParsedPermissionGroup setRequestDetailResourceId( int value) {
|
||||
requestDetailResourceId = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @android.annotation.NonNull ParsedPermissionGroup setBackgroundRequestResourceId( int value) {
|
||||
backgroundRequestResourceId = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @android.annotation.NonNull ParsedPermissionGroup setBackgroundRequestDetailResourceId( int value) {
|
||||
backgroundRequestDetailResourceId = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @android.annotation.NonNull ParsedPermissionGroup setRequestRes( int value) {
|
||||
requestRes = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @android.annotation.NonNull ParsedPermissionGroup setPriority( int value) {
|
||||
priority = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public void writeToParcel(@android.annotation.NonNull Parcel dest, int flags) {
|
||||
// You can override field parcelling by defining methods like:
|
||||
// void parcelFieldName(Parcel dest, int flags) { ... }
|
||||
|
||||
super.writeToParcel(dest, flags);
|
||||
|
||||
dest.writeInt(requestDetailResourceId);
|
||||
dest.writeInt(backgroundRequestResourceId);
|
||||
dest.writeInt(backgroundRequestDetailResourceId);
|
||||
dest.writeInt(requestRes);
|
||||
dest.writeInt(priority);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public int describeContents() { return 0; }
|
||||
|
||||
/** @hide */
|
||||
@SuppressWarnings({"unchecked", "RedundantCast"})
|
||||
@DataClass.Generated.Member
|
||||
protected ParsedPermissionGroup(@android.annotation.NonNull Parcel in) {
|
||||
// You can override field unparcelling by defining methods like:
|
||||
// static FieldType unparcelFieldName(Parcel in) { ... }
|
||||
|
||||
super(in);
|
||||
|
||||
int _requestDetailResourceId = in.readInt();
|
||||
int _backgroundRequestResourceId = in.readInt();
|
||||
int _backgroundRequestDetailResourceId = in.readInt();
|
||||
int _requestRes = in.readInt();
|
||||
int _priority = in.readInt();
|
||||
|
||||
this.requestDetailResourceId = _requestDetailResourceId;
|
||||
this.backgroundRequestResourceId = _backgroundRequestResourceId;
|
||||
this.backgroundRequestDetailResourceId = _backgroundRequestDetailResourceId;
|
||||
this.requestRes = _requestRes;
|
||||
this.priority = _priority;
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public static final @android.annotation.NonNull Parcelable.Creator<ParsedPermissionGroup> CREATOR
|
||||
= new Parcelable.Creator<ParsedPermissionGroup>() {
|
||||
@Override
|
||||
public ParsedPermissionGroup[] newArray(int size) {
|
||||
return new ParsedPermissionGroup[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsedPermissionGroup createFromParcel(@android.annotation.NonNull Parcel in) {
|
||||
return new ParsedPermissionGroup(in);
|
||||
}
|
||||
};
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1624052057830L,
|
||||
codegenVersion = "1.0.23",
|
||||
sourceFile = "frameworks/base/core/java/android/content/pm/parsing/component/ParsedPermissionGroup.java",
|
||||
inputSignatures = "private int requestDetailResourceId\nprivate int backgroundRequestResourceId\nprivate int backgroundRequestDetailResourceId\nprivate int requestRes\nprivate int priority\npublic java.lang.String toString()\nclass ParsedPermissionGroup extends android.content.pm.parsing.component.ParsedComponent implements []\n@com.android.internal.util.DataClass(genGetters=true, genSetters=true, genBuilder=false, genParcelable=true, genAidl=false)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
//@formatter:on
|
||||
// End of generated code
|
||||
|
||||
}
|
||||
|
||||
@@ -66,9 +66,8 @@ public class ParsedPermissionUtils {
|
||||
if (sa.hasValue(
|
||||
R.styleable.AndroidManifestPermission_backgroundPermission)) {
|
||||
if ("android".equals(packageName)) {
|
||||
permission.backgroundPermission = sa.getNonResourceString(
|
||||
R.styleable
|
||||
.AndroidManifestPermission_backgroundPermission);
|
||||
permission.setBackgroundPermission(sa.getNonResourceString(
|
||||
R.styleable.AndroidManifestPermission_backgroundPermission));
|
||||
} else {
|
||||
Slog.w(TAG, packageName + " defines a background permission. Only the "
|
||||
+ "'android' package can do that.");
|
||||
@@ -78,17 +77,14 @@ public class ParsedPermissionUtils {
|
||||
// Note: don't allow this value to be a reference to a resource
|
||||
// that may change.
|
||||
permission.setGroup(sa.getNonResourceString(
|
||||
R.styleable.AndroidManifestPermission_permissionGroup));
|
||||
|
||||
permission.requestRes = sa.getResourceId(
|
||||
R.styleable.AndroidManifestPermission_request, 0);
|
||||
|
||||
permission.protectionLevel = sa.getInt(
|
||||
R.styleable.AndroidManifestPermission_protectionLevel,
|
||||
PermissionInfo.PROTECTION_NORMAL);
|
||||
|
||||
permission.flags = sa.getInt(
|
||||
R.styleable.AndroidManifestPermission_permissionFlags, 0);
|
||||
R.styleable.AndroidManifestPermission_permissionGroup))
|
||||
.setRequestRes(sa.getResourceId(
|
||||
R.styleable.AndroidManifestPermission_request, 0))
|
||||
.setProtectionLevel(sa.getInt(
|
||||
R.styleable.AndroidManifestPermission_protectionLevel,
|
||||
PermissionInfo.PROTECTION_NORMAL))
|
||||
.setFlags(sa.getInt(
|
||||
R.styleable.AndroidManifestPermission_permissionFlags, 0));
|
||||
|
||||
final int knownCertsResource = sa.getResourceId(
|
||||
R.styleable.AndroidManifestPermission_knownCerts, 0);
|
||||
@@ -108,7 +104,7 @@ public class ParsedPermissionUtils {
|
||||
permission.setKnownCert(knownCert);
|
||||
}
|
||||
}
|
||||
if (permission.knownCerts == null) {
|
||||
if (permission.getKnownCerts() == null) {
|
||||
Slog.w(TAG, packageName + " defines a knownSigner permission but"
|
||||
+ " the provided knownCerts resource is null");
|
||||
}
|
||||
@@ -124,12 +120,12 @@ public class ParsedPermissionUtils {
|
||||
|
||||
// For now only platform runtime permissions can be restricted
|
||||
if (!permission.isRuntime() || !"android".equals(permission.getPackageName())) {
|
||||
permission.flags &= ~PermissionInfo.FLAG_HARD_RESTRICTED;
|
||||
permission.flags &= ~PermissionInfo.FLAG_SOFT_RESTRICTED;
|
||||
permission.setFlags(permission.getFlags() & ~PermissionInfo.FLAG_HARD_RESTRICTED);
|
||||
permission.setFlags(permission.getFlags() & ~PermissionInfo.FLAG_SOFT_RESTRICTED);
|
||||
} else {
|
||||
// The platform does not get to specify conflicting permissions
|
||||
if ((permission.flags & PermissionInfo.FLAG_HARD_RESTRICTED) != 0
|
||||
&& (permission.flags & PermissionInfo.FLAG_SOFT_RESTRICTED) != 0) {
|
||||
if ((permission.getFlags() & PermissionInfo.FLAG_HARD_RESTRICTED) != 0
|
||||
&& (permission.getFlags() & PermissionInfo.FLAG_SOFT_RESTRICTED) != 0) {
|
||||
throw new IllegalStateException("Permission cannot be both soft and hard"
|
||||
+ " restricted: " + permission.getName());
|
||||
}
|
||||
@@ -138,7 +134,8 @@ public class ParsedPermissionUtils {
|
||||
sa.recycle();
|
||||
}
|
||||
|
||||
permission.protectionLevel = PermissionInfo.fixProtectionLevel(permission.protectionLevel);
|
||||
permission.setProtectionLevel(
|
||||
PermissionInfo.fixProtectionLevel(permission.getProtectionLevel()));
|
||||
|
||||
final int otherProtectionFlags = permission.getProtectionFlags()
|
||||
& ~(PermissionInfo.PROTECTION_FLAG_APPOP | PermissionInfo.PROTECTION_FLAG_INSTANT
|
||||
@@ -188,8 +185,8 @@ public class ParsedPermissionUtils {
|
||||
+ permission.getName());
|
||||
}
|
||||
|
||||
permission.protectionLevel = PermissionInfo.PROTECTION_NORMAL;
|
||||
permission.tree = true;
|
||||
permission.setProtectionLevel(PermissionInfo.PROTECTION_NORMAL)
|
||||
.setTree(true);
|
||||
|
||||
return ComponentParseUtils.parseAllMetaData(pkg, res, parser, tag, permission,
|
||||
input);
|
||||
@@ -219,12 +216,12 @@ public class ParsedPermissionUtils {
|
||||
}
|
||||
|
||||
// @formatter:off
|
||||
permissionGroup.requestDetailResourceId = sa.getResourceId(R.styleable.AndroidManifestPermissionGroup_requestDetail, 0);
|
||||
permissionGroup.backgroundRequestResourceId = sa.getResourceId(R.styleable.AndroidManifestPermissionGroup_backgroundRequest, 0);
|
||||
permissionGroup.backgroundRequestDetailResourceId = sa.getResourceId(R.styleable.AndroidManifestPermissionGroup_backgroundRequestDetail, 0);
|
||||
permissionGroup.requestRes = sa.getResourceId(R.styleable.AndroidManifestPermissionGroup_request, 0);
|
||||
permissionGroup.flags = sa.getInt(R.styleable.AndroidManifestPermissionGroup_permissionGroupFlags,0);
|
||||
permissionGroup.priority = sa.getInt(R.styleable.AndroidManifestPermissionGroup_priority, 0);
|
||||
permissionGroup.setRequestDetailResourceId(sa.getResourceId(R.styleable.AndroidManifestPermissionGroup_requestDetail, 0))
|
||||
.setBackgroundRequestResourceId(sa.getResourceId(R.styleable.AndroidManifestPermissionGroup_backgroundRequest, 0))
|
||||
.setBackgroundRequestDetailResourceId(sa.getResourceId(R.styleable.AndroidManifestPermissionGroup_backgroundRequestDetail, 0))
|
||||
.setRequestRes(sa.getResourceId(R.styleable.AndroidManifestPermissionGroup_request, 0))
|
||||
.setPriority(sa.getInt(R.styleable.AndroidManifestPermissionGroup_priority, 0))
|
||||
.setFlags(sa.getInt(R.styleable.AndroidManifestPermissionGroup_permissionGroupFlags,0));
|
||||
// @formatter:on
|
||||
} finally {
|
||||
sa.recycle();
|
||||
|
||||
@@ -32,22 +32,22 @@ import com.android.internal.util.Parcelling;
|
||||
import java.util.Set;
|
||||
|
||||
/** @hide */
|
||||
@DataClass(genGetters = true, genSetters = false, genParcelable = true, genAidl = false,
|
||||
@DataClass(genGetters = true, genSetters = true, genParcelable = true, genAidl = false,
|
||||
genBuilder = false)
|
||||
public class ParsedProcess implements Parcelable {
|
||||
|
||||
@NonNull
|
||||
protected String name;
|
||||
private String name;
|
||||
@NonNull
|
||||
@DataClass.ParcelWith(Parcelling.BuiltIn.ForInternedStringSet.class)
|
||||
protected Set<String> deniedPermissions = emptySet();
|
||||
private Set<String> deniedPermissions = emptySet();
|
||||
|
||||
@ApplicationInfo.GwpAsanMode
|
||||
protected int gwpAsanMode = ApplicationInfo.GWP_ASAN_DEFAULT;
|
||||
private int gwpAsanMode = ApplicationInfo.GWP_ASAN_DEFAULT;
|
||||
@ApplicationInfo.MemtagMode
|
||||
protected int memtagMode = ApplicationInfo.MEMTAG_DEFAULT;
|
||||
private int memtagMode = ApplicationInfo.MEMTAG_DEFAULT;
|
||||
@ApplicationInfo.NativeHeapZeroInitialized
|
||||
protected int nativeHeapZeroInitialized = ApplicationInfo.ZEROINIT_DEFAULT;
|
||||
private int nativeHeapZeroInitialized = ApplicationInfo.ZEROINIT_DEFAULT;
|
||||
|
||||
public ParsedProcess() {
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class ParsedProcess implements Parcelable {
|
||||
|
||||
|
||||
|
||||
// Code below generated by codegen v1.0.22.
|
||||
// Code below generated by codegen v1.0.23.
|
||||
//
|
||||
// DO NOT MODIFY!
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
@@ -127,6 +127,46 @@ public class ParsedProcess implements Parcelable {
|
||||
return nativeHeapZeroInitialized;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull ParsedProcess setName(@NonNull String value) {
|
||||
name = value;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull ParsedProcess setDeniedPermissions(@NonNull Set<String> value) {
|
||||
deniedPermissions = value;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, deniedPermissions);
|
||||
return this;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull ParsedProcess setGwpAsanMode(@ApplicationInfo.GwpAsanMode int value) {
|
||||
gwpAsanMode = value;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.GwpAsanMode.class, null, gwpAsanMode);
|
||||
return this;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull ParsedProcess setMemtagMode(@ApplicationInfo.MemtagMode int value) {
|
||||
memtagMode = value;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.MemtagMode.class, null, memtagMode);
|
||||
return this;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull ParsedProcess setNativeHeapZeroInitialized(@ApplicationInfo.NativeHeapZeroInitialized int value) {
|
||||
nativeHeapZeroInitialized = value;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.NativeHeapZeroInitialized.class, null, nativeHeapZeroInitialized);
|
||||
return this;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
static Parcelling<Set<String>> sParcellingForDeniedPermissions =
|
||||
Parcelling.Cache.get(
|
||||
@@ -202,10 +242,10 @@ public class ParsedProcess implements Parcelable {
|
||||
};
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1615850515058L,
|
||||
codegenVersion = "1.0.22",
|
||||
time = 1623692988845L,
|
||||
codegenVersion = "1.0.23",
|
||||
sourceFile = "frameworks/base/core/java/android/content/pm/parsing/component/ParsedProcess.java",
|
||||
inputSignatures = "protected @android.annotation.NonNull java.lang.String name\nprotected @android.annotation.NonNull @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedStringSet.class) java.util.Set<java.lang.String> deniedPermissions\nprotected @android.content.pm.ApplicationInfo.GwpAsanMode int gwpAsanMode\nprotected @android.content.pm.ApplicationInfo.MemtagMode int memtagMode\nprotected @android.content.pm.ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized\npublic void addStateFrom(android.content.pm.parsing.component.ParsedProcess)\nclass ParsedProcess extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genGetters=true, genSetters=false, genParcelable=true, genAidl=false, genBuilder=false)")
|
||||
inputSignatures = "private @android.annotation.NonNull java.lang.String name\nprivate @android.annotation.NonNull @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedStringSet.class) java.util.Set<java.lang.String> deniedPermissions\nprivate @android.content.pm.ApplicationInfo.GwpAsanMode int gwpAsanMode\nprivate @android.content.pm.ApplicationInfo.MemtagMode int memtagMode\nprivate @android.content.pm.ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized\npublic void addStateFrom(android.content.pm.parsing.component.ParsedProcess)\nclass ParsedProcess extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genGetters=true, genSetters=true, genParcelable=true, genAidl=false, genBuilder=false)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
@@ -85,31 +85,26 @@ public class ParsedProcessUtils {
|
||||
TypedArray sa = res.obtainAttributes(parser, R.styleable.AndroidManifestProcess);
|
||||
try {
|
||||
if (perms != null) {
|
||||
proc.deniedPermissions = new ArraySet<>(perms);
|
||||
proc.setDeniedPermissions(new ArraySet<>(perms));
|
||||
}
|
||||
|
||||
proc.name = sa.getNonConfigurationString(
|
||||
String processName = sa.getNonConfigurationString(
|
||||
R.styleable.AndroidManifestProcess_process, 0);
|
||||
ParseResult<String> processNameResult = ComponentParseUtils.buildProcessName(
|
||||
pkg.getPackageName(), pkg.getPackageName(), proc.name, flags, separateProcesses,
|
||||
pkg.getPackageName(), pkg.getPackageName(), processName, flags, separateProcesses,
|
||||
input);
|
||||
if (processNameResult.isError()) {
|
||||
return input.error(processNameResult);
|
||||
}
|
||||
|
||||
proc.name = processNameResult.getResult();
|
||||
|
||||
if (proc.name == null || proc.name.length() <= 0) {
|
||||
return input.error("<process> does not specify android:process");
|
||||
}
|
||||
|
||||
proc.gwpAsanMode = sa.getInt(R.styleable.AndroidManifestProcess_gwpAsanMode, -1);
|
||||
proc.memtagMode = sa.getInt(R.styleable.AndroidManifestProcess_memtagMode, -1);
|
||||
proc.setName(processNameResult.getResult());
|
||||
proc.setGwpAsanMode(sa.getInt(R.styleable.AndroidManifestProcess_gwpAsanMode, -1));
|
||||
proc.setMemtagMode(sa.getInt(R.styleable.AndroidManifestProcess_memtagMode, -1));
|
||||
if (sa.hasValue(R.styleable.AndroidManifestProcess_nativeHeapZeroInitialized)) {
|
||||
Boolean v = sa.getBoolean(
|
||||
R.styleable.AndroidManifestProcess_nativeHeapZeroInitialized, false);
|
||||
proc.nativeHeapZeroInitialized =
|
||||
v ? ApplicationInfo.ZEROINIT_ENABLED : ApplicationInfo.ZEROINIT_DISABLED;
|
||||
proc.setNativeHeapZeroInitialized(
|
||||
v ? ApplicationInfo.ZEROINIT_ENABLED : ApplicationInfo.ZEROINIT_DISABLED);
|
||||
}
|
||||
} finally {
|
||||
sa.recycle();
|
||||
@@ -129,18 +124,18 @@ public class ParsedProcessUtils {
|
||||
switch (tagName) {
|
||||
case "deny-permission":
|
||||
ParseResult<Set<String>> denyResult = parseDenyPermission(
|
||||
proc.deniedPermissions, res, parser, input);
|
||||
proc.getDeniedPermissions(), res, parser, input);
|
||||
result = denyResult;
|
||||
if (denyResult.isSuccess()) {
|
||||
proc.deniedPermissions = denyResult.getResult();
|
||||
proc.setDeniedPermissions(denyResult.getResult());
|
||||
}
|
||||
break;
|
||||
case "allow-permission":
|
||||
ParseResult<Set<String>> allowResult = parseAllowPermission(
|
||||
proc.deniedPermissions, res, parser, input);
|
||||
proc.getDeniedPermissions(), res, parser, input);
|
||||
result = allowResult;
|
||||
if (allowResult.isSuccess()) {
|
||||
proc.deniedPermissions = allowResult.getResult();
|
||||
proc.setDeniedPermissions(allowResult.getResult());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -198,9 +193,9 @@ public class ParsedProcessUtils {
|
||||
result = processResult;
|
||||
if (processResult.isSuccess()) {
|
||||
ParsedProcess process = processResult.getResult();
|
||||
if (processes.put(process.name, process) != null) {
|
||||
if (processes.put(process.getName(), process) != null) {
|
||||
result = input.error(
|
||||
"<process> specified existing name '" + process.name + "'");
|
||||
"<process> specified existing name '" + process.getName() + "'");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -36,21 +36,21 @@ public class ParsedProvider extends ParsedMainComponent {
|
||||
@NonNull
|
||||
@DataClass.ParcelWith(ForInternedString.class)
|
||||
private String authority;
|
||||
boolean syncable;
|
||||
private boolean syncable;
|
||||
@Nullable
|
||||
@DataClass.ParcelWith(ForInternedString.class)
|
||||
private String readPermission;
|
||||
@Nullable
|
||||
@DataClass.ParcelWith(ForInternedString.class)
|
||||
private String writePermission;
|
||||
boolean grantUriPermissions;
|
||||
boolean forceUriPermissions;
|
||||
boolean multiProcess;
|
||||
int initOrder;
|
||||
private boolean grantUriPermissions;
|
||||
private boolean forceUriPermissions;
|
||||
private boolean multiProcess;
|
||||
private int initOrder;
|
||||
@Nullable
|
||||
PatternMatcher[] uriPermissionPatterns;
|
||||
private PatternMatcher[] uriPermissionPatterns;
|
||||
@Nullable
|
||||
PathPermission[] pathPermissions;
|
||||
private PathPermission[] pathPermissions;
|
||||
|
||||
public ParsedProvider(ParsedProvider other) {
|
||||
super(other);
|
||||
@@ -67,24 +67,58 @@ public class ParsedProvider extends ParsedMainComponent {
|
||||
this.pathPermissions = other.pathPermissions;
|
||||
}
|
||||
|
||||
public void setAuthority(String authority) {
|
||||
public ParsedProvider setAuthority(String authority) {
|
||||
this.authority = TextUtils.safeIntern(authority);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setSyncable(boolean syncable) {
|
||||
public ParsedProvider setForceUriPermissions(boolean forceUriPermissions) {
|
||||
this.forceUriPermissions = forceUriPermissions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedProvider setGrantUriPermissions(boolean grantUriPermissions) {
|
||||
this.grantUriPermissions = grantUriPermissions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedProvider setInitOrder(int initOrder) {
|
||||
this.initOrder = initOrder;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedProvider setMultiProcess(boolean multiProcess) {
|
||||
this.multiProcess = multiProcess;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedProvider setPathPermissions(PathPermission[] pathPermissions) {
|
||||
this.pathPermissions = pathPermissions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedProvider setSyncable(boolean syncable) {
|
||||
this.syncable = syncable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setReadPermission(String readPermission) {
|
||||
public ParsedProvider setReadPermission(String readPermission) {
|
||||
// Empty string must be converted to null
|
||||
this.readPermission = TextUtils.isEmpty(readPermission)
|
||||
? null : readPermission.intern();
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setWritePermission(String writePermission) {
|
||||
public ParsedProvider setUriPermissionPatterns(PatternMatcher[] uriPermissionPatterns) {
|
||||
this.uriPermissionPatterns = uriPermissionPatterns;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedProvider setWritePermission(String writePermission) {
|
||||
// Empty string must be converted to null
|
||||
this.writePermission = TextUtils.isEmpty(writePermission)
|
||||
? null : writePermission.intern();
|
||||
return this;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
@@ -85,10 +85,10 @@ public class ParsedProviderUtils {
|
||||
// For compatibility, applications targeting API level 16 or lower
|
||||
// should have their content providers exported by default, unless they
|
||||
// specify otherwise.
|
||||
provider.exported = sa.getBoolean(R.styleable.AndroidManifestProvider_exported,
|
||||
targetSdkVersion < Build.VERSION_CODES.JELLY_BEAN_MR1);
|
||||
|
||||
provider.syncable = sa.getBoolean(R.styleable.AndroidManifestProvider_syncable, false);
|
||||
provider.setSyncable(sa.getBoolean(
|
||||
R.styleable.AndroidManifestProvider_syncable, false))
|
||||
.setExported(sa.getBoolean(R.styleable.AndroidManifestProvider_exported,
|
||||
targetSdkVersion < Build.VERSION_CODES.JELLY_BEAN_MR1));
|
||||
|
||||
String permission = sa.getNonConfigurationString(
|
||||
R.styleable.AndroidManifestProvider_permission, 0);
|
||||
@@ -113,16 +113,21 @@ public class ParsedProviderUtils {
|
||||
provider.setWritePermission(writePermission);
|
||||
}
|
||||
|
||||
provider.grantUriPermissions = sa.getBoolean(R.styleable.AndroidManifestProvider_grantUriPermissions, false);
|
||||
provider.forceUriPermissions = sa.getBoolean(R.styleable.AndroidManifestProvider_forceUriPermissions, false);
|
||||
provider.multiProcess = sa.getBoolean(R.styleable.AndroidManifestProvider_multiprocess, false);
|
||||
provider.initOrder = sa.getInt(R.styleable.AndroidManifestProvider_initOrder, 0);
|
||||
provider.setGrantUriPermissions(
|
||||
sa.getBoolean(R.styleable.AndroidManifestProvider_grantUriPermissions, false))
|
||||
.setForceUriPermissions(
|
||||
sa.getBoolean(R.styleable.AndroidManifestProvider_forceUriPermissions,
|
||||
false))
|
||||
.setMultiProcess(
|
||||
sa.getBoolean(R.styleable.AndroidManifestProvider_multiprocess, false))
|
||||
.setInitOrder(sa.getInt(R.styleable.AndroidManifestProvider_initOrder, 0))
|
||||
.setFlags(provider.getFlags() | flag(ProviderInfo.FLAG_SINGLE_USER,
|
||||
R.styleable.AndroidManifestProvider_singleUser, sa));
|
||||
|
||||
provider.flags |= flag(ProviderInfo.FLAG_SINGLE_USER, R.styleable.AndroidManifestProvider_singleUser, sa);
|
||||
|
||||
visibleToEphemeral = sa.getBoolean(R.styleable.AndroidManifestProvider_visibleToInstantApps, false);
|
||||
visibleToEphemeral = sa.getBoolean(
|
||||
R.styleable.AndroidManifestProvider_visibleToInstantApps, false);
|
||||
if (visibleToEphemeral) {
|
||||
provider.flags |= ProviderInfo.FLAG_VISIBLE_TO_INSTANT_APP;
|
||||
provider.setFlags(provider.getFlags() | ProviderInfo.FLAG_VISIBLE_TO_INSTANT_APP);
|
||||
pkg.setVisibleToInstantApps(true);
|
||||
}
|
||||
} finally {
|
||||
@@ -174,7 +179,7 @@ public class ParsedProviderUtils {
|
||||
result = intentResult;
|
||||
if (intentResult.isSuccess()) {
|
||||
ParsedIntentInfo intent = intentResult.getResult();
|
||||
provider.order = Math.max(intent.getOrder(), provider.order);
|
||||
provider.setOrder(Math.max(intent.getOrder(), provider.getOrder()));
|
||||
provider.addIntent(intent);
|
||||
}
|
||||
break;
|
||||
@@ -245,17 +250,17 @@ public class ParsedProviderUtils {
|
||||
}
|
||||
|
||||
if (pa != null) {
|
||||
if (provider.uriPermissionPatterns == null) {
|
||||
provider.uriPermissionPatterns = new PatternMatcher[1];
|
||||
provider.uriPermissionPatterns[0] = pa;
|
||||
if (provider.getUriPermissionPatterns() == null) {
|
||||
provider.setUriPermissionPatterns(new PatternMatcher[1]);
|
||||
provider.getUriPermissionPatterns()[0] = pa;
|
||||
} else {
|
||||
final int N = provider.uriPermissionPatterns.length;
|
||||
final int N = provider.getUriPermissionPatterns().length;
|
||||
PatternMatcher[] newp = new PatternMatcher[N + 1];
|
||||
System.arraycopy(provider.uriPermissionPatterns, 0, newp, 0, N);
|
||||
System.arraycopy(provider.getUriPermissionPatterns(), 0, newp, 0, N);
|
||||
newp[N] = pa;
|
||||
provider.uriPermissionPatterns = newp;
|
||||
provider.setUriPermissionPatterns(newp);
|
||||
}
|
||||
provider.grantUriPermissions = true;
|
||||
provider.setGrantUriPermissions(true);
|
||||
} else {
|
||||
if (PackageParser.RIGID_PARSER) {
|
||||
return input.error("No path, pathPrefix, or pathPattern for <path-permission>");
|
||||
@@ -349,15 +354,15 @@ public class ParsedProviderUtils {
|
||||
}
|
||||
|
||||
if (pa != null) {
|
||||
if (provider.pathPermissions == null) {
|
||||
provider.pathPermissions = new PathPermission[1];
|
||||
provider.pathPermissions[0] = pa;
|
||||
if (provider.getPathPermissions() == null) {
|
||||
provider.setPathPermissions(new PathPermission[1]);
|
||||
provider.getPathPermissions()[0] = pa;
|
||||
} else {
|
||||
final int N = provider.pathPermissions.length;
|
||||
final int N = provider.getPathPermissions().length;
|
||||
PathPermission[] newp = new PathPermission[N + 1];
|
||||
System.arraycopy(provider.pathPermissions, 0, newp, 0, N);
|
||||
System.arraycopy(provider.getPathPermissions(), 0, newp, 0, N);
|
||||
newp[N] = pa;
|
||||
provider.pathPermissions = newp;
|
||||
provider.setPathPermissions(newp);
|
||||
}
|
||||
} else {
|
||||
if (PackageParser.RIGID_PARSER) {
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.android.internal.util.Parcelling.BuiltIn.ForInternedString;
|
||||
/** @hide **/
|
||||
public class ParsedService extends ParsedMainComponent {
|
||||
|
||||
int foregroundServiceType;
|
||||
private int foregroundServiceType;
|
||||
@Nullable
|
||||
@DataClass.ParcelWith(ForInternedString.class)
|
||||
private String permission;
|
||||
@@ -41,6 +41,11 @@ public class ParsedService extends ParsedMainComponent {
|
||||
this.permission = other.permission;
|
||||
}
|
||||
|
||||
public ParsedService setForegroundServiceType(int foregroundServiceType) {
|
||||
this.foregroundServiceType = foregroundServiceType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParsedMainComponent setPermission(String permission) {
|
||||
// Empty string must be converted to null
|
||||
this.permission = TextUtils.isEmpty(permission) ? null : permission.intern();
|
||||
|
||||
@@ -78,33 +78,32 @@ public class ParsedServiceUtils {
|
||||
|
||||
setExported = sa.hasValue(R.styleable.AndroidManifestService_exported);
|
||||
if (setExported) {
|
||||
service.exported = sa.getBoolean(R.styleable.AndroidManifestService_exported,
|
||||
false);
|
||||
service.setExported(sa.getBoolean(R.styleable.AndroidManifestService_exported,
|
||||
false));
|
||||
}
|
||||
|
||||
String permission = sa.getNonConfigurationString(
|
||||
R.styleable.AndroidManifestService_permission, 0);
|
||||
service.setPermission(permission != null ? permission : pkg.getPermission());
|
||||
|
||||
service.foregroundServiceType = sa.getInt(
|
||||
service.setForegroundServiceType(sa.getInt(
|
||||
R.styleable.AndroidManifestService_foregroundServiceType,
|
||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE);
|
||||
|
||||
service.flags |= flag(ServiceInfo.FLAG_STOP_WITH_TASK,
|
||||
R.styleable.AndroidManifestService_stopWithTask, sa)
|
||||
| flag(ServiceInfo.FLAG_ISOLATED_PROCESS,
|
||||
R.styleable.AndroidManifestService_isolatedProcess, sa)
|
||||
| flag(ServiceInfo.FLAG_EXTERNAL_SERVICE,
|
||||
R.styleable.AndroidManifestService_externalService, sa)
|
||||
| flag(ServiceInfo.FLAG_USE_APP_ZYGOTE,
|
||||
R.styleable.AndroidManifestService_useAppZygote, sa)
|
||||
| flag(ServiceInfo.FLAG_SINGLE_USER,
|
||||
R.styleable.AndroidManifestService_singleUser, sa);
|
||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE))
|
||||
.setFlags(service.getFlags() | (flag(ServiceInfo.FLAG_STOP_WITH_TASK,
|
||||
R.styleable.AndroidManifestService_stopWithTask, sa)
|
||||
| flag(ServiceInfo.FLAG_ISOLATED_PROCESS,
|
||||
R.styleable.AndroidManifestService_isolatedProcess, sa)
|
||||
| flag(ServiceInfo.FLAG_EXTERNAL_SERVICE,
|
||||
R.styleable.AndroidManifestService_externalService, sa)
|
||||
| flag(ServiceInfo.FLAG_USE_APP_ZYGOTE,
|
||||
R.styleable.AndroidManifestService_useAppZygote, sa)
|
||||
| flag(ServiceInfo.FLAG_SINGLE_USER,
|
||||
R.styleable.AndroidManifestService_singleUser, sa)));
|
||||
|
||||
visibleToEphemeral = sa.getBoolean(
|
||||
R.styleable.AndroidManifestService_visibleToInstantApps, false);
|
||||
if (visibleToEphemeral) {
|
||||
service.flags |= ActivityInfo.FLAG_VISIBLE_TO_INSTANT_APP;
|
||||
service.setFlags(service.getFlags() | ActivityInfo.FLAG_VISIBLE_TO_INSTANT_APP);
|
||||
pkg.setVisibleToInstantApps(true);
|
||||
}
|
||||
} finally {
|
||||
@@ -139,7 +138,7 @@ public class ParsedServiceUtils {
|
||||
parseResult = intentResult;
|
||||
if (intentResult.isSuccess()) {
|
||||
ParsedIntentInfo intent = intentResult.getResult();
|
||||
service.order = Math.max(intent.getOrder(), service.order);
|
||||
service.setOrder(Math.max(intent.getOrder(), service.getOrder()));
|
||||
service.addIntent(intent);
|
||||
}
|
||||
break;
|
||||
@@ -172,7 +171,7 @@ public class ParsedServiceUtils {
|
||||
return input.error(exportedCheckResult);
|
||||
}
|
||||
}
|
||||
service.exported = hasIntentFilters;
|
||||
service.setExported(hasIntentFilters);
|
||||
}
|
||||
|
||||
return input.success(service);
|
||||
|
||||
@@ -24,6 +24,9 @@ import android.content.pm.PackageInfo;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.android.internal.util.DataClass;
|
||||
import com.android.internal.util.Parcelling;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@@ -33,50 +36,135 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@DataClass(genGetters = true, genSetters = true, genBuilder = false, genParcelable = true,
|
||||
genAidl = false)
|
||||
public class ParsedUsesPermission implements Parcelable {
|
||||
/** Name of the permission requested */
|
||||
public @NonNull String name;
|
||||
|
||||
/** Set of flags that should apply to this permission request. */
|
||||
public @UsesPermissionFlags int usesPermissionFlags;
|
||||
@DataClass.ParcelWith(Parcelling.BuiltIn.ForInternedString.class)
|
||||
@NonNull
|
||||
private String name;
|
||||
|
||||
@UsesPermissionFlags
|
||||
private int usesPermissionFlags;
|
||||
|
||||
/**
|
||||
* Strong assertion by a developer that they will never use this permission
|
||||
* to derive the physical location of the device, regardless of
|
||||
* ACCESS_FINE_LOCATION and/or ACCESS_COARSE_LOCATION being granted.
|
||||
* Strong assertion by a developer that they will never use this permission to derive the
|
||||
* physical location of the device, regardless of ACCESS_FINE_LOCATION and/or
|
||||
* ACCESS_COARSE_LOCATION being granted.
|
||||
*/
|
||||
public static final int FLAG_NEVER_FOR_LOCATION =
|
||||
PackageInfo.REQUESTED_PERMISSION_NEVER_FOR_LOCATION;
|
||||
|
||||
/** @hide */
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef(flag = true, prefix = { "FLAG_" }, value = {
|
||||
FLAG_NEVER_FOR_LOCATION
|
||||
})
|
||||
public @interface UsesPermissionFlags {}
|
||||
|
||||
public ParsedUsesPermission(@NonNull String name,
|
||||
|
||||
|
||||
// Code below generated by codegen v1.0.23.
|
||||
//
|
||||
// DO NOT MODIFY!
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
//
|
||||
// To regenerate run:
|
||||
// $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/parsing/component/ParsedUsesPermission.java
|
||||
//
|
||||
// To exclude the generated code from IntelliJ auto-formatting enable (one-time):
|
||||
// Settings > Editor > Code Style > Formatter Control
|
||||
//@formatter:off
|
||||
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public ParsedUsesPermission(
|
||||
@NonNull String name,
|
||||
@UsesPermissionFlags int usesPermissionFlags) {
|
||||
this.name = name.intern();
|
||||
this.name = name;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, name);
|
||||
this.usesPermissionFlags = usesPermissionFlags;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
UsesPermissionFlags.class, null, usesPermissionFlags);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @UsesPermissionFlags int getUsesPermissionFlags() {
|
||||
return usesPermissionFlags;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull ParsedUsesPermission setName(@NonNull String value) {
|
||||
name = value;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull ParsedUsesPermission setUsesPermissionFlags(@UsesPermissionFlags int value) {
|
||||
usesPermissionFlags = value;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
UsesPermissionFlags.class, null, usesPermissionFlags);
|
||||
return this;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
static Parcelling<String> sParcellingForName =
|
||||
Parcelling.Cache.get(
|
||||
Parcelling.BuiltIn.ForInternedString.class);
|
||||
static {
|
||||
if (sParcellingForName == null) {
|
||||
sParcellingForName = Parcelling.Cache.put(
|
||||
new Parcelling.BuiltIn.ForInternedString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
sForInternedString.parcel(this.name, dest, flags);
|
||||
// You can override field parcelling by defining methods like:
|
||||
// void parcelFieldName(Parcel dest, int flags) { ... }
|
||||
|
||||
sParcellingForName.parcel(name, dest, flags);
|
||||
dest.writeInt(usesPermissionFlags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
@DataClass.Generated.Member
|
||||
public int describeContents() { return 0; }
|
||||
|
||||
/** @hide */
|
||||
@SuppressWarnings({"unchecked", "RedundantCast"})
|
||||
@DataClass.Generated.Member
|
||||
protected ParsedUsesPermission(@NonNull Parcel in) {
|
||||
this.name = sForInternedString.unparcel(in);
|
||||
this.usesPermissionFlags = in.readInt();
|
||||
// You can override field unparcelling by defining methods like:
|
||||
// static FieldType unparcelFieldName(Parcel in) { ... }
|
||||
|
||||
String _name = sParcellingForName.unparcel(in);
|
||||
int _usesPermissionFlags = in.readInt();
|
||||
|
||||
this.name = _name;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, name);
|
||||
this.usesPermissionFlags = _usesPermissionFlags;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
UsesPermissionFlags.class, null, usesPermissionFlags);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public static final @NonNull Parcelable.Creator<ParsedUsesPermission> CREATOR
|
||||
= new Parcelable.Creator<ParsedUsesPermission>() {
|
||||
@Override
|
||||
@@ -89,4 +177,17 @@ public class ParsedUsesPermission implements Parcelable {
|
||||
return new ParsedUsesPermission(in);
|
||||
}
|
||||
};
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1626207990753L,
|
||||
codegenVersion = "1.0.23",
|
||||
sourceFile = "frameworks/base/core/java/android/content/pm/parsing/component/ParsedUsesPermission.java",
|
||||
inputSignatures = "private @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedString.class) @android.annotation.NonNull java.lang.String name\nprivate @android.content.pm.parsing.component.ParsedUsesPermission.UsesPermissionFlags int usesPermissionFlags\npublic static final int FLAG_NEVER_FOR_LOCATION\nclass ParsedUsesPermission extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genGetters=true, genSetters=true, genBuilder=false, genParcelable=true, genAidl=false)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
//@formatter:on
|
||||
// End of generated code
|
||||
|
||||
}
|
||||
|
||||
@@ -1821,13 +1821,13 @@ public class AppOpsService extends IAppOpsService.Stub {
|
||||
for (int attributionNum = 0; attributionNum < numAttributions;
|
||||
attributionNum++) {
|
||||
ParsedAttribution attribution = pkg.getAttributions().get(attributionNum);
|
||||
attributionTags.add(attribution.tag);
|
||||
attributionTags.add(attribution.getTag());
|
||||
|
||||
int numInheritFrom = attribution.inheritFrom.size();
|
||||
int numInheritFrom = attribution.getInheritFrom().size();
|
||||
for (int inheritFromNum = 0; inheritFromNum < numInheritFrom;
|
||||
inheritFromNum++) {
|
||||
dstAttributionTags.put(attribution.inheritFrom.get(inheritFromNum),
|
||||
attribution.tag);
|
||||
dstAttributionTags.put(attribution.getInheritFrom().get(inheritFromNum),
|
||||
attribution.getTag());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4621,7 +4621,7 @@ public class AppOpsService extends IAppOpsService.Stub {
|
||||
if (pkg.getAttributions() != null) {
|
||||
int numAttributions = pkg.getAttributions().size();
|
||||
for (int i = 0; i < numAttributions; i++) {
|
||||
if (pkg.getAttributions().get(i).tag.equals(attributionTag)) {
|
||||
if (pkg.getAttributions().get(i).getTag().equals(attributionTag)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18836,12 +18836,12 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
|
||||
// Reflect the rename in scanned details
|
||||
try {
|
||||
parsedPackage.setCodePath(afterCodeFile.getCanonicalPath());
|
||||
parsedPackage.setPath(afterCodeFile.getCanonicalPath());
|
||||
} catch (IOException e) {
|
||||
Slog.e(TAG, "Failed to get path: " + afterCodeFile, e);
|
||||
return false;
|
||||
}
|
||||
parsedPackage.setBaseCodePath(FileUtils.rewriteAfterRename(beforeCodeFile,
|
||||
parsedPackage.setBaseApkPath(FileUtils.rewriteAfterRename(beforeCodeFile,
|
||||
afterCodeFile, parsedPackage.getBaseApkPath()));
|
||||
parsedPackage.setSplitCodePaths(FileUtils.rewriteAfterRename(beforeCodeFile,
|
||||
afterCodeFile, parsedPackage.getSplitCodePaths()));
|
||||
|
||||
@@ -306,8 +306,8 @@ public final class PackageImpl extends ParsingPackageImpl implements ParsedPacka
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackageImpl setCodePath(@NonNull String value) {
|
||||
this.mPath = value;
|
||||
public PackageImpl setPath(@NonNull String path) {
|
||||
this.mPath = path;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -381,8 +381,8 @@ public final class PackageImpl extends ParsingPackageImpl implements ParsedPacka
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackageImpl setBaseCodePath(@NonNull String baseCodePath) {
|
||||
this.mBaseApkPath = TextUtils.safeIntern(baseCodePath);
|
||||
public PackageImpl setBaseApkPath(@NonNull String baseApkPath) {
|
||||
this.mBaseApkPath = TextUtils.safeIntern(baseApkPath);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ public interface ParsedPackage extends AndroidPackage {
|
||||
|
||||
ParsedPackage clearProtectedBroadcasts();
|
||||
|
||||
ParsedPackage setBaseCodePath(String baseCodePath);
|
||||
ParsedPackage setBaseApkPath(String baseApkPath);
|
||||
|
||||
ParsedPackage setCodePath(String codePath);
|
||||
ParsedPackage setPath(String path);
|
||||
|
||||
ParsedPackage setNativeLibraryDir(String nativeLibraryDir);
|
||||
|
||||
|
||||
@@ -3385,7 +3385,7 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
||||
boolean allowed = false;
|
||||
for (int i = 0, size = CompatibilityPermissionInfo.COMPAT_PERMS.length; i < size; i++) {
|
||||
final CompatibilityPermissionInfo info = CompatibilityPermissionInfo.COMPAT_PERMS[i];
|
||||
if (info.name.equals(perm)
|
||||
if (info.getName().equals(perm)
|
||||
&& pkg.getTargetSdkVersion() < info.sdkVersion) {
|
||||
allowed = true;
|
||||
Log.i(TAG, "Auto-granting " + perm + " to old pkg "
|
||||
|
||||
@@ -520,10 +520,12 @@ public class PackageParserTest {
|
||||
final ParsedPackage pkg = new TestPackageParser2()
|
||||
.parsePackage(testFile, 0 /*flags*/, false /*useCaches*/);
|
||||
final List<String> compatPermissions =
|
||||
Arrays.stream(COMPAT_PERMS).map(p -> p.name).collect(toList());
|
||||
Arrays.stream(COMPAT_PERMS).map(ParsedUsesPermission::getName)
|
||||
.collect(toList());
|
||||
assertWithMessage(
|
||||
"Compatibility permissions shouldn't be added into uses permissions.")
|
||||
.that(pkg.getUsesPermissions().stream().map(p -> p.name).collect(toList()))
|
||||
.that(pkg.getUsesPermissions().stream().map(ParsedUsesPermission::getName)
|
||||
.collect(toList()))
|
||||
.containsNoneIn(compatPermissions);
|
||||
assertWithMessage(
|
||||
"Compatibility permissions shouldn't be added into requested permissions.")
|
||||
@@ -544,18 +546,19 @@ public class PackageParserTest {
|
||||
.parsePackage(testFile, 0 /*flags*/, false /*useCaches*/);
|
||||
assertWithMessage(
|
||||
"Compatibility permissions should be added into uses permissions.")
|
||||
.that(Arrays.stream(COMPAT_PERMS).map(p -> p.name)
|
||||
.allMatch(pkg.getUsesPermissions().stream().map(p -> p.name)
|
||||
.that(Arrays.stream(COMPAT_PERMS).map(ParsedUsesPermission::getName)
|
||||
.allMatch(pkg.getUsesPermissions().stream()
|
||||
.map(ParsedUsesPermission::getName)
|
||||
.collect(toList())::contains))
|
||||
.isTrue();
|
||||
assertWithMessage(
|
||||
"Compatibility permissions should be added into requested permissions.")
|
||||
.that(Arrays.stream(COMPAT_PERMS).map(p -> p.name)
|
||||
.that(Arrays.stream(COMPAT_PERMS).map(ParsedUsesPermission::getName)
|
||||
.allMatch(pkg.getRequestedPermissions()::contains))
|
||||
.isTrue();
|
||||
assertWithMessage(
|
||||
"Compatibility permissions should be added into implicit permissions.")
|
||||
.that(Arrays.stream(COMPAT_PERMS).map(p -> p.name)
|
||||
.that(Arrays.stream(COMPAT_PERMS).map(ParsedUsesPermission::getName)
|
||||
.allMatch(pkg.getImplicitPermissions()::contains))
|
||||
.isTrue();
|
||||
} finally {
|
||||
@@ -954,8 +957,8 @@ public class PackageParserTest {
|
||||
.setVisibleToInstantApps(true)
|
||||
.setSplitHasCode(0, true)
|
||||
.hideAsParsed())
|
||||
.setBaseCodePath("foo5")
|
||||
.setCodePath("foo4")
|
||||
.setBaseApkPath("foo5")
|
||||
.setPath("foo4")
|
||||
.setVersionCode(100)
|
||||
.setRestrictUpdateHash(new byte[16])
|
||||
.setVersionCodeMajor(100)
|
||||
|
||||
@@ -51,11 +51,11 @@ import android.platform.test.annotations.Presubmit;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.android.server.compat.PlatformCompat;
|
||||
import com.android.server.pm.verify.domain.DomainVerificationManagerInternal;
|
||||
import com.android.server.pm.parsing.PackageInfoUtils;
|
||||
import com.android.server.pm.parsing.pkg.AndroidPackage;
|
||||
import com.android.server.pm.parsing.pkg.PackageImpl;
|
||||
import com.android.server.pm.parsing.pkg.ParsedPackage;
|
||||
import com.android.server.pm.verify.domain.DomainVerificationManagerInternal;
|
||||
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
@@ -241,7 +241,7 @@ public class ScanTests {
|
||||
.setPackageName("static.lib.pkg.123")
|
||||
.setVersionCodeMajor(1)
|
||||
.setVersionCode(234)
|
||||
.setBaseCodePath("/some/path.apk")
|
||||
.setBaseApkPath("/some/path.apk")
|
||||
.setSplitCodePaths(new String[] {"/some/other/path.apk"});
|
||||
|
||||
final PackageManagerService.ScanRequest scanRequest = new ScanRequestBuilder(pkg)
|
||||
@@ -273,7 +273,7 @@ public class ScanTests {
|
||||
.hideAsParsed())
|
||||
.setVersionCodeMajor(1)
|
||||
.setVersionCode(234)
|
||||
.setBaseCodePath("/some/path.apk")
|
||||
.setBaseApkPath("/some/path.apk")
|
||||
.setSplitCodePaths(new String[] {"/some/other/path.apk"});
|
||||
|
||||
final PackageManagerService.ScanRequest scanRequest =
|
||||
|
||||
Reference in New Issue
Block a user