0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-27 05:33:00 +00:00

MicroG 0.2.22.212658

This commit is contained in:
GoldenRetro 2021-09-11 09:36:50 +02:00
parent 020b789fe8
commit da6399b18c
29 changed files with 205 additions and 171 deletions

View file

@ -16,7 +16,7 @@ jobs:
- name: JDK 8 Setup - name: JDK 8 Setup
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 1.8 java-version: 11.0.8
- name: Install NDK - name: Install NDK
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.0.6113669" run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.0.6113669"

View file

@ -36,7 +36,7 @@ buildscript {
} }
dependencies { 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 "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.squareup.wire:wire-gradle-plugin:$wireVersion" classpath "com.squareup.wire:wire-gradle-plugin:$wireVersion"
} }
@ -46,8 +46,8 @@ allprojects {
apply plugin: 'idea' apply plugin: 'idea'
group = 'org.microg.gms' group = 'org.microg.gms'
version = "0.2.21.212417" version = "0.2.22.212658"
ext.appVersionCode = 212417001 ext.appVersionCode = 212658001
ext.isReleaseVersion = false ext.isReleaseVersion = false
} }

View file

@ -1,6 +1,6 @@
#Sat Jul 03 09:49:43 CEST 2021 #Sat Sep 11 09:04:01 CEST 2021
distributionBase=GRADLE_USER_HOME 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 distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View file

@ -3,5 +3,5 @@ package com.google.android.gms.clearcut.internal;
import com.google.android.gms.common.api.Status; import com.google.android.gms.common.api.Status;
interface IClearcutLoggerCallbacks { interface IClearcutLoggerCallbacks {
void onStatus(in Status status) = 0; oneway void onStatus(in Status status) = 0;
} }

View file

@ -4,6 +4,6 @@ import com.google.android.gms.common.api.Status;
import com.mgoogle.android.gms.phenotype.Configurations; import com.mgoogle.android.gms.phenotype.Configurations;
interface IPhenotypeCallbacks { interface IPhenotypeCallbacks {
void onRegister(in Status status) = 0; oneway void onRegister(in Status status) = 0;
void onConfigurations(in Status status, in Configurations configurations) = 3; oneway void onConfigurations(in Status status, in Configurations configurations) = 3;
} }

View file

@ -18,6 +18,8 @@ package com.google.android.gms.clearcut;
import android.util.Base64; 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 com.google.android.gms.playlog.internal.PlayLoggerContext;
import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.AutoSafeParcelable;
@ -30,30 +32,36 @@ import java.nio.charset.StandardCharsets;
import java.util.Arrays; import java.util.Arrays;
public class LogEventParcelable extends AutoSafeParcelable { public class LogEventParcelable extends AutoSafeParcelable {
@SafeParceled(1) @Field(1)
private int versionCode = 1; private int versionCode = 1;
@SafeParceled(2) @Field(2)
public final PlayLoggerContext context; public final PlayLoggerContext context;
@SafeParceled(3) @Field(3)
public final byte[] bytes; public final byte[] bytes;
@SafeParceled(4) @Field(4)
public final int[] testCodes; public final int[] testCodes;
@SafeParceled(5) @Field(5)
public final String[] mendelPackages; public final String[] mendelPackages;
@SafeParceled(6) @Field(6)
public final int[] experimentIds; public final int[] experimentIds;
@SafeParceled(7) @Field(7)
public final byte[][] experimentTokens; public final byte[][] experimentTokens;
@SafeParceled(8) @Field(8)
public final boolean addPhenotypeExperimentTokens; public final boolean addPhenotypeExperimentTokens;
@Field(9)
public final ExperimentToken[] experimentTokenParcelables;
@Field(10)
public final GenericDimension[] genericDimensions;
private LogEventParcelable() { private LogEventParcelable() {
context = null; context = null;
bytes = null; bytes = null;
@ -61,6 +69,8 @@ public class LogEventParcelable extends AutoSafeParcelable {
mendelPackages = null; mendelPackages = null;
experimentTokens = null; experimentTokens = null;
addPhenotypeExperimentTokens = false; addPhenotypeExperimentTokens = false;
experimentTokenParcelables = null;
genericDimensions = null;
} }
public LogEventParcelable(PlayLoggerContext context, byte[] bytes, int[] testCodes, String[] mendelPackages, int[] experimentIds, byte[][] experimentTokens, boolean addPhenotypeExperimentTokens) { 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.experimentIds = experimentIds;
this.experimentTokens = experimentTokens; this.experimentTokens = experimentTokens;
this.addPhenotypeExperimentTokens = addPhenotypeExperimentTokens; this.addPhenotypeExperimentTokens = addPhenotypeExperimentTokens;
experimentTokenParcelables = null;
genericDimensions = null;
} }
@Override @Override

View file

@ -21,55 +21,49 @@ import org.microg.safeparcel.SafeParceled;
public class PlayLoggerContext extends AutoSafeParcelable { public class PlayLoggerContext extends AutoSafeParcelable {
@SafeParceled(1) @Field(1)
private int versionCode = 1; private int versionCode = 1;
@SafeParceled(2) @Field(2)
public final String packageName; public final String packageName;
@SafeParceled(3) @Field(3)
public final int packageVersionCode; public final int packageVersionCode;
@SafeParceled(4) @Field(4)
public final int logSource; public final int logSource;
@SafeParceled(5) @Field(8)
public final String uploadAccount;
@SafeParceled(6)
public final int loggingId;
@SafeParceled(7)
public final boolean logAndroidId;
@SafeParceled(8)
public final String logSourceName; 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; public final boolean isAnonymous;
@SafeParceled(10) @Field(10)
public final int qosTier; public final int qosTier;
@Field(11)
public final Integer appMobileSpecId;
@Field(12)
public final boolean scrubMccMnc;
private PlayLoggerContext() { private PlayLoggerContext() {
packageName = uploadAccount = logSourceName = null; packageName = uploadAccount = logSourceName = loggingId = null;
qosTier = packageVersionCode = logSource = loggingId = -1; qosTier = packageVersionCode = logSource = appMobileSpecId = -1;
isAnonymous = logAndroidId = false; isAnonymous = logAndroidId = scrubMccMnc = false;
} }
public PlayLoggerContext(String packageName, int packageVersionCode, int logSource, String uploadAccount, int loggingId, boolean logAndroidId) { 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;
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) {
this.packageName = packageName; this.packageName = packageName;
this.packageVersionCode = packageVersionCode; this.packageVersionCode = packageVersionCode;
this.logSource = logSource; this.logSource = logSource;
@ -79,22 +73,25 @@ public class PlayLoggerContext extends AutoSafeParcelable {
this.logAndroidId = !isAnonymous; this.logAndroidId = !isAnonymous;
this.isAnonymous = isAnonymous; this.isAnonymous = isAnonymous;
this.qosTier = qosTier; this.qosTier = qosTier;
this.appMobileSpecId = null;
this.scrubMccMnc = scrubMccMnc;
} }
@Override @Override
public String toString() { public String toString() {
return "PlayLoggerContext[" + versionCode + final StringBuilder sb = new StringBuilder("PlayLoggerContext[").append(versionCode);
", package=" + packageName + sb.append(", package=").append(packageName);
", packageVersionCode=" + packageVersionCode + sb.append(", packageVersionCode=").append(packageVersionCode);
", logSource=" + logSource + sb.append(", logSource=").append(logSource);
", uploadAccount=" + uploadAccount + sb.append(", uploadAccount=").append(uploadAccount);
", loggingId=" + loggingId + sb.append(", loggingId=").append(loggingId);
", logAndroidId=" + logAndroidId + sb.append(", logAndroidId=").append(logAndroidId);
", logSourceName=" + logSourceName + sb.append(", logSourceName=").append(logSourceName);
", isAnonymous=" + isAnonymous + sb.append(", isAnonymous=").append(isAnonymous);
", qosTier=" + qosTier + 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);
} }

View file

@ -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);
}

View file

@ -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);
}

View file

@ -39,6 +39,6 @@ dependencies {
api project(':play-services-tasks') api project(':play-services-tasks')
api project(':play-services-base-api') 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' implementation 'com.google.android.gms:play-services-base:17.6.0'
} }

View file

@ -4,11 +4,11 @@ import com.google.android.gms.cast.LaunchOptions;
import com.google.android.gms.cast.JoinOptions; import com.google.android.gms.cast.JoinOptions;
interface ICastDeviceController { interface ICastDeviceController {
void disconnect() = 0; oneway void disconnect() = 0;
void stopApplication(String sessionId) = 4; oneway void stopApplication(String sessionId) = 4;
void sendMessage(String namespace, String message, long requestId) = 8; oneway void sendMessage(String namespace, String message, long requestId) = 8;
void registerNamespace(String namespace) = 10; oneway void registerNamespace(String namespace) = 10;
void unregisterNamespace(String namespace) = 11; oneway void unregisterNamespace(String namespace) = 11;
void launchApplication(String applicationId, in LaunchOptions launchOptions) = 12; oneway void launchApplication(String applicationId, in LaunchOptions launchOptions) = 12;
void joinApplication(String applicationId, String sessionId, in JoinOptions joinOptions) = 13; oneway void joinApplication(String applicationId, String sessionId, in JoinOptions joinOptions) = 13;
} }

View file

@ -21,9 +21,6 @@ apply plugin: 'kotlin-kapt'
dependencies { dependencies {
implementation 'com.squareup.wire:wire-runtime:3.6.1' implementation 'com.squareup.wire:wire-runtime:3.6.1'
implementation 'de.hdodenhof:circleimageview:3.1.0' 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 "info.armills.chromecast-java-api-v2:api-v2-raw-request:0.10.4-raw-request-1"
implementation project(':play-services-cronet-core') implementation project(':play-services-cronet-core')
@ -33,8 +30,8 @@ dependencies {
implementation project(':play-services-cast-api') implementation project(':play-services-cast-api')
// AndroidX UI // AndroidX UI
implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.mediarouter:mediarouter:1.2.4' implementation 'androidx.mediarouter:mediarouter:1.2.5'
implementation "androidx.preference:preference-ktx:$preferenceVersion" implementation "androidx.preference:preference-ktx:$preferenceVersion"
implementation "org.microg.gms:conscrypt-gmscore:2.5.1" implementation "org.microg.gms:conscrypt-gmscore:2.5.1"

View file

@ -38,7 +38,7 @@ android {
} }
dependencies { dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'androidx.appcompat:appcompat:1.3.1'
implementation "androidx.preference:preference:$preferenceVersion" implementation "androidx.preference:preference:$preferenceVersion"
} }

View file

@ -91,13 +91,6 @@
android:name="fake-signature" android:name="fake-signature"
android:value="@string/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 --> <!-- Services Framework -->
<provider <provider
@ -478,6 +471,7 @@
<action android:name="com.google.android.gms.herrevad.services.LightweightNetworkQualityAndroidService.START" /> <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.gass.START" />
<action android:name="com.google.android.gms.audit.service.START" /> <action android:name="com.google.android.gms.audit.service.START" />
<action android:name="com.google.android.mobstore.service.START" />
</intent-filter> </intent-filter>
</service> </service>
</application> </application>

View file

@ -29,7 +29,10 @@ public class ClearcutLoggerServiceImpl extends IClearcutLoggerService.Stub {
@Override @Override
public void log(IClearcutLoggerCallbacks callbacks, LogEventParcelable event) throws RemoteException { public void log(IClearcutLoggerCallbacks callbacks, LogEventParcelable event) throws RemoteException {
Log.d(TAG, "log: " + event); // These logs are not really helpful for us, so let's just ignore it.
try {
callbacks.onStatus(Status.SUCCESS); callbacks.onStatus(Status.SUCCESS);
} catch (Exception ignored) {
}
} }
} }

View file

@ -50,23 +50,7 @@ public class PackageUtils {
static { static {
KNOWN_GOOGLE_PACKAGES = new HashMap<>(); 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.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) { public static boolean isGooglePackage(Context context, String packageName) {

View file

@ -293,8 +293,8 @@ public class McsService extends Service implements Handler.Callback {
public synchronized static long getCurrentDelay() { public synchronized static long getCurrentDelay() {
long delay = currentDelay == 0 ? 5000 : currentDelay; long delay = currentDelay == 0 ? 5000 : currentDelay;
if (currentDelay < 60000) currentDelay += 10000; if (currentDelay < GcmPrefs.INTERVAL) currentDelay += 10000;
if (currentDelay >= 60000 && currentDelay < 600000) currentDelay += 60000; if (currentDelay >= GcmPrefs.INTERVAL && currentDelay < 600000) currentDelay += GcmPrefs.INTERVAL;
return delay; return delay;
} }

View file

@ -8,14 +8,14 @@ object AuthPrefs {
@JvmStatic @JvmStatic
fun isTrustGooglePermitted(context: Context): Boolean { 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 c.getInt(0) != 0
} }
} }
@JvmStatic @JvmStatic
fun isAuthVisible(context: Context): Boolean { 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 c.getInt(0) != 0
} }
} }

View file

@ -14,7 +14,7 @@ object CheckinPrefs {
@JvmStatic @JvmStatic
fun isEnabled(context: Context): Boolean { fun isEnabled(context: Context): Boolean {
val projection = arrayOf(CheckIn.ENABLED) 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 c.getInt(0) != 0
} }
} }
@ -22,21 +22,21 @@ object CheckinPrefs {
@JvmStatic @JvmStatic
fun isSpoofingEnabled(context: Context): Boolean { fun isSpoofingEnabled(context: Context): Boolean {
val projection = arrayOf(CheckIn.BRAND_SPOOF) 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 c.getInt(0) != 0
} }
} }
@JvmStatic @JvmStatic
fun setSpoofingEnabled(context: Context, enabled: Boolean) { fun setSpoofingEnabled(context: Context, enabled: Boolean) {
setSettings(context, CheckIn.CONTENT_URI) { setSettings(context, CheckIn.getContentUri(context)) {
put(CheckIn.BRAND_SPOOF, enabled) put(CheckIn.BRAND_SPOOF, enabled)
} }
} }
@JvmStatic @JvmStatic
fun hideLauncherIcon(context: Context, enabled: Boolean) { fun hideLauncherIcon(context: Context, enabled: Boolean) {
setSettings(context, CheckIn.CONTENT_URI) { setSettings(context, CheckIn.getContentUri(context)) {
put(CheckIn.HIDE_LAUNCHER_ICON, enabled) put(CheckIn.HIDE_LAUNCHER_ICON, enabled)
} }
} }

View file

@ -48,7 +48,7 @@ data class LastCheckinInfo(
CheckIn.VERSION_INFO, CheckIn.VERSION_INFO,
CheckIn.DEVICE_DATA_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( LastCheckinInfo(
androidId = c.getLong(0), androidId = c.getLong(0),
digest = c.getString(1), digest = c.getString(1),
@ -61,7 +61,7 @@ data class LastCheckinInfo(
} }
@JvmStatic @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.ANDROID_ID, 0L)
put(CheckIn.DIGEST, CheckIn.INITIAL_DIGEST) put(CheckIn.DIGEST, CheckIn.INITIAL_DIGEST)
put(CheckIn.LAST_CHECK_IN, 0L) 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.ANDROID_ID, androidId)
put(CheckIn.DIGEST, digest) put(CheckIn.DIGEST, digest)
put(CheckIn.LAST_CHECK_IN, lastCheckin) put(CheckIn.LAST_CHECK_IN, lastCheckin)

View file

@ -20,7 +20,7 @@ data class ServiceConfiguration(val enabled: Boolean) : Serializable
suspend fun getCheckinServiceInfo(context: Context): ServiceInfo = withContext(Dispatchers.IO) { suspend fun getCheckinServiceInfo(context: Context): ServiceInfo = withContext(Dispatchers.IO) {
val projection = arrayOf(CheckIn.ENABLED, CheckIn.LAST_CHECK_IN, CheckIn.ANDROID_ID) 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( ServiceInfo(
configuration = ServiceConfiguration(c.getInt(0) != 0), configuration = ServiceConfiguration(c.getInt(0) != 0),
lastCheckin = c.getLong(1), lastCheckin = c.getLong(1),
@ -33,7 +33,7 @@ suspend fun setCheckinServiceConfiguration(context: Context, configuration: Serv
val serviceInfo = getCheckinServiceInfo(context) val serviceInfo = getCheckinServiceInfo(context)
if (serviceInfo.configuration == configuration) return@withContext if (serviceInfo.configuration == configuration) return@withContext
// enabled state is not already set, setting it now // enabled state is not already set, setting it now
setSettings(context, CheckIn.CONTENT_URI) { setSettings(context, CheckIn.getContentUri(context)) {
put(CheckIn.ENABLED, configuration.enabled) put(CheckIn.ENABLED, configuration.enabled)
} }
if (configuration.enabled) { if (configuration.enabled) {

View file

@ -34,11 +34,11 @@ data class GcmPrefs(
const val PREF_NETWORK_ROAMING = Gcm.NETWORK_ROAMING const val PREF_NETWORK_ROAMING = Gcm.NETWORK_ROAMING
const val PREF_NETWORK_OTHER = Gcm.NETWORK_OTHER 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 @JvmStatic
fun get(context: Context): GcmPrefs { 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( GcmPrefs(
isGcmLogEnabled = c.getInt(0) != 0, isGcmLogEnabled = c.getInt(0) != 0,
lastPersistedId = c.getString(1), lastPersistedId = c.getString(1),
@ -56,7 +56,7 @@ data class GcmPrefs(
fun write(context: Context, config: ServiceConfiguration) { fun write(context: Context, config: ServiceConfiguration) {
val gcmPrefs = get(context) val gcmPrefs = get(context)
setSettings(context, Gcm.CONTENT_URI) { setSettings(context, Gcm.getContentUri(context)) {
put(Gcm.ENABLE_GCM, config.enabled) put(Gcm.ENABLE_GCM, config.enabled)
put(Gcm.NETWORK_MOBILE, config.mobile) put(Gcm.NETWORK_MOBILE, config.mobile)
put(Gcm.NETWORK_WIFI, config.wifi) put(Gcm.NETWORK_WIFI, config.wifi)
@ -68,7 +68,7 @@ data class GcmPrefs(
@JvmStatic @JvmStatic
fun clearLastPersistedId(context: Context) { fun clearLastPersistedId(context: Context) {
setSettings(context, Gcm.CONTENT_URI) { setSettings(context, Gcm.getContentUri(context)) {
put(Gcm.LAST_PERSISTENT_ID, "") put(Gcm.LAST_PERSISTENT_ID, "")
} }
} }
@ -104,26 +104,26 @@ data class GcmPrefs(
fun getHeartbeatMsFor(pref: String): Int { fun getHeartbeatMsFor(pref: String): Int {
return if (PREF_NETWORK_ROAMING == pref) { 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) { } 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) { } else if (PREF_NETWORK_WIFI == pref) {
if (networkWifi != 0) networkWifi * 60000 else learntWifiInterval if (networkWifi != 0) networkWifi * GcmPrefs.INTERVAL else learntWifiInterval
} else { } else {
if (networkOther != 0) networkOther * 60000 else learntOtherInterval if (networkOther != 0) networkOther * GcmPrefs.INTERVAL else learntOtherInterval
} }
} }
fun learnTimeout(context: Context, pref: String) { fun learnTimeout(context: Context, pref: String) {
Log.d("GmsGcmPrefs", "learnTimeout: $pref") Log.d("GmsGcmPrefs", "learnTimeout: $pref")
when (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()) 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()) 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()) put(Gcm.LEARNT_OTHER, (learntOtherInterval * 0.95).toInt())
} }
} }
@ -134,21 +134,21 @@ data class GcmPrefs(
when (pref) { when (pref) {
PREF_NETWORK_MOBILE, PREF_NETWORK_ROAMING -> { PREF_NETWORK_MOBILE, PREF_NETWORK_ROAMING -> {
if (time > learntMobileInterval / 4 * 3) { if (time > learntMobileInterval / 4 * 3) {
setSettings(context, Gcm.CONTENT_URI) { setSettings(context, Gcm.getContentUri(context)) {
put(Gcm.LEARNT_MOBILE, INTERVAL) put(Gcm.LEARNT_MOBILE, INTERVAL)
} }
} }
} }
PREF_NETWORK_WIFI -> { PREF_NETWORK_WIFI -> {
if (time > learntWifiInterval / 4 * 3) { if (time > learntWifiInterval / 4 * 3) {
setSettings(context, Gcm.CONTENT_URI) { setSettings(context, Gcm.getContentUri(context)) {
put(Gcm.LEARNT_WIFI, INTERVAL) put(Gcm.LEARNT_WIFI, INTERVAL)
} }
} }
} }
else -> { else -> {
if (time > learntOtherInterval / 4 * 3) { if (time > learntOtherInterval / 4 * 3) {
setSettings(context, Gcm.CONTENT_URI) { setSettings(context, Gcm.getContentUri(context)) {
put(Gcm.LEARNT_OTHER, INTERVAL) put(Gcm.LEARNT_OTHER, INTERVAL)
} }
} }
@ -163,7 +163,7 @@ data class GcmPrefs(
fun extendLastPersistedId(context: Context, id: String) { fun extendLastPersistedId(context: Context, id: String) {
val newId = if (lastPersistedId.isNullOrEmpty()) id else "$lastPersistedId|$id" 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) put(Gcm.LAST_PERSISTENT_ID, newId)
} }
} }

View file

@ -57,7 +57,7 @@ private suspend fun ensureAppRegistrationAllowed(context: Context, database: Gcm
if (!GcmPrefs.get(context).isEnabled) throw RuntimeException("GCM disabled") if (!GcmPrefs.get(context).isEnabled) throw RuntimeException("GCM disabled")
val app = database.getApp(packageName) val app = database.getApp(packageName)
if (app?.allowRegister == false) { if (app?.allowRegister == false) {
throw RuntimeException("Push permission not granted to app") throw RuntimeException("Push permission not granted to $packageName")
} }
} }

View file

@ -89,13 +89,13 @@ class PushNotificationAdvancedFragment : PreferenceFragmentCompat() {
private fun getSummaryString(value: Int, learnt: Int): String = when (value) { private fun getSummaryString(value: Int, learnt: Int): String = when (value) {
-1 -> getString(R.string.service_status_disabled_short) -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) 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 { private fun getHeartbeatString(heartbeatMs: Int): String {
return if (heartbeatMs < 120000) { return if (heartbeatMs < 120000) {
(heartbeatMs / 1000).toString() + " " + getString(R.string.gcm_status_pref_sec) (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 { companion object {

View file

@ -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
}

View file

@ -7,13 +7,13 @@ import android.net.Uri
import android.os.Binder import android.os.Binder
object SettingsContract { object SettingsContract {
const val AUTHORITY = "org.microg.mgms.settings" fun getAuthority(context: Context) = "${context.packageName}.microg.settings"
val AUTHORITY_URI: Uri = Uri.parse("content://$AUTHORITY") fun getAuthorityUri(context: Context): Uri = Uri.parse("content://${getAuthority(context)}")
object CheckIn { object CheckIn {
private const val id = "check-in" private const val id = "check-in"
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, id) fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id)
const val CONTENT_TYPE = "vnd.android.cursor.item/vnd.$AUTHORITY.$id" fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id"
const val ENABLED = "checkin_enable_service" const val ENABLED = "checkin_enable_service"
const val ANDROID_ID = "androidId" const val ANDROID_ID = "androidId"
@ -44,8 +44,8 @@ object SettingsContract {
object Gcm { object Gcm {
private const val id = "gcm" private const val id = "gcm"
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, id) fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id)
const val CONTENT_TYPE = "vnd.android.cursor.item/vnd.$AUTHORITY.$id" fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id"
const val FULL_LOG = "gcm_full_log" const val FULL_LOG = "gcm_full_log"
const val LAST_PERSISTENT_ID = "gcm_last_persistent_id" const val LAST_PERSISTENT_ID = "gcm_last_persistent_id"
@ -76,8 +76,8 @@ object SettingsContract {
object Auth { object Auth {
private const val id = "auth" private const val id = "auth"
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, id) fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id)
const val CONTENT_TYPE = "vnd.android.cursor.item/vnd.$AUTHORITY.$id" fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id"
const val TRUST_GOOGLE = "auth_manager_trust_google" const val TRUST_GOOGLE = "auth_manager_trust_google"
const val VISIBLE = "auth_manager_visible" const val VISIBLE = "auth_manager_visible"

View file

@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
@file:Suppress("DEPRECATION")
package org.microg.mgms.settings package org.microg.mgms.settings
import android.content.ContentProvider import android.content.ContentProvider
@ -8,13 +14,13 @@ import android.content.SharedPreferences
import android.database.Cursor import android.database.Cursor
import android.database.MatrixCursor import android.database.MatrixCursor
import android.net.Uri import android.net.Uri
import android.util.Log import android.preference.PreferenceManager
import androidx.preference.PreferenceManager
import org.microg.gms.common.PackageUtils.warnIfNotMainProcess 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.Auth
import org.microg.mgms.settings.SettingsContract.CheckIn import org.microg.mgms.settings.SettingsContract.CheckIn
import org.microg.mgms.settings.SettingsContract.Gcm import org.microg.mgms.settings.SettingsContract.Gcm
import org.microg.mgms.settings.SettingsContract.getAuthority
import java.io.File import java.io.File
/** /**
@ -52,9 +58,9 @@ class SettingsProvider : ContentProvider() {
selectionArgs: Array<out String>?, selectionArgs: Array<out String>?,
sortOrder: String? sortOrder: String?
): Cursor? = when (uri) { ): Cursor? = when (uri) {
CheckIn.CONTENT_URI -> queryCheckIn(projection ?: CheckIn.PROJECTION) CheckIn.getContentUri(context!!) -> queryCheckIn(projection ?: CheckIn.PROJECTION)
Gcm.CONTENT_URI -> queryGcm(projection ?: Gcm.PROJECTION) Gcm.getContentUri(context!!) -> queryGcm(projection ?: Gcm.PROJECTION)
Auth.CONTENT_URI -> queryAuth(projection ?: Auth.PROJECTION) Auth.getContentUri(context!!) -> queryAuth(projection ?: Auth.PROJECTION)
else -> null else -> null
} }
@ -67,9 +73,9 @@ class SettingsProvider : ContentProvider() {
warnIfNotMainProcess(context, this.javaClass) warnIfNotMainProcess(context, this.javaClass)
if (values == null) return 0 if (values == null) return 0
when (uri) { when (uri) {
CheckIn.CONTENT_URI -> updateCheckIn(values) CheckIn.getContentUri(context!!) -> updateCheckIn(values)
Gcm.CONTENT_URI -> updateGcm(values) Gcm.getContentUri(context!!) -> updateGcm(values)
Auth.CONTENT_URI -> updateAuth(values) Auth.getContentUri(context!!) -> updateAuth(values)
else -> return 0 else -> return 0
} }
return 1 return 1
@ -100,8 +106,6 @@ class SettingsProvider : ContentProvider() {
} }
val editor = checkInPrefs.edit() val editor = checkInPrefs.edit()
values.valueSet().forEach { (key, value) -> values.valueSet().forEach { (key, value) ->
// TODO remove log
Log.e("TEST", "check-in update: $key = $value")
if (key == CheckIn.ENABLED) { if (key == CheckIn.ENABLED) {
// special case: not saved in checkInPrefs // special case: not saved in checkInPrefs
updateCheckInEnabled(value as Boolean) updateCheckInEnabled(value as Boolean)
@ -156,9 +160,9 @@ class SettingsProvider : ContentProvider() {
Gcm.NETWORK_ROAMING -> Integer.parseInt(preferences.getString(key, "0") ?: "0") Gcm.NETWORK_ROAMING -> Integer.parseInt(preferences.getString(key, "0") ?: "0")
Gcm.NETWORK_OTHER -> 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_MOBILE -> preferences.getInt(key, GcmPrefs.INTERVAL)
Gcm.LEARNT_WIFI -> preferences.getInt(key, 60000) Gcm.LEARNT_WIFI -> preferences.getInt(key, GcmPrefs.INTERVAL)
Gcm.LEARNT_OTHER -> preferences.getInt(key, 60000) Gcm.LEARNT_OTHER -> preferences.getInt(key, GcmPrefs.INTERVAL)
else -> throw IllegalArgumentException("Unknown key: $key") else -> throw IllegalArgumentException("Unknown key: $key")
} }
@ -168,8 +172,6 @@ class SettingsProvider : ContentProvider() {
if (values.size() == 0) return if (values.size() == 0) return
val editor = preferences.edit() val editor = preferences.edit()
values.valueSet().forEach { (key, value) -> values.valueSet().forEach { (key, value) ->
// TODO remove log
Log.e("TEST", "gcm update: $key = $value")
when (key) { when (key) {
Gcm.ENABLE_GCM -> editor.putBoolean(key, value as Boolean) Gcm.ENABLE_GCM -> editor.putBoolean(key, value as Boolean)
Gcm.FULL_LOG -> 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 if (values.size() == 0) return
val editor = preferences.edit() val editor = preferences.edit()
values.valueSet().forEach { (key, value) -> values.valueSet().forEach { (key, value) ->
// TODO remove log
Log.e("TEST", "auth update: $key = $value")
when (key) { when (key) {
Auth.TRUST_GOOGLE -> editor.putBoolean(key, value as Boolean) Auth.TRUST_GOOGLE -> editor.putBoolean(key, value as Boolean)
Auth.VISIBLE -> editor.putBoolean(key, value as Boolean) Auth.VISIBLE -> editor.putBoolean(key, value as Boolean)
@ -219,15 +219,12 @@ class SettingsProvider : ContentProvider() {
valueGetter: (String) -> Any valueGetter: (String) -> Any
): MatrixCursor { ): MatrixCursor {
val row = newRow() val row = newRow()
for (key in p) row.add(valueGetter.invoke(key).apply { for (key in p) row.add(valueGetter.invoke(key))
// TODO remove log
Log.e("TEST", "$key = $this")
})
return this return this
} }
override fun getType(uri: Uri): String { 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? { override fun insert(uri: Uri, values: ContentValues?): Uri? {

View file

@ -3,5 +3,5 @@ package com.google.android.gms.location.internal;
import com.google.android.gms.location.internal.FusedLocationProviderResult; import com.google.android.gms.location.internal.FusedLocationProviderResult;
interface IFusedLocationProviderCallback { interface IFusedLocationProviderCallback {
void onFusedLocationProviderResult(in FusedLocationProviderResult result) = 0; oneway void onFusedLocationProviderResult(in FusedLocationProviderResult result) = 0;
} }

View file

@ -30,25 +30,25 @@ public class LocationRequestUpdateData extends AutoSafeParcelable {
public static final int REQUEST_UPDATES = 1; public static final int REQUEST_UPDATES = 1;
public static final int REMOVE_UPDATES = 2; public static final int REMOVE_UPDATES = 2;
@SafeParceled(1000) @Field(1000)
private int versionCode; private int versionCode;
@SafeParceled(1) @Field(1)
public int opCode; public int opCode;
@SafeParceled(2) @Field(2)
public LocationRequestInternal request; public LocationRequestInternal request;
@SafeParceled(3) @Field(3)
public ILocationListener listener; public ILocationListener listener;
@SafeParceled(4) @Field(4)
public PendingIntent pendingIntent; public PendingIntent pendingIntent;
@SafeParceled(5) @Field(5)
public ILocationCallback callback; public ILocationCallback callback;
@SafeParceled(6) @Field(6)
public IFusedLocationProviderCallback fusedLocationProviderCallback; public IFusedLocationProviderCallback fusedLocationProviderCallback;
@Override @Override