Skip to content

Commit 7f8a5d0

Browse files
Merge branch 'master' into wearos-bluetooth-support
2 parents 48c962e + 41d01cb commit 7f8a5d0

File tree

49 files changed

+892
-286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+892
-286
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ buildscript {
2424
ext.preferenceVersion = '1.2.0'
2525
ext.recyclerviewVersion = '1.3.2'
2626
ext.webkitVersion = '1.10.0'
27+
ext.workVersion = '2.7.0'
2728

2829
ext.slf4jVersion = '1.7.36'
2930
ext.volleyVersion = '1.2.1'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 microG Project Team
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package com.google.android.gms.auth.api.identity;
7+
8+
parcelable ClearTokenRequest;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 microG Project Team
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package com.google.android.gms.auth.api.identity;
7+
8+
parcelable RevokeAccessRequest;

play-services-auth/src/main/aidl/com/google/android/gms/auth/api/identity/internal/IAuthorizationService.aidl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ import com.google.android.gms.auth.api.identity.internal.IAuthorizationCallback;
99
import com.google.android.gms.auth.api.identity.internal.IVerifyWithGoogleCallback;
1010
import com.google.android.gms.auth.api.identity.AuthorizationRequest;
1111
import com.google.android.gms.auth.api.identity.VerifyWithGoogleRequest;
12+
import com.google.android.gms.auth.api.identity.RevokeAccessRequest;
13+
import com.google.android.gms.auth.api.identity.ClearTokenRequest;
14+
import com.google.android.gms.common.api.internal.IStatusCallback;
1215

1316
interface IAuthorizationService {
1417
void authorize(in IAuthorizationCallback callback, in AuthorizationRequest request) = 0;
1518
void verifyWithGoogle(in IVerifyWithGoogleCallback callback, in VerifyWithGoogleRequest request) = 1;
19+
void revokeAccess(in IStatusCallback callback, in RevokeAccessRequest request) = 2;
20+
void clearToken(in IStatusCallback callback, in ClearTokenRequest request) = 3;
1621
}

play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/RevokeAccessRequest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,13 @@ public static abstract class Builder {
143143
public void writeToParcel(@NonNull Parcel parcel, int flags) {
144144
CREATOR.writeToParcel(this, parcel, flags);
145145
}
146+
147+
@Override
148+
public String toString() {
149+
return "RevokeAccessRequest{" +
150+
"scopes=" + scopes +
151+
", account=" + account +
152+
", sessionId='" + sessionId + '\'' +
153+
'}';
154+
}
146155
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2025 microG Project Team
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package org.microg.gms.common
7+
8+
import android.accounts.Account
9+
import android.annotation.SuppressLint
10+
import android.content.Context
11+
import android.content.Context.MODE_PRIVATE
12+
import androidx.core.content.edit
13+
import org.microg.gms.auth.AuthConstants
14+
15+
class AccountUtils(val context: Context) {
16+
17+
private val prefs = context.getSharedPreferences("common.selected_account_prefs", MODE_PRIVATE)
18+
19+
companion object {
20+
private const val TYPE = "selected_account_type:"
21+
@SuppressLint("StaticFieldLeak")
22+
@Volatile
23+
private var instance: AccountUtils? = null
24+
fun get(context: Context): AccountUtils = instance ?: synchronized(this) {
25+
instance ?: AccountUtils(context.applicationContext).also { instance = it }
26+
}
27+
}
28+
29+
fun saveSelectedAccount(packageName: String, account: Account?) {
30+
if (account != null) {
31+
prefs.edit(true) {
32+
putString(packageName, account.name)
33+
putString(TYPE.plus(packageName), account.type)
34+
}
35+
}
36+
}
37+
38+
fun getSelectedAccount(packageName: String): Account? {
39+
val name = prefs.getString(packageName, null) ?: return null
40+
val type = prefs.getString(TYPE.plus(packageName), AuthConstants.DEFAULT_ACCOUNT_TYPE) ?: return null
41+
return Account(name, type)
42+
}
43+
44+
fun removeSelectedAccount(packageName: String) {
45+
prefs.edit {
46+
remove(packageName)
47+
remove(TYPE.plus(packageName))
48+
}
49+
}
50+
}

play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ object SettingsContract {
279279
const val ASSET_DEVICE_SYNC = "vending_device_sync"
280280
const val APPS_INSTALL = "vending_apps_install"
281281
const val APPS_INSTALLER_LIST = "vending_apps_installer_list"
282+
const val PLAY_INTEGRITY_APP_LIST = "vending_play_integrity_apps"
282283

283284
val PROJECTION = arrayOf(
284285
LICENSING,
@@ -289,6 +290,7 @@ object SettingsContract {
289290
ASSET_DEVICE_SYNC,
290291
APPS_INSTALL,
291292
APPS_INSTALLER_LIST,
293+
PLAY_INTEGRITY_APP_LIST
292294
)
293295
}
294296

play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsProvider.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ class SettingsProvider : ContentProvider() {
369369
Vending.SPLIT_INSTALL -> getSettingsBoolean(key, false)
370370
Vending.APPS_INSTALL -> getSettingsBoolean(key, false)
371371
Vending.APPS_INSTALLER_LIST -> getSettingsString(key, "")
372+
Vending.PLAY_INTEGRITY_APP_LIST -> getSettingsString(key, "")
372373
else -> throw IllegalArgumentException("Unknown key: $key")
373374
}
374375
}
@@ -386,6 +387,7 @@ class SettingsProvider : ContentProvider() {
386387
Vending.ASSET_DEVICE_SYNC -> editor.putBoolean(key, value as Boolean)
387388
Vending.APPS_INSTALL -> editor.putBoolean(key, value as Boolean)
388389
Vending.APPS_INSTALLER_LIST -> editor.putString(key, value as String)
390+
Vending.PLAY_INTEGRITY_APP_LIST -> editor.putString(key, value as String)
389391
else -> throw IllegalArgumentException("Unknown key: $key")
390392
}
391393
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2025 microG Project Team
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package org.microg.gms.vending
7+
8+
import org.json.JSONException
9+
import org.json.JSONObject
10+
11+
class PlayIntegrityData(var allowed: Boolean,
12+
val packageName: String,
13+
val pkgSignSha256: String,
14+
var lastTime: Long,
15+
var lastResult: String? = null,
16+
var lastStatus: Boolean = false) {
17+
18+
override fun toString(): String {
19+
return JSONObject()
20+
.put(ALLOWED, allowed)
21+
.put(PACKAGE_NAME, packageName)
22+
.put(SIGNATURE, pkgSignSha256)
23+
.put(LAST_VISIT_TIME, lastTime)
24+
.put(LAST_VISIT_RESULT, lastResult)
25+
.put(LAST_VISIT_STATUS, lastStatus)
26+
.toString()
27+
}
28+
29+
companion object {
30+
private const val PACKAGE_NAME = "packageName"
31+
private const val ALLOWED = "allowed"
32+
private const val SIGNATURE = "signature"
33+
private const val LAST_VISIT_TIME = "lastVisitTime"
34+
private const val LAST_VISIT_RESULT = "lastVisitResult"
35+
private const val LAST_VISIT_STATUS = "lastVisitStatus"
36+
37+
private fun parse(jsonString: String): PlayIntegrityData? {
38+
try {
39+
val json = JSONObject(jsonString)
40+
return PlayIntegrityData(
41+
json.getBoolean(ALLOWED),
42+
json.getString(PACKAGE_NAME),
43+
json.getString(SIGNATURE),
44+
json.getLong(LAST_VISIT_TIME),
45+
json.getString(LAST_VISIT_RESULT),
46+
json.getBoolean(LAST_VISIT_STATUS)
47+
)
48+
} catch (e: JSONException) {
49+
return null
50+
}
51+
}
52+
53+
fun loadDataSet(content: String): Set<PlayIntegrityData> {
54+
return content.split("|").mapNotNull { parse(it) }.toSet()
55+
}
56+
57+
fun updateDataSetString(channelList: Set<PlayIntegrityData>, channel: PlayIntegrityData): String {
58+
val channelData = channelList.find { it.packageName == channel.packageName && it.pkgSignSha256 == channel.pkgSignSha256 }
59+
val newChannelList = if (channelData != null) {
60+
channelData.allowed = channel.allowed
61+
channelData.lastTime = channel.lastTime
62+
channelData.lastResult = channel.lastResult
63+
channelData.lastStatus = channel.lastStatus
64+
channelList
65+
} else {
66+
channelList + channel
67+
}
68+
return newChannelList.let { it -> it.joinToString(separator = "|") { it.toString() } }
69+
}
70+
}
71+
}

play-services-core/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ dependencies {
102102

103103
implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion"
104104
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
105+
106+
implementation "androidx.work:work-runtime-ktx:$workVersion"
105107
}
106108

107109
android {

0 commit comments

Comments
 (0)