Loading core/java/android/content/pm/parsing/ParsingPackageImpl.java +2 −1 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.content.pm.parsing.component.ParsedProcess; import android.content.pm.parsing.component.ParsedProvider; import android.content.pm.parsing.component.ParsedProviderImpl; import android.content.pm.parsing.component.ParsedService; import android.content.pm.parsing.component.ParsedServiceImpl; import android.content.pm.parsing.component.ParsedUsesPermission; import android.content.res.TypedArray; import android.os.Build; Loading Loading @@ -1287,7 +1288,7 @@ public class ParsingPackageImpl implements ParsingPackage, ParsingPackageHidden, this.activities = ParsingUtils.createTypedInterfaceList(in, ParsedActivityImpl.CREATOR); this.receivers = ParsingUtils.createTypedInterfaceList(in, ParsedActivityImpl.CREATOR); this.services = in.createTypedArrayList(ParsedService.CREATOR); this.services = ParsingUtils.createTypedInterfaceList(in, ParsedServiceImpl.CREATOR); this.providers = ParsingUtils.createTypedInterfaceList(in, ParsedProviderImpl.CREATOR); this.attributions = in.createTypedArrayList(ParsedAttribution.CREATOR); this.permissions = in.createTypedArrayList(ParsedPermission.CREATOR); Loading core/java/android/content/pm/parsing/component/ParsedService.java +3 −83 Original line number Diff line number Diff line Loading @@ -16,93 +16,13 @@ package android.content.pm.parsing.component; import static android.content.pm.parsing.ParsingPackageImpl.sForInternedString; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ComponentName; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import com.android.internal.util.DataClass; import com.android.internal.util.Parcelling.BuiltIn.ForInternedString; /** @hide **/ public class ParsedService extends ParsedMainComponentImpl { private int foregroundServiceType; @Nullable @DataClass.ParcelWith(ForInternedString.class) private String permission; public ParsedService(ParsedService other) { super(other); this.foregroundServiceType = other.foregroundServiceType; 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(); return this; } public String toString() { StringBuilder sb = new StringBuilder(128); sb.append("Service{"); sb.append(Integer.toHexString(System.identityHashCode(this))); sb.append(' '); ComponentName.appendShortString(sb, getPackageName(), getName()); sb.append('}'); return sb.toString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { super.writeToParcel(dest, flags); dest.writeInt(this.foregroundServiceType); sForInternedString.parcel(this.permission, dest, flags); } public interface ParsedService extends ParsedMainComponent { public ParsedService() { } protected ParsedService(Parcel in) { super(in); this.foregroundServiceType = in.readInt(); this.permission = sForInternedString.unparcel(in); } @NonNull public static final Parcelable.Creator<ParsedService> CREATOR = new Creator<ParsedService>() { @Override public ParsedService createFromParcel(Parcel source) { return new ParsedService(source); } @Override public ParsedService[] newArray(int size) { return new ParsedService[size]; } }; public int getForegroundServiceType() { return foregroundServiceType; } int getForegroundServiceType(); @Nullable public String getPermission() { return permission; } String getPermission(); } core/java/android/content/pm/parsing/component/ParsedServiceImpl.java 0 → 100644 +152 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.content.pm.parsing.component; import static android.content.pm.parsing.ParsingPackageImpl.sForInternedString; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ComponentName; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.DataClass; import com.android.internal.util.Parcelling.BuiltIn.ForInternedString; /** @hide **/ @DataClass(genSetters = true, genGetters = true, genParcelable = false, genBuilder = false) @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) public class ParsedServiceImpl extends ParsedMainComponentImpl implements ParsedService { private int foregroundServiceType; @Nullable @DataClass.ParcelWith(ForInternedString.class) private String permission; public ParsedServiceImpl(ParsedServiceImpl other) { super(other); this.foregroundServiceType = other.foregroundServiceType; this.permission = other.permission; } public ParsedMainComponent setPermission(String permission) { // Empty string must be converted to null this.permission = TextUtils.isEmpty(permission) ? null : permission.intern(); return this; } public String toString() { StringBuilder sb = new StringBuilder(128); sb.append("Service{"); sb.append(Integer.toHexString(System.identityHashCode(this))); sb.append(' '); ComponentName.appendShortString(sb, getPackageName(), getName()); sb.append('}'); return sb.toString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { super.writeToParcel(dest, flags); dest.writeInt(this.foregroundServiceType); sForInternedString.parcel(this.permission, dest, flags); } public ParsedServiceImpl() { } protected ParsedServiceImpl(Parcel in) { super(in); this.foregroundServiceType = in.readInt(); this.permission = sForInternedString.unparcel(in); } @NonNull public static final Parcelable.Creator<ParsedServiceImpl> CREATOR = new Parcelable.Creator<ParsedServiceImpl>() { @Override public ParsedServiceImpl createFromParcel(Parcel source) { return new ParsedServiceImpl(source); } @Override public ParsedServiceImpl[] newArray(int size) { return new ParsedServiceImpl[size]; } }; // 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/ParsedServiceImpl.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 ParsedServiceImpl( int foregroundServiceType, @Nullable String permission) { this.foregroundServiceType = foregroundServiceType; this.permission = permission; // onConstructed(); // You can define this method to get a callback } @DataClass.Generated.Member public int getForegroundServiceType() { return foregroundServiceType; } @DataClass.Generated.Member public @Nullable String getPermission() { return permission; } @DataClass.Generated.Member public @NonNull ParsedServiceImpl setForegroundServiceType( int value) { foregroundServiceType = value; return this; } @DataClass.Generated( time = 1627592563052L, codegenVersion = "1.0.23", sourceFile = "frameworks/base/core/java/android/content/pm/parsing/component/ParsedServiceImpl.java", inputSignatures = "private int foregroundServiceType\nprivate @android.annotation.Nullable @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedString.class) java.lang.String permission\npublic static final @android.annotation.NonNull android.os.Parcelable.Creator<android.content.pm.parsing.component.ParsedServiceImpl> CREATOR\npublic android.content.pm.parsing.component.ParsedMainComponent setPermission(java.lang.String)\npublic java.lang.String toString()\npublic @java.lang.Override int describeContents()\npublic @java.lang.Override void writeToParcel(android.os.Parcel,int)\nclass ParsedServiceImpl extends android.content.pm.parsing.component.ParsedMainComponentImpl implements [android.content.pm.parsing.component.ParsedService]\n@com.android.internal.util.DataClass(genSetters=true, genGetters=true, genParcelable=false, genBuilder=false)") @Deprecated private void __metadata() {} //@formatter:on // End of generated code } core/java/android/content/pm/parsing/component/ParsedServiceUtils.java +3 −3 Original line number Diff line number Diff line Loading @@ -52,12 +52,12 @@ public class ParsedServiceUtils { boolean setExported; final String packageName = pkg.getPackageName(); final ParsedService service = new ParsedService(); final ParsedServiceImpl service = new ParsedServiceImpl(); String tag = parser.getName(); TypedArray sa = res.obtainAttributes(parser, R.styleable.AndroidManifestService); try { ParseResult<ParsedService> result = ParsedMainComponentUtils.parseMainComponent( ParseResult<ParsedServiceImpl> result = ParsedMainComponentUtils.parseMainComponent( service, tag, separateProcesses, pkg, sa, flags, useRoundIcon, defaultSplitName, input, R.styleable.AndroidManifestService_banner, Loading @@ -75,7 +75,7 @@ public class ParsedServiceUtils { ); if (result.isError()) { return result; return input.error(result); } setExported = sa.hasValue(R.styleable.AndroidManifestService_exported); Loading services/core/java/com/android/server/pm/parsing/pkg/PackageImpl.java +4 −3 Original line number Diff line number Diff line Loading @@ -340,7 +340,7 @@ public class PackageImpl extends ParsingPackageImpl implements ParsedPackage, An int servicesSize = services.size(); for (int index = 0; index < servicesSize; index++) { services.get(index).setPackageName(this.packageName); ComponentMutateUtils.setPackageName(services.get(index), this.packageName); } int instrumentationsSize = instrumentations.size(); Loading Loading @@ -373,7 +373,8 @@ public class PackageImpl extends ParsingPackageImpl implements ParsedPackage, An int servicesSize = services.size(); for (int index = 0; index < servicesSize; index++) { services.get(index).setDirectBootAware(allComponentsDirectBootAware); ComponentMutateUtils.setDirectBootAware(services.get(index), allComponentsDirectBootAware); } return this; Loading Loading @@ -459,7 +460,7 @@ public class PackageImpl extends ParsingPackageImpl implements ParsedPackage, An for (int index = 0; index < servicesSize; index++) { ParsedService service = services.get(index); if ((service.getFlags() & ActivityInfo.FLAG_SINGLE_USER) != 0) { service.setExported(false); ComponentMutateUtils.setExported(service, false); } } Loading Loading
core/java/android/content/pm/parsing/ParsingPackageImpl.java +2 −1 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.content.pm.parsing.component.ParsedProcess; import android.content.pm.parsing.component.ParsedProvider; import android.content.pm.parsing.component.ParsedProviderImpl; import android.content.pm.parsing.component.ParsedService; import android.content.pm.parsing.component.ParsedServiceImpl; import android.content.pm.parsing.component.ParsedUsesPermission; import android.content.res.TypedArray; import android.os.Build; Loading Loading @@ -1287,7 +1288,7 @@ public class ParsingPackageImpl implements ParsingPackage, ParsingPackageHidden, this.activities = ParsingUtils.createTypedInterfaceList(in, ParsedActivityImpl.CREATOR); this.receivers = ParsingUtils.createTypedInterfaceList(in, ParsedActivityImpl.CREATOR); this.services = in.createTypedArrayList(ParsedService.CREATOR); this.services = ParsingUtils.createTypedInterfaceList(in, ParsedServiceImpl.CREATOR); this.providers = ParsingUtils.createTypedInterfaceList(in, ParsedProviderImpl.CREATOR); this.attributions = in.createTypedArrayList(ParsedAttribution.CREATOR); this.permissions = in.createTypedArrayList(ParsedPermission.CREATOR); Loading
core/java/android/content/pm/parsing/component/ParsedService.java +3 −83 Original line number Diff line number Diff line Loading @@ -16,93 +16,13 @@ package android.content.pm.parsing.component; import static android.content.pm.parsing.ParsingPackageImpl.sForInternedString; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ComponentName; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import com.android.internal.util.DataClass; import com.android.internal.util.Parcelling.BuiltIn.ForInternedString; /** @hide **/ public class ParsedService extends ParsedMainComponentImpl { private int foregroundServiceType; @Nullable @DataClass.ParcelWith(ForInternedString.class) private String permission; public ParsedService(ParsedService other) { super(other); this.foregroundServiceType = other.foregroundServiceType; 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(); return this; } public String toString() { StringBuilder sb = new StringBuilder(128); sb.append("Service{"); sb.append(Integer.toHexString(System.identityHashCode(this))); sb.append(' '); ComponentName.appendShortString(sb, getPackageName(), getName()); sb.append('}'); return sb.toString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { super.writeToParcel(dest, flags); dest.writeInt(this.foregroundServiceType); sForInternedString.parcel(this.permission, dest, flags); } public interface ParsedService extends ParsedMainComponent { public ParsedService() { } protected ParsedService(Parcel in) { super(in); this.foregroundServiceType = in.readInt(); this.permission = sForInternedString.unparcel(in); } @NonNull public static final Parcelable.Creator<ParsedService> CREATOR = new Creator<ParsedService>() { @Override public ParsedService createFromParcel(Parcel source) { return new ParsedService(source); } @Override public ParsedService[] newArray(int size) { return new ParsedService[size]; } }; public int getForegroundServiceType() { return foregroundServiceType; } int getForegroundServiceType(); @Nullable public String getPermission() { return permission; } String getPermission(); }
core/java/android/content/pm/parsing/component/ParsedServiceImpl.java 0 → 100644 +152 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.content.pm.parsing.component; import static android.content.pm.parsing.ParsingPackageImpl.sForInternedString; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ComponentName; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.DataClass; import com.android.internal.util.Parcelling.BuiltIn.ForInternedString; /** @hide **/ @DataClass(genSetters = true, genGetters = true, genParcelable = false, genBuilder = false) @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) public class ParsedServiceImpl extends ParsedMainComponentImpl implements ParsedService { private int foregroundServiceType; @Nullable @DataClass.ParcelWith(ForInternedString.class) private String permission; public ParsedServiceImpl(ParsedServiceImpl other) { super(other); this.foregroundServiceType = other.foregroundServiceType; this.permission = other.permission; } public ParsedMainComponent setPermission(String permission) { // Empty string must be converted to null this.permission = TextUtils.isEmpty(permission) ? null : permission.intern(); return this; } public String toString() { StringBuilder sb = new StringBuilder(128); sb.append("Service{"); sb.append(Integer.toHexString(System.identityHashCode(this))); sb.append(' '); ComponentName.appendShortString(sb, getPackageName(), getName()); sb.append('}'); return sb.toString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { super.writeToParcel(dest, flags); dest.writeInt(this.foregroundServiceType); sForInternedString.parcel(this.permission, dest, flags); } public ParsedServiceImpl() { } protected ParsedServiceImpl(Parcel in) { super(in); this.foregroundServiceType = in.readInt(); this.permission = sForInternedString.unparcel(in); } @NonNull public static final Parcelable.Creator<ParsedServiceImpl> CREATOR = new Parcelable.Creator<ParsedServiceImpl>() { @Override public ParsedServiceImpl createFromParcel(Parcel source) { return new ParsedServiceImpl(source); } @Override public ParsedServiceImpl[] newArray(int size) { return new ParsedServiceImpl[size]; } }; // 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/ParsedServiceImpl.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 ParsedServiceImpl( int foregroundServiceType, @Nullable String permission) { this.foregroundServiceType = foregroundServiceType; this.permission = permission; // onConstructed(); // You can define this method to get a callback } @DataClass.Generated.Member public int getForegroundServiceType() { return foregroundServiceType; } @DataClass.Generated.Member public @Nullable String getPermission() { return permission; } @DataClass.Generated.Member public @NonNull ParsedServiceImpl setForegroundServiceType( int value) { foregroundServiceType = value; return this; } @DataClass.Generated( time = 1627592563052L, codegenVersion = "1.0.23", sourceFile = "frameworks/base/core/java/android/content/pm/parsing/component/ParsedServiceImpl.java", inputSignatures = "private int foregroundServiceType\nprivate @android.annotation.Nullable @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedString.class) java.lang.String permission\npublic static final @android.annotation.NonNull android.os.Parcelable.Creator<android.content.pm.parsing.component.ParsedServiceImpl> CREATOR\npublic android.content.pm.parsing.component.ParsedMainComponent setPermission(java.lang.String)\npublic java.lang.String toString()\npublic @java.lang.Override int describeContents()\npublic @java.lang.Override void writeToParcel(android.os.Parcel,int)\nclass ParsedServiceImpl extends android.content.pm.parsing.component.ParsedMainComponentImpl implements [android.content.pm.parsing.component.ParsedService]\n@com.android.internal.util.DataClass(genSetters=true, genGetters=true, genParcelable=false, genBuilder=false)") @Deprecated private void __metadata() {} //@formatter:on // End of generated code }
core/java/android/content/pm/parsing/component/ParsedServiceUtils.java +3 −3 Original line number Diff line number Diff line Loading @@ -52,12 +52,12 @@ public class ParsedServiceUtils { boolean setExported; final String packageName = pkg.getPackageName(); final ParsedService service = new ParsedService(); final ParsedServiceImpl service = new ParsedServiceImpl(); String tag = parser.getName(); TypedArray sa = res.obtainAttributes(parser, R.styleable.AndroidManifestService); try { ParseResult<ParsedService> result = ParsedMainComponentUtils.parseMainComponent( ParseResult<ParsedServiceImpl> result = ParsedMainComponentUtils.parseMainComponent( service, tag, separateProcesses, pkg, sa, flags, useRoundIcon, defaultSplitName, input, R.styleable.AndroidManifestService_banner, Loading @@ -75,7 +75,7 @@ public class ParsedServiceUtils { ); if (result.isError()) { return result; return input.error(result); } setExported = sa.hasValue(R.styleable.AndroidManifestService_exported); Loading
services/core/java/com/android/server/pm/parsing/pkg/PackageImpl.java +4 −3 Original line number Diff line number Diff line Loading @@ -340,7 +340,7 @@ public class PackageImpl extends ParsingPackageImpl implements ParsedPackage, An int servicesSize = services.size(); for (int index = 0; index < servicesSize; index++) { services.get(index).setPackageName(this.packageName); ComponentMutateUtils.setPackageName(services.get(index), this.packageName); } int instrumentationsSize = instrumentations.size(); Loading Loading @@ -373,7 +373,8 @@ public class PackageImpl extends ParsingPackageImpl implements ParsedPackage, An int servicesSize = services.size(); for (int index = 0; index < servicesSize; index++) { services.get(index).setDirectBootAware(allComponentsDirectBootAware); ComponentMutateUtils.setDirectBootAware(services.get(index), allComponentsDirectBootAware); } return this; Loading Loading @@ -459,7 +460,7 @@ public class PackageImpl extends ParsingPackageImpl implements ParsedPackage, An for (int index = 0; index < servicesSize; index++) { ParsedService service = services.get(index); if ((service.getFlags() & ActivityInfo.FLAG_SINGLE_USER) != 0) { service.setExported(false); ComponentMutateUtils.setExported(service, false); } } Loading