mirror of
https://github.com/YTVanced/VancedMicroG
synced 2024-11-23 11:45:11 +00:00
MicroG 0.2.22.212658
This commit is contained in:
parent
020b789fe8
commit
da6399b18c
29 changed files with 205 additions and 171 deletions
2
.github/workflows/debug.yml
vendored
2
.github/workflows/debug.yml
vendored
|
@ -16,7 +16,7 @@ jobs:
|
|||
- name: JDK 8 Setup
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
java-version: 11.0.8
|
||||
|
||||
- name: Install NDK
|
||||
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.0.6113669"
|
||||
|
|
|
@ -36,7 +36,7 @@ buildscript {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||
classpath 'com.android.tools.build:gradle:7.0.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
||||
classpath "com.squareup.wire:wire-gradle-plugin:$wireVersion"
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ allprojects {
|
|||
apply plugin: 'idea'
|
||||
|
||||
group = 'org.microg.gms'
|
||||
version = "0.2.21.212417"
|
||||
ext.appVersionCode = 212417001
|
||||
version = "0.2.22.212658"
|
||||
ext.appVersionCode = 212658001
|
||||
ext.isReleaseVersion = false
|
||||
}
|
||||
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Sat Jul 03 09:49:43 CEST 2021
|
||||
#Sat Sep 11 09:04:01 CEST 2021
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
|
@ -3,5 +3,5 @@ package com.google.android.gms.clearcut.internal;
|
|||
import com.google.android.gms.common.api.Status;
|
||||
|
||||
interface IClearcutLoggerCallbacks {
|
||||
void onStatus(in Status status) = 0;
|
||||
oneway void onStatus(in Status status) = 0;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,6 @@ import com.google.android.gms.common.api.Status;
|
|||
import com.mgoogle.android.gms.phenotype.Configurations;
|
||||
|
||||
interface IPhenotypeCallbacks {
|
||||
void onRegister(in Status status) = 0;
|
||||
void onConfigurations(in Status status, in Configurations configurations) = 3;
|
||||
oneway void onRegister(in Status status) = 0;
|
||||
oneway void onConfigurations(in Status status, in Configurations configurations) = 3;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ package com.google.android.gms.clearcut;
|
|||
|
||||
import android.util.Base64;
|
||||
|
||||
import com.google.android.gms.phenotype.ExperimentToken;
|
||||
import com.google.android.gms.phenotype.GenericDimension;
|
||||
import com.google.android.gms.playlog.internal.PlayLoggerContext;
|
||||
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
@ -30,30 +32,36 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.Arrays;
|
||||
|
||||
public class LogEventParcelable extends AutoSafeParcelable {
|
||||
@SafeParceled(1)
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
|
||||
@SafeParceled(2)
|
||||
@Field(2)
|
||||
public final PlayLoggerContext context;
|
||||
|
||||
@SafeParceled(3)
|
||||
@Field(3)
|
||||
public final byte[] bytes;
|
||||
|
||||
@SafeParceled(4)
|
||||
@Field(4)
|
||||
public final int[] testCodes;
|
||||
|
||||
@SafeParceled(5)
|
||||
@Field(5)
|
||||
public final String[] mendelPackages;
|
||||
|
||||
@SafeParceled(6)
|
||||
@Field(6)
|
||||
public final int[] experimentIds;
|
||||
|
||||
@SafeParceled(7)
|
||||
@Field(7)
|
||||
public final byte[][] experimentTokens;
|
||||
|
||||
@SafeParceled(8)
|
||||
@Field(8)
|
||||
public final boolean addPhenotypeExperimentTokens;
|
||||
|
||||
@Field(9)
|
||||
public final ExperimentToken[] experimentTokenParcelables;
|
||||
|
||||
@Field(10)
|
||||
public final GenericDimension[] genericDimensions;
|
||||
|
||||
private LogEventParcelable() {
|
||||
context = null;
|
||||
bytes = null;
|
||||
|
@ -61,6 +69,8 @@ public class LogEventParcelable extends AutoSafeParcelable {
|
|||
mendelPackages = null;
|
||||
experimentTokens = null;
|
||||
addPhenotypeExperimentTokens = false;
|
||||
experimentTokenParcelables = null;
|
||||
genericDimensions = null;
|
||||
}
|
||||
|
||||
public LogEventParcelable(PlayLoggerContext context, byte[] bytes, int[] testCodes, String[] mendelPackages, int[] experimentIds, byte[][] experimentTokens, boolean addPhenotypeExperimentTokens) {
|
||||
|
@ -71,6 +81,8 @@ public class LogEventParcelable extends AutoSafeParcelable {
|
|||
this.experimentIds = experimentIds;
|
||||
this.experimentTokens = experimentTokens;
|
||||
this.addPhenotypeExperimentTokens = addPhenotypeExperimentTokens;
|
||||
experimentTokenParcelables = null;
|
||||
genericDimensions = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,55 +21,49 @@ import org.microg.safeparcel.SafeParceled;
|
|||
|
||||
public class PlayLoggerContext extends AutoSafeParcelable {
|
||||
|
||||
@SafeParceled(1)
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
|
||||
@SafeParceled(2)
|
||||
@Field(2)
|
||||
public final String packageName;
|
||||
|
||||
@SafeParceled(3)
|
||||
@Field(3)
|
||||
public final int packageVersionCode;
|
||||
|
||||
@SafeParceled(4)
|
||||
@Field(4)
|
||||
public final int logSource;
|
||||
|
||||
@SafeParceled(5)
|
||||
public final String uploadAccount;
|
||||
|
||||
@SafeParceled(6)
|
||||
public final int loggingId;
|
||||
|
||||
@SafeParceled(7)
|
||||
public final boolean logAndroidId;
|
||||
|
||||
@SafeParceled(8)
|
||||
@Field(8)
|
||||
public final String logSourceName;
|
||||
|
||||
@SafeParceled(9)
|
||||
@Field(5)
|
||||
public final String uploadAccount;
|
||||
|
||||
@Field(6)
|
||||
public final String loggingId;
|
||||
|
||||
@Field(7)
|
||||
public final boolean logAndroidId;
|
||||
|
||||
@Field(9)
|
||||
public final boolean isAnonymous;
|
||||
|
||||
@SafeParceled(10)
|
||||
@Field(10)
|
||||
public final int qosTier;
|
||||
|
||||
@Field(11)
|
||||
public final Integer appMobileSpecId;
|
||||
|
||||
@Field(12)
|
||||
public final boolean scrubMccMnc;
|
||||
|
||||
private PlayLoggerContext() {
|
||||
packageName = uploadAccount = logSourceName = null;
|
||||
qosTier = packageVersionCode = logSource = loggingId = -1;
|
||||
isAnonymous = logAndroidId = false;
|
||||
packageName = uploadAccount = logSourceName = loggingId = null;
|
||||
qosTier = packageVersionCode = logSource = appMobileSpecId = -1;
|
||||
isAnonymous = logAndroidId = scrubMccMnc = false;
|
||||
}
|
||||
|
||||
public PlayLoggerContext(String packageName, int packageVersionCode, int logSource, String uploadAccount, int loggingId, boolean logAndroidId) {
|
||||
this.packageName = packageName;
|
||||
this.packageVersionCode = packageVersionCode;
|
||||
this.logSource = logSource;
|
||||
this.logSourceName = null;
|
||||
this.uploadAccount = uploadAccount;
|
||||
this.loggingId = loggingId;
|
||||
this.logAndroidId = logAndroidId;
|
||||
this.isAnonymous = false;
|
||||
this.qosTier = 0;
|
||||
}
|
||||
|
||||
public PlayLoggerContext(String packageName, int packageVersionCode, int logSource, String logSourceName, String uploadAccount, int loggingId, boolean isAnonymous, int qosTier) {
|
||||
public PlayLoggerContext(String packageName, int packageVersionCode, int logSource, String logSourceName, String uploadAccount, String loggingId, boolean isAnonymous, int qosTier, boolean scrubMccMnc) {
|
||||
this.packageName = packageName;
|
||||
this.packageVersionCode = packageVersionCode;
|
||||
this.logSource = logSource;
|
||||
|
@ -79,22 +73,25 @@ public class PlayLoggerContext extends AutoSafeParcelable {
|
|||
this.logAndroidId = !isAnonymous;
|
||||
this.isAnonymous = isAnonymous;
|
||||
this.qosTier = qosTier;
|
||||
this.appMobileSpecId = null;
|
||||
this.scrubMccMnc = scrubMccMnc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PlayLoggerContext[" + versionCode +
|
||||
", package=" + packageName +
|
||||
", packageVersionCode=" + packageVersionCode +
|
||||
", logSource=" + logSource +
|
||||
", uploadAccount=" + uploadAccount +
|
||||
", loggingId=" + loggingId +
|
||||
", logAndroidId=" + logAndroidId +
|
||||
", logSourceName=" + logSourceName +
|
||||
", isAnonymous=" + isAnonymous +
|
||||
", qosTier=" + qosTier +
|
||||
']';
|
||||
final StringBuilder sb = new StringBuilder("PlayLoggerContext[").append(versionCode);
|
||||
sb.append(", package=").append(packageName);
|
||||
sb.append(", packageVersionCode=").append(packageVersionCode);
|
||||
sb.append(", logSource=").append(logSource);
|
||||
sb.append(", uploadAccount=").append(uploadAccount);
|
||||
sb.append(", loggingId=").append(loggingId);
|
||||
sb.append(", logAndroidId=").append(logAndroidId);
|
||||
sb.append(", logSourceName=").append(logSourceName);
|
||||
sb.append(", isAnonymous=").append(isAnonymous);
|
||||
sb.append(", qosTier=").append(qosTier);
|
||||
sb.append(']');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static Creator<PlayLoggerContext> CREATOR = new AutoCreator<>(PlayLoggerContext.class);
|
||||
public static Creator<PlayLoggerContext> CREATOR = new AutoCreator<PlayLoggerContext>(PlayLoggerContext.class);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.phenotype;
|
||||
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class ExperimentToken extends AutoSafeParcelable {
|
||||
public static final Creator<ExperimentToken> CREATOR = new AutoCreator<>(ExperimentToken.class);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.phenotype;
|
||||
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class GenericDimension extends AutoSafeParcelable {
|
||||
@Field(1)
|
||||
public int a;
|
||||
@Field(2)
|
||||
public int b;
|
||||
|
||||
public static final Creator<GenericDimension> CREATOR = new AutoCreator<>(GenericDimension.class);
|
||||
}
|
|
@ -39,6 +39,6 @@ dependencies {
|
|||
api project(':play-services-tasks')
|
||||
api project(':play-services-base-api')
|
||||
|
||||
implementation 'androidx.fragment:fragment:1.3.5'
|
||||
implementation 'androidx.fragment:fragment:1.3.6'
|
||||
implementation 'com.google.android.gms:play-services-base:17.6.0'
|
||||
}
|
|
@ -4,11 +4,11 @@ import com.google.android.gms.cast.LaunchOptions;
|
|||
import com.google.android.gms.cast.JoinOptions;
|
||||
|
||||
interface ICastDeviceController {
|
||||
void disconnect() = 0;
|
||||
void stopApplication(String sessionId) = 4;
|
||||
void sendMessage(String namespace, String message, long requestId) = 8;
|
||||
void registerNamespace(String namespace) = 10;
|
||||
void unregisterNamespace(String namespace) = 11;
|
||||
void launchApplication(String applicationId, in LaunchOptions launchOptions) = 12;
|
||||
void joinApplication(String applicationId, String sessionId, in JoinOptions joinOptions) = 13;
|
||||
oneway void disconnect() = 0;
|
||||
oneway void stopApplication(String sessionId) = 4;
|
||||
oneway void sendMessage(String namespace, String message, long requestId) = 8;
|
||||
oneway void registerNamespace(String namespace) = 10;
|
||||
oneway void unregisterNamespace(String namespace) = 11;
|
||||
oneway void launchApplication(String applicationId, in LaunchOptions launchOptions) = 12;
|
||||
oneway void joinApplication(String applicationId, String sessionId, in JoinOptions joinOptions) = 13;
|
||||
}
|
||||
|
|
|
@ -21,9 +21,6 @@ apply plugin: 'kotlin-kapt'
|
|||
dependencies {
|
||||
implementation 'com.squareup.wire:wire-runtime:3.6.1'
|
||||
implementation 'de.hdodenhof:circleimageview:3.1.0'
|
||||
// TODO: Switch to upstream once raw requests are merged
|
||||
// https://github.com/vitalidze/chromecast-java-api-v2/pull/99
|
||||
// implementation "su.litvak.chromecast:api-v2:0.10.4"
|
||||
implementation "info.armills.chromecast-java-api-v2:api-v2-raw-request:0.10.4-raw-request-1"
|
||||
|
||||
implementation project(':play-services-cronet-core')
|
||||
|
@ -33,8 +30,8 @@ dependencies {
|
|||
implementation project(':play-services-cast-api')
|
||||
|
||||
// AndroidX UI
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||
implementation 'androidx.mediarouter:mediarouter:1.2.4'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'androidx.mediarouter:mediarouter:1.2.5'
|
||||
implementation "androidx.preference:preference-ktx:$preferenceVersion"
|
||||
|
||||
implementation "org.microg.gms:conscrypt-gmscore:2.5.1"
|
||||
|
|
|
@ -38,7 +38,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation "androidx.preference:preference:$preferenceVersion"
|
||||
}
|
||||
|
||||
|
|
|
@ -91,13 +91,6 @@
|
|||
android:name="fake-signature"
|
||||
android:value="@string/fake_signature" />
|
||||
|
||||
<!-- Internal Settings -->
|
||||
|
||||
<provider
|
||||
android:name="org.microg.mgms.settings.SettingsProvider"
|
||||
android:authorities="org.microg.mgms.settings"
|
||||
android:exported="false" />
|
||||
|
||||
<!-- Services Framework -->
|
||||
|
||||
<provider
|
||||
|
@ -478,6 +471,7 @@
|
|||
<action android:name="com.google.android.gms.herrevad.services.LightweightNetworkQualityAndroidService.START" />
|
||||
<action android:name="com.google.android.gms.gass.START" />
|
||||
<action android:name="com.google.android.gms.audit.service.START" />
|
||||
<action android:name="com.google.android.mobstore.service.START" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
|
|
|
@ -29,7 +29,10 @@ public class ClearcutLoggerServiceImpl extends IClearcutLoggerService.Stub {
|
|||
|
||||
@Override
|
||||
public void log(IClearcutLoggerCallbacks callbacks, LogEventParcelable event) throws RemoteException {
|
||||
Log.d(TAG, "log: " + event);
|
||||
callbacks.onStatus(Status.SUCCESS);
|
||||
// These logs are not really helpful for us, so let's just ignore it.
|
||||
try {
|
||||
callbacks.onStatus(Status.SUCCESS);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,23 +50,7 @@ public class PackageUtils {
|
|||
|
||||
static {
|
||||
KNOWN_GOOGLE_PACKAGES = new HashMap<>();
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.classroom", "46f6c8987311e131f4f558d8e0ae145bebab6da3");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.inbox", "aa87ce1260c008d801197bb4ecea4ab8929da246");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.playconsole", "d6c35e55b481aefddd74152ca7254332739a81d6");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.travel.onthego", "0cbe08032217d45e61c0bc72f294395ee9ecb5d5");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.tycho", "01b844184e360686aa98b48eb16e05c76d4a72ad");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.contacts", "ee3e2b5d95365c5a1ccc2d8dfe48d94eb33b3ebe");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.wearable.app", "a197f9212f2fed64f0ff9c2a4edf24b9c8801c8c");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.youtube.music", "afb0fed5eeaebdd86f56a97742f4b6b33ef59875");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.vr.home", "fc1edc68f7e3e4963c998e95fc38f3de8d1bfc96");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.vr.cyclops", "188c5ca3863fa121216157a5baa80755ceda70ab");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.waze", "35b438fe1bc69d975dc8702dc16ab69ebf65f26f");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.wellbeing", "4ebdd02380f1fa0b6741491f0af35625dba76e9f");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.village.boond", "48e7985b8f901df335b5d5223579c81618431c7b");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.subscriptions.red", "de8304ace744ae4c4e05887a27a790815e610ff0");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.meetings", "47a6936b733dbdb45d71997fbe1d610eca36b8bf");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.dynamite", "519c5a17a60596e6fe5933b9cb4285e7b0e5eb7b");
|
||||
KNOWN_GOOGLE_PACKAGES.put("com.google.android.projection.gearhead", "9ca91f9e704d630ef67a23f52bf1577a92b9ca5d");
|
||||
}
|
||||
|
||||
public static boolean isGooglePackage(Context context, String packageName) {
|
||||
|
|
|
@ -293,8 +293,8 @@ public class McsService extends Service implements Handler.Callback {
|
|||
|
||||
public synchronized static long getCurrentDelay() {
|
||||
long delay = currentDelay == 0 ? 5000 : currentDelay;
|
||||
if (currentDelay < 60000) currentDelay += 10000;
|
||||
if (currentDelay >= 60000 && currentDelay < 600000) currentDelay += 60000;
|
||||
if (currentDelay < GcmPrefs.INTERVAL) currentDelay += 10000;
|
||||
if (currentDelay >= GcmPrefs.INTERVAL && currentDelay < 600000) currentDelay += GcmPrefs.INTERVAL;
|
||||
return delay;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,14 +8,14 @@ object AuthPrefs {
|
|||
|
||||
@JvmStatic
|
||||
fun isTrustGooglePermitted(context: Context): Boolean {
|
||||
return SettingsContract.getSettings(context, Auth.CONTENT_URI, arrayOf(Auth.TRUST_GOOGLE)) { c ->
|
||||
return SettingsContract.getSettings(context, Auth.getContentUri(context), arrayOf(Auth.TRUST_GOOGLE)) { c ->
|
||||
c.getInt(0) != 0
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isAuthVisible(context: Context): Boolean {
|
||||
return SettingsContract.getSettings(context, Auth.CONTENT_URI, arrayOf(Auth.VISIBLE)) { c ->
|
||||
return SettingsContract.getSettings(context, Auth.getContentUri(context), arrayOf(Auth.VISIBLE)) { c ->
|
||||
c.getInt(0) != 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ object CheckinPrefs {
|
|||
@JvmStatic
|
||||
fun isEnabled(context: Context): Boolean {
|
||||
val projection = arrayOf(CheckIn.ENABLED)
|
||||
return SettingsContract.getSettings(context, CheckIn.CONTENT_URI, projection) { c ->
|
||||
return SettingsContract.getSettings(context, CheckIn.getContentUri(context), projection) { c ->
|
||||
c.getInt(0) != 0
|
||||
}
|
||||
}
|
||||
|
@ -22,21 +22,21 @@ object CheckinPrefs {
|
|||
@JvmStatic
|
||||
fun isSpoofingEnabled(context: Context): Boolean {
|
||||
val projection = arrayOf(CheckIn.BRAND_SPOOF)
|
||||
return SettingsContract.getSettings(context, CheckIn.CONTENT_URI, projection) { c ->
|
||||
return SettingsContract.getSettings(context, CheckIn.getContentUri(context), projection) { c ->
|
||||
c.getInt(0) != 0
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setSpoofingEnabled(context: Context, enabled: Boolean) {
|
||||
setSettings(context, CheckIn.CONTENT_URI) {
|
||||
setSettings(context, CheckIn.getContentUri(context)) {
|
||||
put(CheckIn.BRAND_SPOOF, enabled)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun hideLauncherIcon(context: Context, enabled: Boolean) {
|
||||
setSettings(context, CheckIn.CONTENT_URI) {
|
||||
setSettings(context, CheckIn.getContentUri(context)) {
|
||||
put(CheckIn.HIDE_LAUNCHER_ICON, enabled)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ data class LastCheckinInfo(
|
|||
CheckIn.VERSION_INFO,
|
||||
CheckIn.DEVICE_DATA_VERSION_INFO,
|
||||
)
|
||||
return SettingsContract.getSettings(context, CheckIn.CONTENT_URI, projection) { c ->
|
||||
return SettingsContract.getSettings(context, CheckIn.getContentUri(context), projection) { c ->
|
||||
LastCheckinInfo(
|
||||
androidId = c.getLong(0),
|
||||
digest = c.getString(1),
|
||||
|
@ -61,7 +61,7 @@ data class LastCheckinInfo(
|
|||
}
|
||||
|
||||
@JvmStatic
|
||||
fun clear(context: Context) = SettingsContract.setSettings(context, CheckIn.CONTENT_URI) {
|
||||
fun clear(context: Context) = SettingsContract.setSettings(context, CheckIn.getContentUri(context)) {
|
||||
put(CheckIn.ANDROID_ID, 0L)
|
||||
put(CheckIn.DIGEST, CheckIn.INITIAL_DIGEST)
|
||||
put(CheckIn.LAST_CHECK_IN, 0L)
|
||||
|
@ -71,7 +71,7 @@ data class LastCheckinInfo(
|
|||
}
|
||||
}
|
||||
|
||||
fun write(context: Context) = SettingsContract.setSettings(context, CheckIn.CONTENT_URI) {
|
||||
fun write(context: Context) = SettingsContract.setSettings(context, CheckIn.getContentUri(context)) {
|
||||
put(CheckIn.ANDROID_ID, androidId)
|
||||
put(CheckIn.DIGEST, digest)
|
||||
put(CheckIn.LAST_CHECK_IN, lastCheckin)
|
||||
|
|
|
@ -20,7 +20,7 @@ data class ServiceConfiguration(val enabled: Boolean) : Serializable
|
|||
|
||||
suspend fun getCheckinServiceInfo(context: Context): ServiceInfo = withContext(Dispatchers.IO) {
|
||||
val projection = arrayOf(CheckIn.ENABLED, CheckIn.LAST_CHECK_IN, CheckIn.ANDROID_ID)
|
||||
getSettings(context, CheckIn.CONTENT_URI, projection) { c ->
|
||||
getSettings(context, CheckIn.getContentUri(context), projection) { c ->
|
||||
ServiceInfo(
|
||||
configuration = ServiceConfiguration(c.getInt(0) != 0),
|
||||
lastCheckin = c.getLong(1),
|
||||
|
@ -33,7 +33,7 @@ suspend fun setCheckinServiceConfiguration(context: Context, configuration: Serv
|
|||
val serviceInfo = getCheckinServiceInfo(context)
|
||||
if (serviceInfo.configuration == configuration) return@withContext
|
||||
// enabled state is not already set, setting it now
|
||||
setSettings(context, CheckIn.CONTENT_URI) {
|
||||
setSettings(context, CheckIn.getContentUri(context)) {
|
||||
put(CheckIn.ENABLED, configuration.enabled)
|
||||
}
|
||||
if (configuration.enabled) {
|
||||
|
|
|
@ -34,11 +34,11 @@ data class GcmPrefs(
|
|||
const val PREF_NETWORK_ROAMING = Gcm.NETWORK_ROAMING
|
||||
const val PREF_NETWORK_OTHER = Gcm.NETWORK_OTHER
|
||||
|
||||
private const val INTERVAL = 1 * 60 * 1000 // 1 minute
|
||||
public const val INTERVAL = 1 * 60 * 1000 // 1 minute
|
||||
|
||||
@JvmStatic
|
||||
fun get(context: Context): GcmPrefs {
|
||||
return SettingsContract.getSettings(context, Gcm.CONTENT_URI, Gcm.PROJECTION) { c ->
|
||||
return SettingsContract.getSettings(context, Gcm.getContentUri(context), Gcm.PROJECTION) { c ->
|
||||
GcmPrefs(
|
||||
isGcmLogEnabled = c.getInt(0) != 0,
|
||||
lastPersistedId = c.getString(1),
|
||||
|
@ -56,7 +56,7 @@ data class GcmPrefs(
|
|||
|
||||
fun write(context: Context, config: ServiceConfiguration) {
|
||||
val gcmPrefs = get(context)
|
||||
setSettings(context, Gcm.CONTENT_URI) {
|
||||
setSettings(context, Gcm.getContentUri(context)) {
|
||||
put(Gcm.ENABLE_GCM, config.enabled)
|
||||
put(Gcm.NETWORK_MOBILE, config.mobile)
|
||||
put(Gcm.NETWORK_WIFI, config.wifi)
|
||||
|
@ -68,7 +68,7 @@ data class GcmPrefs(
|
|||
|
||||
@JvmStatic
|
||||
fun clearLastPersistedId(context: Context) {
|
||||
setSettings(context, Gcm.CONTENT_URI) {
|
||||
setSettings(context, Gcm.getContentUri(context)) {
|
||||
put(Gcm.LAST_PERSISTENT_ID, "")
|
||||
}
|
||||
}
|
||||
|
@ -104,26 +104,26 @@ data class GcmPrefs(
|
|||
|
||||
fun getHeartbeatMsFor(pref: String): Int {
|
||||
return if (PREF_NETWORK_ROAMING == pref) {
|
||||
if (networkRoaming != 0) networkRoaming * 60000 else learntMobileInterval
|
||||
if (networkRoaming != 0) networkRoaming * GcmPrefs.INTERVAL else learntMobileInterval
|
||||
} else if (PREF_NETWORK_MOBILE == pref) {
|
||||
if (networkMobile != 0) networkMobile * 60000 else learntMobileInterval
|
||||
if (networkMobile != 0) networkMobile * GcmPrefs.INTERVAL else learntMobileInterval
|
||||
} else if (PREF_NETWORK_WIFI == pref) {
|
||||
if (networkWifi != 0) networkWifi * 60000 else learntWifiInterval
|
||||
if (networkWifi != 0) networkWifi * GcmPrefs.INTERVAL else learntWifiInterval
|
||||
} else {
|
||||
if (networkOther != 0) networkOther * 60000 else learntOtherInterval
|
||||
if (networkOther != 0) networkOther * GcmPrefs.INTERVAL else learntOtherInterval
|
||||
}
|
||||
}
|
||||
|
||||
fun learnTimeout(context: Context, pref: String) {
|
||||
Log.d("GmsGcmPrefs", "learnTimeout: $pref")
|
||||
when (pref) {
|
||||
PREF_NETWORK_MOBILE, PREF_NETWORK_ROAMING -> setSettings(context, Gcm.CONTENT_URI) {
|
||||
PREF_NETWORK_MOBILE, PREF_NETWORK_ROAMING -> setSettings(context, Gcm.getContentUri(context)) {
|
||||
put(Gcm.LEARNT_MOBILE, (learntMobileInterval * 0.95).toInt())
|
||||
}
|
||||
PREF_NETWORK_WIFI -> setSettings(context, Gcm.CONTENT_URI) {
|
||||
PREF_NETWORK_WIFI -> setSettings(context, Gcm.getContentUri(context)) {
|
||||
put(Gcm.LEARNT_WIFI, (learntWifiInterval * 0.95).toInt())
|
||||
}
|
||||
else -> setSettings(context, Gcm.CONTENT_URI) {
|
||||
else -> setSettings(context, Gcm.getContentUri(context)) {
|
||||
put(Gcm.LEARNT_OTHER, (learntOtherInterval * 0.95).toInt())
|
||||
}
|
||||
}
|
||||
|
@ -134,21 +134,21 @@ data class GcmPrefs(
|
|||
when (pref) {
|
||||
PREF_NETWORK_MOBILE, PREF_NETWORK_ROAMING -> {
|
||||
if (time > learntMobileInterval / 4 * 3) {
|
||||
setSettings(context, Gcm.CONTENT_URI) {
|
||||
setSettings(context, Gcm.getContentUri(context)) {
|
||||
put(Gcm.LEARNT_MOBILE, INTERVAL)
|
||||
}
|
||||
}
|
||||
}
|
||||
PREF_NETWORK_WIFI -> {
|
||||
if (time > learntWifiInterval / 4 * 3) {
|
||||
setSettings(context, Gcm.CONTENT_URI) {
|
||||
setSettings(context, Gcm.getContentUri(context)) {
|
||||
put(Gcm.LEARNT_WIFI, INTERVAL)
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
if (time > learntOtherInterval / 4 * 3) {
|
||||
setSettings(context, Gcm.CONTENT_URI) {
|
||||
setSettings(context, Gcm.getContentUri(context)) {
|
||||
put(Gcm.LEARNT_OTHER, INTERVAL)
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ data class GcmPrefs(
|
|||
|
||||
fun extendLastPersistedId(context: Context, id: String) {
|
||||
val newId = if (lastPersistedId.isNullOrEmpty()) id else "$lastPersistedId|$id"
|
||||
setSettings(context, Gcm.CONTENT_URI) {
|
||||
setSettings(context, Gcm.getContentUri(context)) {
|
||||
put(Gcm.LAST_PERSISTENT_ID, newId)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ private suspend fun ensureAppRegistrationAllowed(context: Context, database: Gcm
|
|||
if (!GcmPrefs.get(context).isEnabled) throw RuntimeException("GCM disabled")
|
||||
val app = database.getApp(packageName)
|
||||
if (app?.allowRegister == false) {
|
||||
throw RuntimeException("Push permission not granted to app")
|
||||
throw RuntimeException("Push permission not granted to $packageName")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,13 +89,13 @@ class PushNotificationAdvancedFragment : PreferenceFragmentCompat() {
|
|||
private fun getSummaryString(value: Int, learnt: Int): String = when (value) {
|
||||
-1 -> getString(R.string.service_status_disabled_short)
|
||||
0 -> getString(R.string.service_status_enabled_short) + " / " + getString(R.string.gcm_status_pref_default) + ": " + getHeartbeatString(learnt)
|
||||
else -> getString(R.string.service_status_enabled_short) + " / " + getString(R.string.gcm_status_pref_manual) + ": " + getHeartbeatString(value * 60000)
|
||||
else -> getString(R.string.service_status_enabled_short) + " / " + getString(R.string.gcm_status_pref_manual) + ": " + getHeartbeatString(value * GcmPrefs.INTERVAL)
|
||||
}
|
||||
|
||||
private fun getHeartbeatString(heartbeatMs: Int): String {
|
||||
return if (heartbeatMs < 120000) {
|
||||
(heartbeatMs / 1000).toString() + " " + getString(R.string.gcm_status_pref_sec)
|
||||
} else (heartbeatMs / 60000).toString() + " " + getString(R.string.gcm_status_pref_min)
|
||||
} else (heartbeatMs / GcmPrefs.INTERVAL).toString() + " " + getString(R.string.gcm_status_pref_min)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.microg.gms.utils
|
||||
|
||||
import android.os.Binder
|
||||
import android.os.Parcel
|
||||
import android.util.Log
|
||||
|
||||
fun warnOnTransactionIssues(tag: String, code: Int, reply: Parcel?, flags: Int, base: () -> Boolean): Boolean {
|
||||
if (base.invoke()) {
|
||||
if ((flags and Binder.FLAG_ONEWAY) > 0 && (reply?.dataSize() ?: 0) > 0) {
|
||||
Log.w(tag, "onTransact[$code] is oneway, but returned data")
|
||||
}
|
||||
return true
|
||||
}
|
||||
Log.w(tag, "onTransact[$code] is not processed.")
|
||||
return (flags and Binder.FLAG_ONEWAY) > 0 // Don't return false on oneway transaction to suppress warning
|
||||
}
|
|
@ -7,13 +7,13 @@ import android.net.Uri
|
|||
import android.os.Binder
|
||||
|
||||
object SettingsContract {
|
||||
const val AUTHORITY = "org.microg.mgms.settings"
|
||||
val AUTHORITY_URI: Uri = Uri.parse("content://$AUTHORITY")
|
||||
fun getAuthority(context: Context) = "${context.packageName}.microg.settings"
|
||||
fun getAuthorityUri(context: Context): Uri = Uri.parse("content://${getAuthority(context)}")
|
||||
|
||||
object CheckIn {
|
||||
private const val id = "check-in"
|
||||
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, id)
|
||||
const val CONTENT_TYPE = "vnd.android.cursor.item/vnd.$AUTHORITY.$id"
|
||||
fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id)
|
||||
fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id"
|
||||
|
||||
const val ENABLED = "checkin_enable_service"
|
||||
const val ANDROID_ID = "androidId"
|
||||
|
@ -44,8 +44,8 @@ object SettingsContract {
|
|||
|
||||
object Gcm {
|
||||
private const val id = "gcm"
|
||||
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, id)
|
||||
const val CONTENT_TYPE = "vnd.android.cursor.item/vnd.$AUTHORITY.$id"
|
||||
fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id)
|
||||
fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id"
|
||||
|
||||
const val FULL_LOG = "gcm_full_log"
|
||||
const val LAST_PERSISTENT_ID = "gcm_last_persistent_id"
|
||||
|
@ -76,8 +76,8 @@ object SettingsContract {
|
|||
|
||||
object Auth {
|
||||
private const val id = "auth"
|
||||
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, id)
|
||||
const val CONTENT_TYPE = "vnd.android.cursor.item/vnd.$AUTHORITY.$id"
|
||||
fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id)
|
||||
fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id"
|
||||
|
||||
const val TRUST_GOOGLE = "auth_manager_trust_google"
|
||||
const val VISIBLE = "auth_manager_visible"
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package org.microg.mgms.settings
|
||||
|
||||
import android.content.ContentProvider
|
||||
|
@ -8,13 +14,13 @@ import android.content.SharedPreferences
|
|||
import android.database.Cursor
|
||||
import android.database.MatrixCursor
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import androidx.preference.PreferenceManager
|
||||
import android.preference.PreferenceManager
|
||||
import org.microg.gms.common.PackageUtils.warnIfNotMainProcess
|
||||
import org.microg.mgms.settings.SettingsContract.AUTHORITY
|
||||
import org.microg.gms.gcm.GcmPrefs
|
||||
import org.microg.mgms.settings.SettingsContract.Auth
|
||||
import org.microg.mgms.settings.SettingsContract.CheckIn
|
||||
import org.microg.mgms.settings.SettingsContract.Gcm
|
||||
import org.microg.mgms.settings.SettingsContract.getAuthority
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
|
@ -52,9 +58,9 @@ class SettingsProvider : ContentProvider() {
|
|||
selectionArgs: Array<out String>?,
|
||||
sortOrder: String?
|
||||
): Cursor? = when (uri) {
|
||||
CheckIn.CONTENT_URI -> queryCheckIn(projection ?: CheckIn.PROJECTION)
|
||||
Gcm.CONTENT_URI -> queryGcm(projection ?: Gcm.PROJECTION)
|
||||
Auth.CONTENT_URI -> queryAuth(projection ?: Auth.PROJECTION)
|
||||
CheckIn.getContentUri(context!!) -> queryCheckIn(projection ?: CheckIn.PROJECTION)
|
||||
Gcm.getContentUri(context!!) -> queryGcm(projection ?: Gcm.PROJECTION)
|
||||
Auth.getContentUri(context!!) -> queryAuth(projection ?: Auth.PROJECTION)
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
@ -67,9 +73,9 @@ class SettingsProvider : ContentProvider() {
|
|||
warnIfNotMainProcess(context, this.javaClass)
|
||||
if (values == null) return 0
|
||||
when (uri) {
|
||||
CheckIn.CONTENT_URI -> updateCheckIn(values)
|
||||
Gcm.CONTENT_URI -> updateGcm(values)
|
||||
Auth.CONTENT_URI -> updateAuth(values)
|
||||
CheckIn.getContentUri(context!!) -> updateCheckIn(values)
|
||||
Gcm.getContentUri(context!!) -> updateGcm(values)
|
||||
Auth.getContentUri(context!!) -> updateAuth(values)
|
||||
else -> return 0
|
||||
}
|
||||
return 1
|
||||
|
@ -100,8 +106,6 @@ class SettingsProvider : ContentProvider() {
|
|||
}
|
||||
val editor = checkInPrefs.edit()
|
||||
values.valueSet().forEach { (key, value) ->
|
||||
// TODO remove log
|
||||
Log.e("TEST", "check-in update: $key = $value")
|
||||
if (key == CheckIn.ENABLED) {
|
||||
// special case: not saved in checkInPrefs
|
||||
updateCheckInEnabled(value as Boolean)
|
||||
|
@ -156,9 +160,9 @@ class SettingsProvider : ContentProvider() {
|
|||
Gcm.NETWORK_ROAMING -> Integer.parseInt(preferences.getString(key, "0") ?: "0")
|
||||
Gcm.NETWORK_OTHER -> Integer.parseInt(preferences.getString(key, "0") ?: "0")
|
||||
|
||||
Gcm.LEARNT_MOBILE -> preferences.getInt(key, 60000)
|
||||
Gcm.LEARNT_WIFI -> preferences.getInt(key, 60000)
|
||||
Gcm.LEARNT_OTHER -> preferences.getInt(key, 60000)
|
||||
Gcm.LEARNT_MOBILE -> preferences.getInt(key, GcmPrefs.INTERVAL)
|
||||
Gcm.LEARNT_WIFI -> preferences.getInt(key, GcmPrefs.INTERVAL)
|
||||
Gcm.LEARNT_OTHER -> preferences.getInt(key, GcmPrefs.INTERVAL)
|
||||
|
||||
else -> throw IllegalArgumentException("Unknown key: $key")
|
||||
}
|
||||
|
@ -168,8 +172,6 @@ class SettingsProvider : ContentProvider() {
|
|||
if (values.size() == 0) return
|
||||
val editor = preferences.edit()
|
||||
values.valueSet().forEach { (key, value) ->
|
||||
// TODO remove log
|
||||
Log.e("TEST", "gcm update: $key = $value")
|
||||
when (key) {
|
||||
Gcm.ENABLE_GCM -> editor.putBoolean(key, value as Boolean)
|
||||
Gcm.FULL_LOG -> editor.putBoolean(key, value as Boolean)
|
||||
|
@ -203,8 +205,6 @@ class SettingsProvider : ContentProvider() {
|
|||
if (values.size() == 0) return
|
||||
val editor = preferences.edit()
|
||||
values.valueSet().forEach { (key, value) ->
|
||||
// TODO remove log
|
||||
Log.e("TEST", "auth update: $key = $value")
|
||||
when (key) {
|
||||
Auth.TRUST_GOOGLE -> editor.putBoolean(key, value as Boolean)
|
||||
Auth.VISIBLE -> editor.putBoolean(key, value as Boolean)
|
||||
|
@ -219,15 +219,12 @@ class SettingsProvider : ContentProvider() {
|
|||
valueGetter: (String) -> Any
|
||||
): MatrixCursor {
|
||||
val row = newRow()
|
||||
for (key in p) row.add(valueGetter.invoke(key).apply {
|
||||
// TODO remove log
|
||||
Log.e("TEST", "$key = $this")
|
||||
})
|
||||
for (key in p) row.add(valueGetter.invoke(key))
|
||||
return this
|
||||
}
|
||||
|
||||
override fun getType(uri: Uri): String {
|
||||
return "vnd.android.cursor.item/vnd.$AUTHORITY.${uri.path}"
|
||||
return "vnd.android.cursor.item/vnd.${getAuthority(context!!)}.${uri.path}"
|
||||
}
|
||||
|
||||
override fun insert(uri: Uri, values: ContentValues?): Uri? {
|
||||
|
|
|
@ -3,5 +3,5 @@ package com.google.android.gms.location.internal;
|
|||
import com.google.android.gms.location.internal.FusedLocationProviderResult;
|
||||
|
||||
interface IFusedLocationProviderCallback {
|
||||
void onFusedLocationProviderResult(in FusedLocationProviderResult result) = 0;
|
||||
oneway void onFusedLocationProviderResult(in FusedLocationProviderResult result) = 0;
|
||||
}
|
||||
|
|
|
@ -30,25 +30,25 @@ public class LocationRequestUpdateData extends AutoSafeParcelable {
|
|||
public static final int REQUEST_UPDATES = 1;
|
||||
public static final int REMOVE_UPDATES = 2;
|
||||
|
||||
@SafeParceled(1000)
|
||||
@Field(1000)
|
||||
private int versionCode;
|
||||
|
||||
@SafeParceled(1)
|
||||
@Field(1)
|
||||
public int opCode;
|
||||
|
||||
@SafeParceled(2)
|
||||
@Field(2)
|
||||
public LocationRequestInternal request;
|
||||
|
||||
@SafeParceled(3)
|
||||
@Field(3)
|
||||
public ILocationListener listener;
|
||||
|
||||
@SafeParceled(4)
|
||||
@Field(4)
|
||||
public PendingIntent pendingIntent;
|
||||
|
||||
@SafeParceled(5)
|
||||
@Field(5)
|
||||
public ILocationCallback callback;
|
||||
|
||||
@SafeParceled(6)
|
||||
@Field(6)
|
||||
public IFusedLocationProviderCallback fusedLocationProviderCallback;
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue