Revert "Add default preferences for Huawei devices"

This reverts commit 4376d011ad.
This commit is contained in:
Oizaro 2020-09-17 12:21:04 +02:00
parent 77d0d332b3
commit 16d499cb2a
3 changed files with 8 additions and 24 deletions

View File

@ -13,7 +13,6 @@ import androidx.preference.PreferenceManager;
import android.util.Log;
import org.microg.gms.common.PackageUtils;
import org.microg.gms.gcm.McsConstants;
import java.io.File;
@ -44,7 +43,7 @@ public class CheckinPrefs implements SharedPreferences.OnSharedPreferenceChangeL
systemDefaultPreferences = (SharedPreferences) Context.class.getDeclaredMethod("getSharedPreferences", File.class, int.class).invoke(context, new File("/system/etc/microg.xml"), Context.MODE_PRIVATE);
} catch (Exception ignored) {
}
update(context);
update();
}
}
@ -55,13 +54,13 @@ public class CheckinPrefs implements SharedPreferences.OnSharedPreferenceChangeL
return preferences.getBoolean(key, def);
}
private void update(Context context) {
checkinEnabled = getSettingsBoolean(PREF_ENABLE_CHECKIN, McsConstants.gmsExists(context));
private void update() {
checkinEnabled = getSettingsBoolean(PREF_ENABLE_CHECKIN, true);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
update(null);
update();
}
public boolean isEnabled() {

View File

@ -19,7 +19,6 @@ package org.microg.gms.gcm;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
@ -89,7 +88,7 @@ public class GcmPrefs implements SharedPreferences.OnSharedPreferenceChangeListe
systemDefaultPreferences = (SharedPreferences) Context.class.getDeclaredMethod("getSharedPreferences", File.class, int.class).invoke(context, new File("/system/etc/microg.xml"), Context.MODE_PRIVATE);
} catch (Exception ignored) {
}
update(context);
update();
}
}
@ -100,8 +99,8 @@ public class GcmPrefs implements SharedPreferences.OnSharedPreferenceChangeListe
return preferences.getBoolean(key, def);
}
public void update(Context context) {
gcmEnabled = getSettingsBoolean(PREF_ENABLE_GCM, McsConstants.gmsExists(context));
public void update() {
gcmEnabled = getSettingsBoolean(PREF_ENABLE_GCM, true);
gcmLogEnabled = getSettingsBoolean(PREF_FULL_LOG, true);
confirmNewApps = getSettingsBoolean(PREF_CONFIRM_NEW_APPS, false);
@ -208,7 +207,7 @@ public class GcmPrefs implements SharedPreferences.OnSharedPreferenceChangeListe
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
update(null);
update();
}
public boolean isEnabled() {

View File

@ -16,9 +16,6 @@
package org.microg.gms.gcm;
import android.content.Context;
import android.content.pm.PackageManager;
public final class McsConstants {
public static final int MCS_HEARTBEAT_PING_TAG = 0;
public static final int MCS_HEARTBEAT_ACK_TAG = 1;
@ -47,15 +44,4 @@ public final class McsConstants {
public static String ACTION_SEND = "org.microg.gms.gcm.mcs.SEND";
public static String ACTION_ACK = "org.microg.gms.gcm.mcs.ACK";
public static String EXTRA_REASON = "org.microg.gms.gcm.mcs.REASON";
public static boolean gmsExists(Context context) {
try {
if (context != null &&
context.getPackageManager().getApplicationInfo("com.google.android.gms", 0).enabled) {
return true;
}
} catch (PackageManager.NameNotFoundException e) {}
return false;
}
}