[Android Software/Hacking General [Developers Only]] niaboc79:
Hi guys,

I need devs to help me to find a way to disable signature verification on Pie.

The old patching of compare signature method doesn't work anymore.

Could a java pro analyse PackageManagerService to find how to allow signature of core apps with a different signature.

Thanks

Edit: Here's a working method that I've created:

1) First decompile framework-res.apk and add this in arrays.xml

<string-array name="config_vendorPlatformSignatures">
<item>308203BB308202A3A003020102020900F00F8E7F45E72D86300D06092A864886F70D01010B05003074310B30090603550406130255533113301106035504080C0A43616C69666F726E69613116301406035504070C0D4D6F756E7461696E205669657731143012060355040A0C0B476F6F676C6520496E632E3110300E060355040B0C07416E64726F69643110300E06035504030C07416E64726F6964301E170D3136303531303138313332385A170D3433303932363138313332385A3074310B30090603550406130255533113301106035504080C0A43616C69666F726E69613116301406035504070C0D4D6F756E7461696E205669657731143012060355040A0C0B476F6F676C6520496E632E3110300E060355040B0C07416E64726F69643110300E06035504030C07416E64726F696430820122300D06092A864886F70D01010105000382010F003082010A02820101009DA10ED05B5EBFE8E5794CFA3A633E605748FDB8F3545C288D9EFFBA4F2CA1BFC16DA0D4C5724575A21D4DF9D44C1B068785C084BFD4C7071EEF258F2169494239B55FCF187E529760D77DD495F65872D6BF7E61C764A368D0AA6272A51C10E91F89991EA147377B3B37B2ED714E622D17288C8A7003DC6A11022F1B0C6EB005A18CFAB5EF3F9B6912EE1B1CBECCD96A1F76DEBB6E6A9BFCCB76E9C2D279EF119D9E9BF6A089C21507FD00A0237A0C11C32946FE123C0A2CE0C52CB4D3B5D815281F244E4F998CDC4D765459BF1FFA960FC48324869DB0555A6844A94204891A01CCA268448374C7CD17661C74C692FB32AF0DF4C20AFF02F9966B5C94BB80710203010001A350304E301D0603551D0E041604149078B7EBD42D359E4E98E6FEF868CABFFA634F9F301F0603551D230418301680149078B7EBD42D359E4E98E6FEF868CABFFA634F9F300C0603551D13040530030101FF300D06092A864886F70D01010B050003820101008646166908812FD5373CE79FBAAC62F691ECDDCB82619D35BD990D068689E15E0C556D246ED8AE96816743D80CEE443F94F55CB6E169CC8F10B3770C434F351E50170F445369A26A4C37B2CA893C14A3AF7C7513A5420784CE4B6D9B92ED61252F5335A11C75EC978B979B1CD776DC3081094C3E7BE161C21E868303E0B40CB6441A95BB85F6CF83BD707735DAB8908C954CF5BB8553D0384480E1D789130D19151CA2AB01F928657E0DF2AD1FB31DCE18436BF873E4E924A59B7A89AE18C8B93CE0FF2C0ECAB4E7A67CEA1F7022CEA3C27699FA67D3B4965ABF9CE89016F33A08BFBE25AD2A9A6626C1A98802F0592DE720BDEFDDE83963D767C7AD96915224</item>
</string-array>

2) Recompile framework-res.apk and decompile new compiled one to find new id inside public.xml

<public type="array" name="config_vendorPlatformSignatures" id="0x01070057" />

3) Decompile Services.jar and look for this method in com/android/server/pm/PackageManagerService.smali

.method private collectCertificatesLI(Lcom/android/server/pm/PackageSetting;Landroid/content/pm/PackageParser$Package;ZZ)V

Replace the complete method by:

.method private collectCertificatesLI(Lcom/android/server/pm/PackageSetting;Landroid/content/pm/PackageParser$Package;ZZ)V
.registers 16
.param p1, "ps" # Lcom/android/server/pm/PackageSetting;
.param p2, "pkg" # Landroid/content/pm/PackageParser$Package;
.param p3, "forceCollect" # Z
.param p4, "skipVerify" # Z
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/android/server/pm/PackageManagerException;
}
.end annotation

.line 8546
iget-boolean v0, p0, Lcom/android/server/pm/PackageManagerService;->mIsPreNMR1Upgrade:Z

if-eqz v0, :cond_10

.line 8547
new-instance v0, Ljava/io/File;

iget-object v1, p2, Landroid/content/pm/PackageParser$Package;->codePath:Ljava/lang/String;

invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

invoke-virtual {v0}, Ljava/io/File;->lastModified()J

move-result-wide v0

goto :goto_14

:cond_10
invoke-static {p2}, Lcom/android/server/pm/PackageManagerServiceUtils;->getLastModifiedTime(Landroid/content/pm/PackageParser$Package;)J

move-result-wide v0

.line 8548
.local v0, "lastModifiedTime":J
:goto_14
if-eqz p1, :cond_77

if-nez p3, :cond_77

iget-object v2, p1, Lcom/android/server/pm/PackageSetting;->codePathString:Ljava/lang/String;

iget-object v3, p2, Landroid/content/pm/PackageParser$Package;->codePath:Ljava/lang/String;

.line 8549
invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_77

iget-wide v2, p1, Lcom/android/server/pm/PackageSetting;->timeStamp:J

cmp-long v2, v2, v0

if-nez v2, :cond_77

.line 8551
invoke-direct {p0, p2}, Lcom/android/server/pm/PackageManagerService;->isCompatSignatureUpdateNeeded(Landroid/content/pm/PackageParser$Package;)Z

move-result v2

if-nez v2, :cond_77

.line 8552
invoke-direct {p0, p2}, Lcom/android/server/pm/PackageManagerService;->isRecoverSignatureUpdateNeeded(Landroid/content/pm/PackageParser$Package;)Z

move-result v2

if-nez v2, :cond_77

.line 8553
iget-object v2, p1, Lcom/android/server/pm/PackageSetting;->signatures:Lcom/android/server/pm/PackageSignatures;

iget-object v2, v2, Lcom/android/server/pm/PackageSignatures;->mSigningDetails:Landroid/content/pm/PackageParser$SigningDetails;

iget-object v2, v2, Landroid/content/pm/PackageParser$SigningDetails;->signatures:[Landroid/content/pm/Signature;

if-eqz v2, :cond_59

iget-object v2, p1, Lcom/android/server/pm/PackageSetting;->signatures:Lcom/android/server/pm/PackageSignatures;

iget-object v2, v2, Lcom/android/server/pm/PackageSignatures;->mSigningDetails:Landroid/content/pm/PackageParser$SigningDetails;

iget-object v2, v2, Landroid/content/pm/PackageParser$SigningDetails;->signatures:[Landroid/content/pm/Signature;

array-length v2, v2

if-eqz v2, :cond_59

iget-object v2, p1, Lcom/android/server/pm/PackageSetting;->signatures:Lcom/android/server/pm/PackageSignatures;

iget-object v2, v2, Lcom/android/server/pm/PackageSignatures;->mSigningDetails:Landroid/content/pm/PackageParser$SigningDetails;

iget v2, v2, Landroid/content/pm/PackageParser$SigningDetails;->signatureSchemeVersion:I

if-eqz v2, :cond_59

.line 8559
new-instance v2, Landroid/content/pm/PackageParser$SigningDetails;

iget-object v3, p1, Lcom/android/server/pm/PackageSetting;->signatures:Lcom/android/server/pm/PackageSignatures;

iget-object v3, v3, Lcom/android/server/pm/PackageSignatures;->mSigningDetails:Landroid/content/pm/PackageParser$SigningDetails;

invoke-direct {v2, v3}, Landroid/content/pm/PackageParser$SigningDetails;-><init>(Landroid/content/pm/PackageParser$SigningDetails;)V

iput-object v2, p2, Landroid/content/pm/PackageParser$Package;->mSigningDetails:Landroid/content/pm/PackageParser$SigningDetails;

.line 8561
return-void

.line 8564
:cond_59
const-string v2, "PackageManager"

new-instance v3, Ljava/lang/StringBuilder;

invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

const-string v4, "PackageSetting for "

invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

iget-object v4, p1, Lcom/android/server/pm/PackageSetting;->name:Ljava/lang/String;

invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

const-string v4, " is missing signatures. Collecting certs again to recover them."

invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v3

invoke-static {v2, v3}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I

goto :goto_99

.line 8567
:cond_77
const-string v2, "PackageManager"

new-instance v3, Ljava/lang/StringBuilder;

invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

iget-object v4, p2, Landroid/content/pm/PackageParser$Package;->codePath:Ljava/lang/String;

invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

const-string v4, " changed; collecting certs"

invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

.line 8568
if-eqz p3, :cond_8d

const-string v4, " (forced)"

goto :goto_8f

:cond_8d
const-string v4, ""

:goto_8f
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v3

.line 8567
invoke-static {v2, v3}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I

.line 8573
:goto_99
const-wide/32 v2, 0x40000

:try_start_9c
const-string v4, "collectCertificates"

invoke-static {v2, v3, v4}, Landroid/os/Trace;->traceBegin(JLjava/lang/String;)V

.line 8574
invoke-static {p2, p4}, Landroid/content/pm/PackageParser;->collectCertificates(Landroid/content/pm/PackageParser$Package;Z)V

.line 8575
iget-object v4, p2, Landroid/content/pm/PackageParser$Package;->mSigningDetails:Landroid/content/pm/PackageParser$SigningDetails;

iget-object v4, v4, Landroid/content/pm/PackageParser$SigningDetails;->signatures:[Landroid/content/pm/Signature;

iget-object v5, p0, Lcom/android/server/pm/PackageManagerService;->mVendorPlatformSignatures:[Landroid/content/pm/Signature;

invoke-static {v4, v5}, Lcom/android/server/pm/PackageManagerServiceUtils;->compareSignatures2([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I

move-result v4

if-nez v4, :cond_e6

.line 8579
iget-object v4, p0, Lcom/android/server/pm/PackageManagerService;->mPlatformPackage:Landroid/content/pm/PackageParser$Package;

if-eqz v4, :cond_e6

.line 8580
new-instance v4, Landroid/content/pm/PackageParser$SigningDetails;

iget-object v5, p0, Lcom/android/server/pm/PackageManagerService;->mPlatformPackage:Landroid/content/pm/PackageParser$Package;

iget-object v5, v5, Landroid/content/pm/PackageParser$Package;->mSigningDetails:Landroid/content/pm/PackageParser$SigningDetails;

iget-object v6, v5, Landroid/content/pm/PackageParser$SigningDetails;->signatures:[Landroid/content/pm/Signature;

iget-object v5, p2, Landroid/content/pm/PackageParser$Package;->mSigningDetails:Landroid/content/pm/PackageParser$SigningDetails;

iget v7, v5, Landroid/content/pm/PackageParser$SigningDetails;->signatureSchemeVersion:I

iget-object v5, p2, Landroid/content/pm/PackageParser$Package;->mSigningDetails:Landroid/content/pm/PackageParser$SigningDetails;

iget-object v8, v5, Landroid/content/pm/PackageParser$SigningDetails;->publicKeys:Landroid/util/ArraySet;

iget-object v5, p2, Landroid/content/pm/PackageParser$Package;->mSigningDetails:Landroid/content/pm/PackageParser$SigningDetails;

iget-object v9, v5, Landroid/content/pm/PackageParser$SigningDetails;->pastSigningCertificates:[Landroid/content/pm/Signature;

iget-object v5, p2, Landroid/content/pm/PackageParser$Package;->mSigningDetails:Landroid/content/pm/PackageParser$SigningDetails;

iget-object v10, v5, Landroid/content/pm/PackageParser$SigningDetails;->pastSigningCertificatesFlags:[I

move-object v5, v4

invoke-direct/range {v5 .. v10}, Landroid/content/pm/PackageParser$SigningDetails;-><init>([Landroid/content/pm/Signature;ILandroid/util/ArraySet;[Landroid/content/pm/Signature;[I)V

iput-object v4, p2, Landroid/content/pm/PackageParser$Package;->mSigningDetails:Landroid/content/pm/PackageParser$SigningDetails;

.line 8586
iget-object v4, p2, Landroid/content/pm/PackageParser$Package;->applicationInfo:Landroid/content/pm/ApplicationInfo;

iget v4, v4, Landroid/content/pm/ApplicationInfo;->targetSdkVersion:I

.line 8587
.local v4, "targetSdkVersion":I
iget-object v5, p2, Landroid/content/pm/PackageParser$Package;->applicationInfo:Landroid/content/pm/ApplicationInfo;

iget v5, v5, Landroid/content/pm/ApplicationInfo;->targetSandboxVersion:I

.line 8588
.local v5, "targetSandboxVersion":I
invoke-virtual {p2}, Landroid/content/pm/PackageParser$Package;->isPrivileged()Z

move-result v6

.line 8590
.local v6, "isPrivileged":Z
iget-object v7, p2, Landroid/content/pm/PackageParser$Package;->applicationInfo:Landroid/content/pm/ApplicationInfo;

invoke-static {p2, v6, v5, v4}, Lcom/android/server/pm/SELinuxMMAC;->getSeInfo(Landroid/content/pm/PackageParser$Package;ZII)Ljava/lang/String;

move-result-object v8

iput-object v8, v7, Landroid/content/pm/ApplicationInfo;->seInfo:Ljava/lang/String;
:try_end_e6
.catch Landroid/content/pm/PackageParser$PackageParserException; {:try_start_9c .. :try_end_e6} :catch_ed
.catchall {:try_start_9c .. :try_end_e6} :catchall_eb

.line 8597
.end local v4 # "targetSdkVersion":I
.end local v5 # "targetSandboxVersion":I
.end local v6 # "isPrivileged":Z

:cond_e6
invoke-static {v2, v3}, Landroid/os/Trace;->traceEnd(J)V

.line 8598
nop

.line 8599
return-void

.line 8597
:catchall_eb
move-exception v4

goto :goto_f3

.line 8594
:catch_ed
move-exception v4

.line 8595
.local v4, "e":Landroid/content/pm/PackageParser$PackageParserException;
:try_start_ee
invoke-static {v4}, Lcom/android/server/pm/PackageManagerException;->from(Landroid/content/pm/PackageParser$PackageParserException;)Lcom/android/server/pm/PackageManagerException;

move-result-object v5

throw v5
:try_end_f3
.catchall {:try_start_ee .. :try_end_f3} :catchall_eb

.line 8597
.end local v4 # "e":Landroid/content/pm/PackageParser$PackageParserException;
:goto_f3
invoke-static {v2, v3}, Landroid/os/Trace;->traceEnd(J)V

throw v4
.end method

4) Look for this method in com/android/server/pm/PackageManagerService.smali

.method public constructor <init>(Landroid/content/Context;Lcom/android/server/pm/Installer;ZZ)V

Inside this method add this part (take care of 0x1070057 it must be replaced by the one you've added in framework-res.apk):

.line 2420
invoke-virtual/range {p1 .. p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v0

const v1, 0x1070057

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getStringArray(I)[Ljava/lang/String;

move-result-object v0

invoke-static {v0}, Lcom/android/server/pm/PackageManagerServiceUtils;->createSignatures([Ljava/lang/String;)[Landroid/content/pm/Signature;

move-result-object v0

iput-object v0, v13, Lcom/android/server/pm/PackageManagerService;->mVendorPlatformSignatures:[Landroid/content/pm/Signature;

Add the above code just before this:

.line 2428
move/from16 v5, p3

iput-boolean v5, v13, Lcom/android/server/pm/PackageManagerService;->mFactoryTest:Z

.line 2429
iput-boolean v11, v13, Lcom/android/server/pm/PackageManagerService;->mOnlyCore:Z

.line 2430
new-instance v0, Landroid/util/DisplayMetrics;

invoke-direct {v0}, Landroid/util/DisplayMetrics;-><init>()V

iput-object v0, v13, Lcom/android/server/pm/PackageManagerService;->mMetrics:Landroid/util/DisplayMetrics;

.line 2431
iput-object v15, v13, Lcom/android/server/pm/PackageManagerService;->mInstaller:Lcom/android/server/pm/Installer;

.line 2434
iget-object v1, v13, Lcom/android/server/pm/PackageManagerService;->mInstallLock:Ljava/lang/Object;

monitor-enter v1

5) Add this field at the top of in com/android/server/pm/PackageManagerService.smali

.field private final mVendorPlatformSignatures:[Landroid/content/pm/Signature;

6) Add this method in com/android/server/pm/PackageManagerServiceUtils.smali

.method public static compareSignatures2([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
.registers 9
.param p0, "s1" # [Landroid/content/pm/Signature;
.param p1, "s2" # [Landroid/content/pm/Signature;

.line 411
const/4 v0, 0x0

return v0
.end method

7) Add this method in com/android/server/pm/PackageManagerServiceUtils.smali

.method public static createSignatures([Ljava/lang/String;)[Landroid/content/pm/Signature;
.registers 5
.param p0, "hexBytes" # [Ljava/lang/String;

.line 708
array-length v0, p0

new-array v0, v0, [Landroid/content/pm/Signature;

.line 709
.local v0, "sigs":[Landroid/content/pm/Signature;
const/4 v1, 0x0

.local v1, "i":I
:goto_4
array-length v2, v0

if-ge v1, v2, :cond_13

.line 710
new-instance v2, Landroid/content/pm/Signature;

aget-object v3, p0, v1

invoke-direct {v2, v3}, Landroid/content/pm/Signature;-><init>(Ljava/lang/String;)V

aput-object v2, v0, v1

.line 709
add-int/lit8 v1, v1, 0x1

goto :goto_4

.line 712
.end local v1 # "i":I
:cond_13
return-object v0
.end method

8) Find this method in com/android/server/pm/permission/PermissionManagerService.smali

.method constructor <init>(Landroid/content/Context;Lcom/android/server/pm/permission/DefaultPermissionGrantPolicy$DefaultPermissionGrantedCallback;Ljava/lang/Object;)V

Replace whole method by (take care of 0x1070057 it must be replaced by the one you've added in framework-res.apk):

.method constructor <init>(Landroid/content/Context;Lcom/android/server/pm/permission/DefaultPermissionGrantPolicy$DefaultPermissionGrantedCallback;Ljava/lang/Object;)V
.registers 14
.param p1, "context" # Landroid/content/Context;
.param p2, "defaultGrantCallback" # Lcom/android/server/pm/permission/DefaultPermissionGrantPolicy$DefaultPermissionGrantedCallback;
.param p3, "externalLock" # Ljava/lang/Object;

.line 144
invoke-direct {p0}, Ljava/lang/Object;-><init>()V

.line 130
new-instance v0, Lcom/android/internal/logging/MetricsLogger;

invoke-direct {v0}, Lcom/android/internal/logging/MetricsLogger;-><init>()V

iput-object v0, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mMetricsLogger:Lcom/android/internal/logging/MetricsLogger;

.line 145
iput-object p1, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mContext:Landroid/content/Context;

.line 146
iput-object p3, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mLock:Ljava/lang/Object;

.line 147
const-class v0, Landroid/content/pm/PackageManagerInternal;

invoke-static {v0}, Lcom/android/server/LocalServices;->getService(Ljava/lang/Class;)Ljava/lang/Object;

move-result-object v0

check-cast v0, Landroid/content/pm/PackageManagerInternal;

iput-object v0, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mPackageManagerInt:Landroid/content/pm/PackageManagerInternal;

.line 148
const-class v0, Landroid/os/UserManagerInternal;

invoke-static {v0}, Lcom/android/server/LocalServices;->getService(Ljava/lang/Class;)Ljava/lang/Object;

move-result-object v0

check-cast v0, Landroid/os/UserManagerInternal;

iput-object v0, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mUserManagerInt:Landroid/os/UserManagerInternal;

.line 149
new-instance v0, Lcom/android/server/pm/permission/PermissionSettings;

iget-object v1, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mLock:Ljava/lang/Object;

invoke-direct {v0, p1, v1}, Lcom/android/server/pm/permission/PermissionSettings;-><init>(Landroid/content/Context;Ljava/lang/Object;)V

iput-object v0, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mSettings:Lcom/android/server/pm/permission/PermissionSettings;

.line 151
new-instance v0, Lcom/android/server/ServiceThread;

const-string v1, "PackageManager"

const/4 v2, 0x1

const/16 v3, 0xa

invoke-direct {v0, v1, v3, v2}, Lcom/android/server/ServiceThread;-><init>(Ljava/lang/String;IZ)V

iput-object v0, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mHandlerThread:Landroid/os/HandlerThread;

.line 153
iget-object v0, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mHandlerThread:Landroid/os/HandlerThread;

invoke-virtual {v0}, Landroid/os/HandlerThread;->start()V

.line 154
new-instance v0, Landroid/os/Handler;

iget-object v1, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mHandlerThread:Landroid/os/HandlerThread;

invoke-virtual {v1}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper;

move-result-object v1

invoke-direct {v0, v1}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V

iput-object v0, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mHandler:Landroid/os/Handler;

.line 155
invoke-static {}, Lcom/android/server/Watchdog;->getInstance()Lcom/android/server/Watchdog;

move-result-object v0

iget-object v1, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mHandler:Landroid/os/Handler;

invoke-virtual {v0, v1}, Lcom/android/server/Watchdog;->addThread(Landroid/os/Handler;)V

.line 157
new-instance v0, Lcom/android/server/pm/permission/DefaultPermissionGrantPolicy;

iget-object v1, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mHandlerThread:Landroid/os/HandlerThread;

.line 158
invoke-virtual {v1}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper;

move-result-object v1

invoke-direct {v0, p1, v1, p2, p0}, Lcom/android/server/pm/permission/DefaultPermissionGrantPolicy;-><init>(Landroid/content/Context;Landroid/os/Looper;Lcom/android/server/pm/permission/DefaultPermissionGrantPolicy$DefaultPermissionGrantedCallback;Lcom/android/server/pm/permission/PermissionManagerService;)V

iput-object v0, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mDefaultPermissionGrantPolicy:Lcom/android/server/pm/permission/DefaultPermissionGrantPolicy;

.line 159
invoke-static {}, Lcom/android/server/SystemConfig;->getInstance()Lcom/android/server/SystemConfig;

move-result-object v0

.line 160
.local v0, "systemConfig":Lcom/android/server/SystemConfig;
invoke-virtual {v0}, Lcom/android/server/SystemConfig;->getSystemPermissions()Landroid/util/SparseArray;

move-result-object v1

iput-object v1, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mSystemPermissions:Landroid/util/SparseArray;

.line 161
invoke-virtual {v0}, Lcom/android/server/SystemConfig;->getGlobalGids()[I

move-result-object v1

iput-object v1, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mGlobalGids:[I

.line 168
invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v1

const v3, 0x1070057

invoke-virtual {v1, v3}, Landroid/content/res/Resources;->getStringArray(I)[Ljava/lang/String;

move-result-object v1

.line 167
invoke-static {v1}, Lcom/android/server/pm/PackageManagerServiceUtils;->createSignatures([Ljava/lang/String;)[Landroid/content/pm/Signature;

move-result-object v1

iput-object v1, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mVendorPlatformSignatures:[Landroid/content/pm/Signature;

.line 165
invoke-static {}, Lcom/android/server/SystemConfig;->getInstance()Lcom/android/server/SystemConfig;

move-result-object v1

invoke-virtual {v1}, Lcom/android/server/SystemConfig;->getPermissions()Landroid/util/ArrayMap;

move-result-object v1

.line 166
.local v1, "permConfig":Landroid/util/ArrayMap;, "Landroid/util/ArrayMap<Ljava/lang/String;Lcom/android/server/SystemConfig$PermissionEntry;>;"
iget-object v3, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mLock:Ljava/lang/Object;

monitor-enter v3

.line 167
const/4 v4, 0x0

.local v4, "i":I
:goto_7b
:try_start_7b
invoke-virtual {v1}, Landroid/util/ArrayMap;->size()I

move-result v5

if-ge v4, v5, :cond_b0

.line 168
invoke-virtual {v1, v4}, Landroid/util/ArrayMap;->valueAt(I)Ljava/lang/Object;

move-result-object v5

check-cast v5, Lcom/android/server/SystemConfig$PermissionEntry;

.line 169
.local v5, "perm":Lcom/android/server/SystemConfig$PermissionEntry;
iget-object v6, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mSettings:Lcom/android/server/pm/permission/PermissionSettings;

iget-object v7, v5, Lcom/android/server/SystemConfig$PermissionEntry;->name:Ljava/lang/String;

invoke-virtual {v6, v7}, Lcom/android/server/pm/permission/PermissionSettings;->getPermissionLocked(Ljava/lang/String;)Lcom/android/server/pm/permission/BasePermission;

move-result-object v6

.line 170
.local v6, "bp":Lcom/android/server/pm/permission/BasePermission;
if-nez v6, :cond_a2

.line 171
new-instance v7, Lcom/android/server/pm/permission/BasePermission;

iget-object v8, v5, Lcom/android/server/SystemConfig$PermissionEntry;->name:Ljava/lang/String;

const-string v9, "android"

invoke-direct {v7, v8, v9, v2}, Lcom/android/server/pm/permission/BasePermission;-><init>(Ljava/lang/String;Ljava/lang/String;I)V

move-object v6, v7

.line 172
iget-object v7, p0, Lcom/android/server/pm/permission/PermissionManagerService;->mSettings:Lcom/android/server/pm/permission/PermissionSettings;

iget-object v8, v5, Lcom/android/server/SystemConfig$PermissionEntry;->name:Ljava/lang/String;

invoke-virtual {v7, v8, v6}, Lcom/android/server/pm/permission/PermissionSettings;->putPermissionLocked(Ljava/lang/String;Lcom/android/server/pm/permission/BasePermission;)V

.line 174
:cond_a2
iget-object v7, v5, Lcom/android/server/SystemConfig$PermissionEntry;->gids:[I

if-eqz v7, :cond_ad

.line 175
iget-object v7, v5, Lcom/android/server/SystemConfig$PermissionEntry;->gids:[I

iget-boolean v8, v5, Lcom/android/server/SystemConfig$PermissionEntry;->perUser:Z

invoke-virtual {v6, v7, v8}, Lcom/android/server/pm/permission/BasePermission;->setGids([IZ)V

.line 167
.end local v5 # "perm":Lcom/android/server/SystemConfig$PermissionEntry;
.end local v6 # "bp":Lcom/android/server/pm/permission/BasePermission;
:cond_ad
add-int/lit8 v4, v4, 0x1

goto :goto_7b

.line 178
.end local v4 # "i":I
:cond_b0
monitor-exit v3
:try_end_b1
.catchall {:try_start_7b .. :try_end_b1} :catchall_bd

.line 180
const-class v2, Lcom/android/server/pm/permission/PermissionManagerInternal;

new-instance v3, Lcom/android/server/pm/permission/PermissionManagerService$PermissionManagerInternalImpl;

const/4 v4, 0x0

invoke-direct {v3, p0, v4}, Lcom/android/server/pm/permission/PermissionManagerService$PermissionManagerInternalImpl;-><init>(Lcom/android/server/pm/permission/PermissionManagerService;Lcom/android/server/pm/permission/PermissionManagerService$1;)V

invoke-static {v2, v3}, Lcom/android/server/LocalServices;->addService(Ljava/lang/Class;Ljava/lang/Object;)V

.line 182
return-void

.line 178
:catchall_bd
move-exception v2

:try_start_be
monitor-exit v3
:try_end_bf
.catchall {:try_start_be .. :try_end_bf} :catchall_bd

throw v2
.end method