mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2025-02-06 15:56:48 +01:00
Various fixes, Checkin (dependency for GCM) is still broken!
Fix lint (fixes #20) (hopefully) Fix mcs loop (could cause high battery drain) Show link to UnifiedNlp in settings (mentioned in #10, @XDA) Add extended description for settings (mentioned @XDA)
This commit is contained in:
parent
d48defe2df
commit
e1b757de3e
2
extern/GmsApi
vendored
2
extern/GmsApi
vendored
@ -1 +1 @@
|
||||
Subproject commit ef5e6dc0668a8ca152aa38a78f0e91d65120d3b6
|
||||
Subproject commit 2c847ce6e8ac1604356dc45fd672cfdd6ad4d73b
|
2
extern/UnifiedNlp
vendored
2
extern/UnifiedNlp
vendored
@ -1 +1 @@
|
||||
Subproject commit 06341df3469b581e2bf5ab46e09cc1bb75a5d811
|
||||
Subproject commit 74fb8b696aaf35584b97c86eb7d9e67aaaf0e685
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
|
||||
|
@ -16,25 +16,25 @@
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.1.0'
|
||||
classpath 'com.android.tools.build:gradle:1.2.3'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
flatDir {
|
||||
dirs '../libs'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:support-v4:22.0.0'
|
||||
compile 'com.android.support:appcompat-v7:22.0.0'
|
||||
compile 'com.android.support:support-v4:22.2.0'
|
||||
compile 'com.android.support:appcompat-v7:22.2.0'
|
||||
compile 'de.hdodenhof:circleimageview:1.2.1'
|
||||
compile 'com.squareup.wire:wire-runtime:1.6.1'
|
||||
compile project(':play-services-api')
|
||||
@ -64,6 +64,10 @@ android {
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_6
|
||||
}
|
||||
lintOptions {
|
||||
// TODO: Remove MissingTranslation once we have stable strings and proper translations.
|
||||
disable 'MissingTranslation', 'InvalidPackage'
|
||||
}
|
||||
}
|
||||
|
||||
if (file('user.gradle').exists()) {
|
||||
|
@ -19,7 +19,7 @@
|
||||
android:versionName="7.5.74 (µg v0.01)">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="10"
|
||||
android:minSdkVersion="14"
|
||||
android:targetSdkVersion="22" />
|
||||
|
||||
<permission
|
||||
@ -51,6 +51,7 @@
|
||||
android:description="@string/permission_service_writely_description"
|
||||
android:label="@string/permission_service_writely_label"
|
||||
android:protectionLevel="dangerous" />
|
||||
|
||||
<permission
|
||||
android:name="org.microg.gms.STATUS_BROADCAST"
|
||||
android:label="@string/perm_status_broadcast_label"
|
||||
@ -187,6 +188,7 @@
|
||||
android:scheme="android_secret_code" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name="org.microg.gms.gcm.PendingReceiver" />
|
||||
|
||||
<!-- DroidGuard -->
|
||||
|
||||
@ -337,7 +339,8 @@
|
||||
<activity
|
||||
android:name="org.microg.gms.ui.SettingsActivity"
|
||||
android:icon="@drawable/ic_microg_app"
|
||||
android:label="@string/gms_settings_name">
|
||||
android:label="@string/gms_settings_name"
|
||||
android:theme="@style/SettingsTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
|
@ -61,6 +61,7 @@ public class McsService extends IntentService {
|
||||
public static final int HEARTBEAT_MS = 60000;
|
||||
public static final int HEARTBEAT_ALLOWED_OFFSET_MS = 2000;
|
||||
private static final AtomicBoolean connecting = new AtomicBoolean(false);
|
||||
private static final AtomicBoolean pending = new AtomicBoolean(false);
|
||||
private static Thread connectionThread;
|
||||
private static Thread heartbeatThread;
|
||||
|
||||
@ -73,6 +74,10 @@ public class McsService extends IntentService {
|
||||
super(TAG);
|
||||
}
|
||||
|
||||
public static AtomicBoolean getPending() {
|
||||
return pending;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHandleIntent(Intent intent) {
|
||||
if (!isConnected()) {
|
||||
@ -86,6 +91,7 @@ public class McsService extends IntentService {
|
||||
} else {
|
||||
Log.d(TAG, "MCS connection already started");
|
||||
}
|
||||
pending.set(false);
|
||||
}
|
||||
|
||||
public static boolean isConnected() {
|
||||
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2013-2015 µg Project Team
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.microg.gms.gcm;
|
||||
|
||||
public class PendingReceiver {
|
||||
}
|
@ -16,29 +16,39 @@
|
||||
|
||||
package org.microg.gms.gcm;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.SystemClock;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
public class TriggerReceiver extends BroadcastReceiver {
|
||||
private static final String PREF_ENABLE_GCM = "gcm_enable_mcs_service";
|
||||
private static final long pendingDelay = 1000;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
boolean force = "android.provider.Telephony.SECRET_CODE".equals(intent.getAction());
|
||||
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
|
||||
if (McsService.getPending().compareAndSet(false, true)) {
|
||||
if (!McsService.isConnected() || force) {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(PREF_ENABLE_GCM, false) || force) {
|
||||
|
||||
if (networkInfo != null && networkInfo.isConnected() || force) {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(PREF_ENABLE_GCM, false) || force) {
|
||||
if (!McsService.isConnected() || force) {
|
||||
context.startService(new Intent(context, McsService.class));
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
|
||||
if (networkInfo != null && networkInfo.isConnected() || force) {
|
||||
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
PendingIntent pendingIntent = PendingIntent.getService(context, 0, new Intent(context, McsService.class), 0);
|
||||
alarmManager.set(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + pendingDelay, pendingIntent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
McsService.getPending().set(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="fake_signature">
|
||||
<string name="fake_signature" translatable="false">
|
||||
308204433082032ba003020102020900c2e08746644a308d300d06092a864886f70d01010405003074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f6964301e170d3038303832313233313333345a170d3336303130373233313333345a3074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f696430820120300d06092a864886f70d01010105000382010d00308201080282010100ab562e00d83ba208ae0a966f124e29da11f2ab56d08f58e2cca91303e9b754d372f640a71b1dcb130967624e4656a7776a92193db2e5bfb724a91e77188b0e6a47a43b33d9609b77183145ccdf7b2e586674c9e1565b1f4c6a5955bff251a63dabf9c55c27222252e875e4f8154a645f897168c0b1bfc612eabf785769bb34aa7984dc7e2ea2764cae8307d8c17154d7ee5f64a51a44a602c249054157dc02cd5f5c0e55fbef8519fbe327f0b1511692c5a06f19d18385f5c4dbc2d6b93f68cc2979c70e18ab93866b3bd5db8999552a0e3b4c99df58fb918bedc182ba35e003c1b4b10dd244a8ee24fffd333872ab5221985edab0fc0d0b145b6aa192858e79020103a381d93081d6301d0603551d0e04160414c77d8cc2211756259a7fd382df6be398e4d786a53081a60603551d2304819e30819b8014c77d8cc2211756259a7fd382df6be398e4d786a5a178a4763074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f6964820900c2e08746644a308d300c0603551d13040530030101ff300d06092a864886f70d010104050003820101006dd252ceef85302c360aaace939bcff2cca904bb5d7a1661f8ae46b2994204d0ff4a68c7ed1a531ec4595a623ce60763b167297a7ae35712c407f208f0cb109429124d7b106219c084ca3eb3f9ad5fb871ef92269a8be28bf16d44c8d9a08e6cb2f005bb3fe2cb96447e868e731076ad45b33f6009ea19c161e62641aa99271dfd5228c5c587875ddb7f452758d661f6cc0cccb7352e424cc4365c523532f7325137593c4ae341f4db41edda0d0b1071a7c440f0fe9ea01cb627ca674369d084bd2fd911ff06cdbf2cfa10dc0f893ae35762919048c7efc64c7144178342f70581c9de573af55b390dd7fdb9418631895d5f759f30112687ff621410c069308a
|
||||
</string>
|
||||
</resources>
|
@ -34,5 +34,15 @@
|
||||
<string name="pref_auth_trust_google_title">Trust Google for app permissions</string>
|
||||
<string name="pref_auth_trust_google_summary">When disabled, the user is asked before an apps authorization request is sent to Google. Some applications will fail to use the Google account if this is disabled.</string>
|
||||
|
||||
<string name="pref_checkin_enable">checkin_enable_service</string>
|
||||
<string name="pref_checkin_enable_title">Enable device checkin</string>
|
||||
<string name="pref_checkin_enable_summary">Device checkin is a hidden process that is used to create an unique identifier for Google services. µg GmsCore strips identifying bits other than your Google account name from this data.</string>
|
||||
<string name="pref_gcm_enable_mcs">gcm_enable_mcs_service</string>
|
||||
<string name="pref_gcm_enable_mcs_title">Enable Google Cloud Messaging</string>
|
||||
<string name="pref_gcm_enable_mcs_summary">Google Cloud Messaging is a push notification provider used by many applications. To use it you must enable device checkin.</string>
|
||||
|
||||
<string name="prefcat_services">Background services</string>
|
||||
<string name="prefcat_components">Components</string>
|
||||
|
||||
<string name="gms_settings_name">µg Settings</string>
|
||||
</resources>
|
||||
|
@ -15,15 +15,24 @@
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory android:title="Background services">
|
||||
<PreferenceCategory android:title="@string/prefcat_services">
|
||||
<CheckBoxPreference
|
||||
android:key="checkin_enable_service"
|
||||
android:defaultValue="false"
|
||||
android:title="Enable regular checkin" />
|
||||
android:key="@string/pref_checkin_enable"
|
||||
android:summary="@string/pref_checkin_enable_summary"
|
||||
android:title="@string/pref_checkin_enable_title" />
|
||||
<CheckBoxPreference
|
||||
android:key="gcm_enable_mcs_service"
|
||||
android:defaultValue="false"
|
||||
android:dependency="checkin_enable_service"
|
||||
android:title="Enable Google Cloud Messaging" />
|
||||
android:dependency="@string/pref_checkin_enable"
|
||||
android:key="@string/pref_gcm_enable_mcs"
|
||||
android:summary="@string/pref_gcm_enable_mcs_summary"
|
||||
android:title="@string/pref_gcm_enable_mcs_title" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/prefcat_components">
|
||||
<Preference android:title="@string/nlp_settings_label">
|
||||
<intent
|
||||
android:targetClass="org.microg.nlp.ui.SettingsActivity"
|
||||
android:targetPackage="com.google.android.gms" />
|
||||
</Preference>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
Loading…
x
Reference in New Issue
Block a user