Various fixes

related to #86, #164, #242
This commit is contained in:
Marvin W 2016-12-23 18:59:29 +01:00
parent 48e9988bcc
commit 05a8b44f2d
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
4 changed files with 25 additions and 12 deletions

2
extern/UnifiedNlp vendored

@ -1 +1 @@
Subproject commit 2f810b14fde67cb690b440b3249f1887435c2e92 Subproject commit d2b26b9fbcf90a0f24b29c11c4c814631ec81a80

View File

@ -35,6 +35,11 @@
android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" android:name="com.google.android.googleapps.permission.GOOGLE_AUTH"
android:icon="@drawable/proprietary_auth_ic_scope_icon_default"/> android:icon="@drawable/proprietary_auth_ic_scope_icon_default"/>
<permission
android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.cp"
android:description="@string/permission_service_cp_description"
android:label="@string/permission_service_cp_label"
android:protectionLevel="dangerous"/>
<permission <permission
android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.local" android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.local"
android:description="@string/permission_service_local_description" android:description="@string/permission_service_local_description"

View File

@ -23,8 +23,6 @@ import android.content.pm.PackageManager;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
import com.google.android.gms.R;
import org.microg.gms.common.PackageUtils; import org.microg.gms.common.PackageUtils;
import java.io.IOException; import java.io.IOException;
@ -37,6 +35,7 @@ public class AuthManager {
private static final String TAG = "GmsAuthManager"; private static final String TAG = "GmsAuthManager";
public static final String PERMISSION_TREE_BASE = "com.google.android.googleapps.permission.GOOGLE_AUTH."; public static final String PERMISSION_TREE_BASE = "com.google.android.googleapps.permission.GOOGLE_AUTH.";
private static final String PREF_AUTH_TRUST_GOOGLE = "auth_manager_trust_google"; private static final String PREF_AUTH_TRUST_GOOGLE = "auth_manager_trust_google";
public static final int ONE_HOUR_IN_SECONDS = 60 * 60;
private final Context context; private final Context context;
private final String accountName; private final String accountName;
@ -159,10 +158,14 @@ public class AuthManager {
setAuthToken("SID", response.Sid); setAuthToken("SID", response.Sid);
if (response.LSid != null) if (response.LSid != null)
setAuthToken("LSID", response.LSid); setAuthToken("LSID", response.LSid);
if (response.expiry > 0) if (response.auth != null && (response.expiry != 0 || response.storeConsentRemotely)) {
setExpiry(response.expiry);
if (response.auth != null && (response.expiry != 0 || response.storeConsentRemotely))
setAuthToken(response.auth); setAuthToken(response.auth);
if (response.expiry > 0) {
setExpiry(response.expiry);
} else {
setExpiry(System.currentTimeMillis() / 1000 + ONE_HOUR_IN_SECONDS); // make valid for one hour by default
}
}
} }
public static boolean isTrustGooglePermitted(Context context) { public static boolean isTrustGooglePermitted(Context context) {

View File

@ -348,8 +348,7 @@ public class McsService extends Service implements Handler.Callback {
private synchronized void connect() { private synchronized void connect() {
try { try {
tryClose(inputStream); closeAll();
tryClose(outputStream);
logd("Starting MCS connection..."); logd("Starting MCS connection...");
Socket socket = new Socket(SERVICE_HOST, SERVICE_PORT); Socket socket = new Socket(SERVICE_HOST, SERVICE_PORT);
logd("Connected to " + SERVICE_HOST + ":" + SERVICE_PORT); logd("Connected to " + SERVICE_HOST + ":" + SERVICE_PORT);
@ -581,13 +580,19 @@ public class McsService extends Service implements Handler.Callback {
} }
} }
private void handleTeardown(android.os.Message msg) { private void closeAll() {
tryClose(inputStream); tryClose(inputStream);
tryClose(outputStream); tryClose(outputStream);
if (sslSocket != null) {
try { try {
sslSocket.close(); sslSocket.close();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
}
}
private void handleTeardown(android.os.Message msg) {
closeAll();
scheduleReconnect(this); scheduleReconnect(this);