Rework known google package system

We now store which special google package privilege to grant per package.
This commit is contained in:
Marvin W 2024-03-03 20:17:51 +01:00 • committed by Cuynu
commit fdcf3d7edd
2 changed files with 1002 additions and 72 deletions

View file

@ -16,8 +16,10 @@
package com.google.android.gms.common.internal;
import android.os.IBinder;
import android.os.RemoteException;
import androidx.annotation.Nullable;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.dynamic.ObjectWrapper;
@ -63,4 +65,40 @@ public class CertData extends ICertData.Stub {
public int remoteHashCode() {
return hashCode();
}
@Nullable
public static CertData unwrap(IBinder certDataBinder) {
if (certDataBinder instanceof CertData) {
return (CertData) certDataBinder;
} else if (certDataBinder instanceof IObjectWrapper) {
return unwrap((IObjectWrapper) certDataBinder);
} else if (certDataBinder instanceof ICertData) {
return unwrap((ICertData) certDataBinder);
}
return null;
}
public static CertData unwrap(IObjectWrapper certDataWrapper) {
CertData certData = ObjectWrapper.unwrapTyped(certDataWrapper, CertData.class);
if (certData != null) return certData;
byte[] bytes = ObjectWrapper.unwrapTyped(certDataWrapper, byte[].class);
if (bytes != null) return new CertData(bytes);
ICertData iCertData = ObjectWrapper.unwrapTyped(certDataWrapper, ICertData.class);
if (iCertData != null) return unwrap(iCertData);
return null;
}
public static CertData unwrap(ICertData iCertData) {
if (iCertData == null) return null;
if (iCertData instanceof CertData) return (CertData) iCertData;
try {
byte[] bytes = ObjectWrapper.unwrapTyped(iCertData.getWrappedBytes(), byte[].class);
if (bytes != null) {
return new CertData(bytes);
}
} catch (RemoteException e) {
// Ignore
}
return null;
}
}

View file

@ -46,33 +46,7 @@ public class GoogleCertificatesQuery extends AutoSafeParcelable {
public CertData getCertData() {
if (certData == null && certDataBinder != null) {
ICertData iCertData = null;
if (certDataBinder instanceof CertData) {
certData = (CertData) certDataBinder;
} else if (certDataBinder instanceof IObjectWrapper) {
certData = ObjectWrapper.unwrapTyped((IObjectWrapper) certDataBinder, CertData.class);
if (certData == null) {
byte[] bytes = ObjectWrapper.unwrapTyped((IObjectWrapper) certDataBinder, byte[].class);
if (bytes != null) {
certData = new CertData(bytes);
}
}
if (certData == null) {
iCertData = ObjectWrapper.unwrapTyped((IObjectWrapper) certDataBinder, ICertData.class);
}
} else if (certDataBinder instanceof ICertData) {
iCertData = (ICertData) certDataBinder;
}
if (iCertData != null) {
try {
byte[] bytes = ObjectWrapper.unwrapTyped(iCertData.getWrappedBytes(), byte[].class);
if (bytes != null) {
certData = new CertData(bytes);
}
} catch (RemoteException e) {
// Ignore
}
}
certData = CertData.unwrap(certDataBinder);
}
return certData;
}