Loading src/org/microg/gms/auth/AuthManager.java +10 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.content.pm.PackageManager; import android.preference.PreferenceManager; import android.util.Log; import com.google.android.gms.R; import org.microg.gms.common.PackageUtils; import java.io.IOException; Loading @@ -43,6 +45,7 @@ public class AuthManager { private AccountManager accountManager; private Account account; private String packageSignature; private String accountType; public AuthManager(Context context, String accountName, String packageName, String service) { this.context = context; Loading @@ -51,6 +54,12 @@ public class AuthManager { this.service = service; } public String getAccountType() { if (accountType == null) accountType = context.getString(R.string.google_account_type); return accountType; } public AccountManager getAccountManager() { if (accountManager == null) accountManager = AccountManager.get(context); Loading @@ -59,7 +68,7 @@ public class AuthManager { public Account getAccount() { if (account == null) account = new Account(accountName, "com.google"); account = new Account(accountName, getAccountType()); return account; } Loading src/org/microg/gms/auth/AuthManagerServiceImpl.java +1 −3 Original line number Diff line number Diff line Loading @@ -38,8 +38,6 @@ import static org.microg.gms.auth.AskPermissionActivity.EXTRA_CONSENT_DATA; public class AuthManagerServiceImpl extends IAuthManagerService.Stub { private static final String TAG = "GmsAuthManagerSvc"; public static final String GOOGLE_ACCOUNT_TYPE = "com.google"; public static final String KEY_AUTHORITY = "authority"; public static final String KEY_CALLBACK_INTENT = "callback_intent"; public static final String KEY_CALLER_UID = "callerUid"; Loading Loading @@ -83,7 +81,7 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub { Intent i = new Intent(context, AskPermissionActivity.class); i.putExtras(extras); i.putExtra(KEY_ANDROID_PACKAGE_NAME, packageName); i.putExtra(KEY_ACCOUNT_TYPE, GOOGLE_ACCOUNT_TYPE); i.putExtra(KEY_ACCOUNT_TYPE, authManager.getAccountType()); i.putExtra(KEY_ACCOUNT_NAME, accountName); i.putExtra(KEY_AUTHTOKEN, scope); if (res.consentDataBase64 != null) Loading src/org/microg/gms/auth/login/LoginActivity.java +4 −2 Original line number Diff line number Diff line Loading @@ -62,10 +62,12 @@ public class LoginActivity extends AssistantActivity { private static final String COOKIE_OAUTH_TOKEN = "oauth_token"; private WebView webView; private String accountType; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); accountType = getString(R.string.google_account_type); webView = createWebView(this); webView.addJavascriptInterface(new JsBridge(), "mm"); ((ViewGroup) findViewById(R.id.auth_root)).addView(webView); Loading @@ -79,7 +81,7 @@ public class LoginActivity extends AssistantActivity { if (getIntent().hasExtra(EXTRA_TOKEN)) { if (getIntent().hasExtra(EXTRA_EMAIL)) { AccountManager accountManager = AccountManager.get(LoginActivity.this); Account account = new Account(getIntent().getStringExtra(EXTRA_EMAIL), "com.google"); Account account = new Account(getIntent().getStringExtra(EXTRA_EMAIL), accountType); accountManager.addAccountExplicitly(account, getIntent().getStringExtra(EXTRA_TOKEN), null); retrieveGmsToken(account); } else { Loading Loading @@ -168,7 +170,7 @@ public class LoginActivity extends AssistantActivity { @Override public void onResponse(AuthResponse response) { AccountManager accountManager = AccountManager.get(LoginActivity.this); Account account = new Account(response.email, "com.google"); Account account = new Account(response.email, accountType); if (accountManager.addAccountExplicitly(account, response.token, null)) { accountManager.setAuthToken(account, "SID", response.Sid); accountManager.setAuthToken(account, "LSID", response.LSid); Loading src/org/microg/gms/auth/loginservice/AccountAuthenticator.java +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ class AccountAuthenticator extends AbstractAccountAuthenticator { @Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { if (accountType.equals(accountType)) { if (accountType.equals(this.accountType)) { final Intent i = new Intent(context, LoginActivity.class); i.putExtras(options); i.putExtra(LoginActivity.EXTRA_TMPL, LoginActivity.TMPL_NEW_ACCOUNT); Loading src/org/microg/gms/checkin/CheckinManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.accounts.AccountManager; import android.content.ContentResolver; import android.content.Context; import com.google.android.gms.R; import org.microg.gms.auth.AuthManager; import org.microg.gms.common.Constants; import org.microg.gms.common.DeviceConfiguration; Loading @@ -42,7 +44,8 @@ public class CheckinManager { return null; List<CheckinClient.Account> accounts = new ArrayList<>(); AccountManager accountManager = AccountManager.get(context); for (Account account : accountManager.getAccountsByType("com.google")) { String accountType = context.getString(R.string.google_account_type); for (Account account : accountManager.getAccountsByType(accountType)) { String token = new AuthManager(context, account.name, Constants.GMS_PACKAGE_NAME, "ac2dm").getAuthToken(); accounts.add(new CheckinClient.Account(account.name, token)); } Loading Loading
src/org/microg/gms/auth/AuthManager.java +10 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.content.pm.PackageManager; import android.preference.PreferenceManager; import android.util.Log; import com.google.android.gms.R; import org.microg.gms.common.PackageUtils; import java.io.IOException; Loading @@ -43,6 +45,7 @@ public class AuthManager { private AccountManager accountManager; private Account account; private String packageSignature; private String accountType; public AuthManager(Context context, String accountName, String packageName, String service) { this.context = context; Loading @@ -51,6 +54,12 @@ public class AuthManager { this.service = service; } public String getAccountType() { if (accountType == null) accountType = context.getString(R.string.google_account_type); return accountType; } public AccountManager getAccountManager() { if (accountManager == null) accountManager = AccountManager.get(context); Loading @@ -59,7 +68,7 @@ public class AuthManager { public Account getAccount() { if (account == null) account = new Account(accountName, "com.google"); account = new Account(accountName, getAccountType()); return account; } Loading
src/org/microg/gms/auth/AuthManagerServiceImpl.java +1 −3 Original line number Diff line number Diff line Loading @@ -38,8 +38,6 @@ import static org.microg.gms.auth.AskPermissionActivity.EXTRA_CONSENT_DATA; public class AuthManagerServiceImpl extends IAuthManagerService.Stub { private static final String TAG = "GmsAuthManagerSvc"; public static final String GOOGLE_ACCOUNT_TYPE = "com.google"; public static final String KEY_AUTHORITY = "authority"; public static final String KEY_CALLBACK_INTENT = "callback_intent"; public static final String KEY_CALLER_UID = "callerUid"; Loading Loading @@ -83,7 +81,7 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub { Intent i = new Intent(context, AskPermissionActivity.class); i.putExtras(extras); i.putExtra(KEY_ANDROID_PACKAGE_NAME, packageName); i.putExtra(KEY_ACCOUNT_TYPE, GOOGLE_ACCOUNT_TYPE); i.putExtra(KEY_ACCOUNT_TYPE, authManager.getAccountType()); i.putExtra(KEY_ACCOUNT_NAME, accountName); i.putExtra(KEY_AUTHTOKEN, scope); if (res.consentDataBase64 != null) Loading
src/org/microg/gms/auth/login/LoginActivity.java +4 −2 Original line number Diff line number Diff line Loading @@ -62,10 +62,12 @@ public class LoginActivity extends AssistantActivity { private static final String COOKIE_OAUTH_TOKEN = "oauth_token"; private WebView webView; private String accountType; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); accountType = getString(R.string.google_account_type); webView = createWebView(this); webView.addJavascriptInterface(new JsBridge(), "mm"); ((ViewGroup) findViewById(R.id.auth_root)).addView(webView); Loading @@ -79,7 +81,7 @@ public class LoginActivity extends AssistantActivity { if (getIntent().hasExtra(EXTRA_TOKEN)) { if (getIntent().hasExtra(EXTRA_EMAIL)) { AccountManager accountManager = AccountManager.get(LoginActivity.this); Account account = new Account(getIntent().getStringExtra(EXTRA_EMAIL), "com.google"); Account account = new Account(getIntent().getStringExtra(EXTRA_EMAIL), accountType); accountManager.addAccountExplicitly(account, getIntent().getStringExtra(EXTRA_TOKEN), null); retrieveGmsToken(account); } else { Loading Loading @@ -168,7 +170,7 @@ public class LoginActivity extends AssistantActivity { @Override public void onResponse(AuthResponse response) { AccountManager accountManager = AccountManager.get(LoginActivity.this); Account account = new Account(response.email, "com.google"); Account account = new Account(response.email, accountType); if (accountManager.addAccountExplicitly(account, response.token, null)) { accountManager.setAuthToken(account, "SID", response.Sid); accountManager.setAuthToken(account, "LSID", response.LSid); Loading
src/org/microg/gms/auth/loginservice/AccountAuthenticator.java +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ class AccountAuthenticator extends AbstractAccountAuthenticator { @Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { if (accountType.equals(accountType)) { if (accountType.equals(this.accountType)) { final Intent i = new Intent(context, LoginActivity.class); i.putExtras(options); i.putExtra(LoginActivity.EXTRA_TMPL, LoginActivity.TMPL_NEW_ACCOUNT); Loading
src/org/microg/gms/checkin/CheckinManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.accounts.AccountManager; import android.content.ContentResolver; import android.content.Context; import com.google.android.gms.R; import org.microg.gms.auth.AuthManager; import org.microg.gms.common.Constants; import org.microg.gms.common.DeviceConfiguration; Loading @@ -42,7 +44,8 @@ public class CheckinManager { return null; List<CheckinClient.Account> accounts = new ArrayList<>(); AccountManager accountManager = AccountManager.get(context); for (Account account : accountManager.getAccountsByType("com.google")) { String accountType = context.getString(R.string.google_account_type); for (Account account : accountManager.getAccountsByType(accountType)) { String token = new AuthManager(context, account.name, Constants.GMS_PACKAGE_NAME, "ac2dm").getAuthToken(); accounts.add(new CheckinClient.Account(account.name, token)); } Loading