Skip to content

Commit

Permalink
Add details of Google Certificate lookup API
Browse files Browse the repository at this point in the history
  • Loading branch information
mar-v-in committed Aug 29, 2023
1 parent 541c61f commit 839248f
Show file tree
Hide file tree
Showing 17 changed files with 234 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ package org.microg.gms.appinivite

import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Build.VERSION.SDK_INT
import android.os.Bundle
import android.os.LocaleList
import android.util.Log
import android.view.ViewGroup
import android.view.Window
import android.widget.ProgressBar
import android.widget.RelativeLayout
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.pm.PackageInfoCompat
import androidx.core.os.bundleOf
Expand Down Expand Up @@ -146,7 +145,7 @@ class ProtobufPostRequest<I : Message<I, *>, O>(url: String, private val i: I, p

override fun getHeaders(): Map<String, String> {
val headers = HashMap(super.getHeaders())
headers["Accept-Language"] = if (Build.VERSION.SDK_INT >= 24) LocaleList.getDefault().toLanguageTags() else Locale.getDefault().language
headers["Accept-Language"] = if (SDK_INT >= 24) LocaleList.getDefault().toLanguageTags() else Locale.getDefault().language
headers["X-Android-Package"] = Constants.GMS_PACKAGE_NAME
headers["X-Android-Cert"] = Constants.GMS_PACKAGE_SIGNATURE_SHA1
return headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public class PackageUtils {
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.walletnfcrel", "82759e2db43f9ccbafce313bc674f35748fabd7a");
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.recorder", "394d84cd2cf89d3453702c663f98ec6554afc3cd");
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.messaging", "0980a12be993528c19107bc21ad811478c63cefc");
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.tachyon", "a0bc09af527b6397c7a9ef171d6cf76f757becc3");
}

public static boolean isGooglePackage(Context context, String packageName) {
Expand Down
2 changes: 2 additions & 0 deletions play-services-basement/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ dependencies {
api "androidx.collection:collection:1.0.0"
api "androidx.core:core:1.2.0"
api "androidx.fragment:fragment:1.0.0"

annotationProcessor project(':safe-parcel-processor')
}

android {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.common;

parcelable GoogleCertificatesLookupQuery;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.common;

parcelable GoogleCertificatesLookupResponse;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.common;

parcelable GoogleCertificatesQuery;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package com.google.android.gms.common.internal;

import com.google.android.gms.common.internal.GoogleCertificatesQuery;
import com.google.android.gms.common.GoogleCertificatesLookupQuery;
import com.google.android.gms.common.GoogleCertificatesLookupResponse;
import com.google.android.gms.common.GoogleCertificatesQuery;
import com.google.android.gms.dynamic.IObjectWrapper;

interface IGoogleCertificatesApi {
IObjectWrapper getGoogleCertificates();
IObjectWrapper getGoogleReleaseCertificates();
boolean isGoogleReleaseSigned(String packageName, IObjectWrapper certData);
boolean isGoogleSigned(String packageName, IObjectWrapper certData);
boolean isGoogleOrPlatformSigned(in GoogleCertificatesQuery query, IObjectWrapper packageManager);
IObjectWrapper getGoogleCertificates() = 0;
IObjectWrapper getGoogleReleaseCertificates() = 1;
boolean isGoogleReleaseSigned(String packageName, IObjectWrapper certData) = 2;
boolean isGoogleSigned(String packageName, IObjectWrapper certData) = 3;
boolean isGoogleOrPlatformSigned(in GoogleCertificatesQuery query, IObjectWrapper packageManager) = 4;
GoogleCertificatesLookupResponse isPackageGoogleOrPlatformSigned(in GoogleCertificatesLookupQuery query) = 5;
boolean isPackageGoogleOrPlatformSignedAvailable() = 6;
GoogleCertificatesLookupResponse queryPackageSigned(in GoogleCertificatesLookupQuery query) = 7;
boolean isFineGrainedPackageVerificationAvailable() = 8;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.common;

import android.content.Context;
import android.os.IBinder;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.dynamic.ObjectWrapper;
import org.microg.safeparcel.AutoSafeParcelable;

public class GoogleCertificatesLookupQuery extends AutoSafeParcelable {
@Field(1)
private String callingPackage;
@Field(2)
private boolean allowTestKeys;
@Field(3)
private boolean ignoreTestKeysOverride;
@Field(4)
private IObjectWrapper contextWrapper;
private Context context;
@Field(5)
private boolean isChimeraPackage;
@Field(6)
private boolean includeHashesInErrorMessage;

public String getCallingPackage() {
return callingPackage;
}

public Context getContext() {
if (context == null && contextWrapper != null) {
context = ObjectWrapper.unwrapTyped(contextWrapper, Context.class);
}
return context;
}

public static final Creator<GoogleCertificatesLookupQuery> CREATOR = findCreator(GoogleCertificatesLookupQuery.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.common;

import android.os.Parcel;
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;

@SafeParcelable.Class
public class GoogleCertificatesLookupResponse extends AbstractSafeParcelable {
@Field(1)
public final boolean result;
@Field(2)
public final String errorMessage;
@Field(3)
public final int statusValue;
@Field(4)
public final int firstPartyStatusValue;

@Constructor
public GoogleCertificatesLookupResponse(@Param(1) boolean result, @Param(2) String errorMessage, @Param(3) int statusValue, @Param(4) int firstPartyStatusValue) {
this.result = result;
this.errorMessage = errorMessage;
this.statusValue = statusValue;
this.firstPartyStatusValue = firstPartyStatusValue;
}

@Override
public void writeToParcel(Parcel out, int flags) {
CREATOR.writeToParcel(this, out, flags);
}

public static final SafeParcelableCreatorAndWriter<GoogleCertificatesLookupResponse> CREATOR = findCreator(GoogleCertificatesLookupResponse.class);
}
Original file line number Diff line number Diff line change
@@ -1,43 +1,35 @@
/*
* Copyright (C) 2019 microG Project Team
*
* 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.
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.common.internal;
package com.google.android.gms.common;

import android.os.IBinder;
import android.os.RemoteException;

import com.google.android.gms.common.internal.CertData;
import com.google.android.gms.common.internal.ICertData;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.dynamic.ObjectWrapper;

import org.microg.gms.common.Hide;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;

@Hide
public class GoogleCertificatesQuery extends AutoSafeParcelable {
@Field(1)
private String packageName;
private String callingPackage;
@Field(2)
private IBinder certDataBinder;
private CertData certData;
@Field(3)
private boolean allowNonRelease;
@Field(4)
private boolean allowTestKeys;
@Field(4)
private boolean ignoreTestKeysOverride;

public String getPackageName() {
return packageName;
public String getCallingPackage() {
return callingPackage;
}

public CertData getCertData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ public class DynamiteModule {

public interface VersionPolicy {
interface IVersions {
/* renamed from: zza */
int getLocalVersion(@NonNull Context context, @NonNull String moduleId);

/* renamed from: zzb */
int getRemoteVersion(@NonNull Context context, @NonNull String moduleId, boolean forceStaging) throws LoadingException;

IVersions Default = new IVersions() {
Expand Down
1 change: 1 addition & 0 deletions play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.chimera;

import android.annotation.SuppressLint;
import android.util.Log;
import androidx.annotation.Keep;

import android.content.Context;

@Keep
public class DynamiteModuleInitializer {
private static final String TAG = "DynamiteModule";

public static void initializeModuleV1(Context context) {
initializeModuleV2(context, "com.google.android.gms".equals(context.getPackageName()));
}

public static void initializeModuleV2(Context context, boolean withGmsPackage) {
Log.d(TAG, "initializeModuleV2 context: " + context + ", withGmsPackage: " + withGmsPackage);
}
}

This file was deleted.

Loading

0 comments on commit 839248f

Please sign in to comment.