Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Device Sync request #2621

Merged
merged 11 commits into from
Dec 18, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ object Build {
var DEVICE_INITIAL_SDK_INT: Int = 0
}

object VERSION_CODES {
const val LOLLIPOP = 21 // Android 5.0
const val LOLLIPOP_MR1 = 22 // Android 5.1
const val M = 23 // Android 6.0 (Marshmallow)
const val N = 24 // Android 7.0 (Nougat)
const val N_MR1 = 25 // Android 7.1
const val O = 26 // Android 8.0 (Oreo)
const val O_MR1 = 27 // Android 8.1
const val P = 28 // Android 9 (Pie)
const val Q = 29 // Android 10
const val R = 30 // Android 11
const val S = 31 // Android 12
const val S_V2 = 32 // Android 12L
const val TIRAMISU = 33 // Android 13
const val UPSIDE_DOWN_CAKE = 34 // Android 14
}
mar-v-in marked this conversation as resolved.
Show resolved Hide resolved

fun generateWebViewUserAgentString(original: String): String {
if (!original.startsWith("Mozilla/5.0 (")) return original
val closeParen: Int = original.indexOf(')')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ public class Constants {
public static final String MICROG_PACKAGE_SIGNATURE_SHA1 = "10321bd893f69af97f7573aafe9de1dc0901f3a1";
@Deprecated
public static final int MAX_REFERENCE_VERSION = GMS_VERSION_CODE;
public static final String VENDING_PACKAGE_NAME = "com.android.vending";
}
5 changes: 5 additions & 0 deletions play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@
android:permissionGroup="com.google.android.gms.permission.CAR_INFORMATION"
android:protectionLevel="dangerous" />

<permission
android:name="com.google.android.gms.auth.permission.GOOGLE_ACCOUNT_CHANGE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.google.android.gms.auth.permission.GOOGLE_ACCOUNT_CHANGE" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
Expand Down Expand Up @@ -77,6 +78,7 @@
import static org.microg.gms.auth.AuthPrefs.isAuthVisible;
import static org.microg.gms.common.Constants.GMS_PACKAGE_NAME;
import static org.microg.gms.common.Constants.GMS_VERSION_CODE;
import static org.microg.gms.common.Constants.VENDING_PACKAGE_NAME;

public class LoginActivity extends AssistantActivity {
public static final String TMPL_NEW_ACCOUNT = "new_account";
Expand All @@ -91,6 +93,8 @@ public class LoginActivity extends AssistantActivity {
private static final String GOOGLE_SUITE_URL = "https://accounts.google.com/signin/continue";
private static final String MAGIC_USER_AGENT = " MinuteMaid";
private static final String COOKIE_OAUTH_TOKEN = "oauth_token";
private static final String ACTION_UPDATE_ACCOUNT = "com.google.android.gms.auth.GOOGLE_ACCOUNT_CHANGE";
private static final String PERMISSION_UPDATE_ACCOUNT = "com.google.android.gms.auth.permission.GOOGLE_ACCOUNT_CHANGE";

private final FidoHandler fidoHandler = new FidoHandler(this);
private final DroidGuardHandler dgHandler = new DroidGuardHandler(this);
Expand Down Expand Up @@ -357,6 +361,10 @@ private void returnSuccessResponse(Account account){
bd.putString(AccountManager.KEY_ACCOUNT_TYPE,accountType);
response.onResult(bd);
}
Intent intent = new Intent(ACTION_UPDATE_ACCOUNT);
intent.setPackage(VENDING_PACKAGE_NAME);
intent.putExtra(AccountManager.KEY_ACCOUNT_NAME, account.name);
sendBroadcast(intent, PERMISSION_UPDATE_ACCOUNT);
}
private void retrieveGmsToken(final Account account) {
final AuthManager authManager = new AuthManager(this, account.name, GMS_PACKAGE_NAME, "ac2dm");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public String getGroupName(Context context) {
@Override
public void doChecks(Context context, ResultCollector collector) {
addPackageInstalledAndSignedResult(context, collector, context.getString(R.string.self_check_pkg_gms), Constants.GMS_PACKAGE_NAME, Constants.GMS_PACKAGE_SIGNATURE_SHA1);
addPackageInstalledAndSignedResult(context, collector, context.getString(R.string.self_check_pkg_vending), "com.android.vending", Constants.GMS_PACKAGE_SIGNATURE_SHA1);
addPackageInstalledAndSignedResult(context, collector, context.getString(R.string.self_check_pkg_vending), Constants.VENDING_PACKAGE_NAME, Constants.GMS_PACKAGE_SIGNATURE_SHA1);
addPackageInstalledResult(context, collector, context.getString(R.string.self_check_pkg_gsf), Constants.GSF_PACKAGE_NAME);
}

Expand Down
10 changes: 10 additions & 0 deletions vending-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.google.android.gms.permission.READ_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.gms.auth.permission.GOOGLE_ACCOUNT_CHANGE"/>

<uses-permission
android:name="android.permission.USE_CREDENTIALS"
Expand Down Expand Up @@ -175,5 +176,14 @@
</intent-filter>
</service>

<receiver
android:name="com.google.android.finsky.accounts.impl.AccountsChangedReceiver"
android:permission="com.google.android.gms.auth.permission.GOOGLE_ACCOUNT_CHANGE"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.auth.GOOGLE_ACCOUNT_CHANGE"/>
</intent-filter>
</receiver>

</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ class GooglePlayApi {
const val URL_AUTH_PROOF_TOKENS = "https://www.googleapis.com/reauth/v1beta/users/me/reauthProofTokens"
const val URL_DETAILS = "$URL_FDFE/details"
const val URL_PURCHASE = "$URL_FDFE/purchase"
const val URL_SYNC = "$URL_FDFE/sync"
}
}
Loading