mirror of
https://github.com/YTVanced/VancedMicroG
synced 2024-11-24 12:15:12 +00:00
Auth mostly done, checkin should be next
This commit is contained in:
parent
189bb8966e
commit
88c3cb0c19
13 changed files with 303 additions and 38 deletions
|
@ -25,6 +25,7 @@
|
|||
android:targetSdkVersion="21" />
|
||||
|
||||
<permission-tree android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
|
||||
|
||||
<permission
|
||||
android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.local"
|
||||
android:label="@string/permission_service_local_label"
|
||||
|
@ -83,9 +84,28 @@
|
|||
|
||||
<!-- Services Framework -->
|
||||
<provider
|
||||
android:name="org.microg.gms.gservices.GServicesProvider"
|
||||
android:exported="true"
|
||||
android:authorities="com.google.android.gsf.gservices"
|
||||
android:name="org.microg.gms.gservices.GServicesProvider" />
|
||||
android:authorities="com.google.android.gsf.gservices"/>
|
||||
|
||||
<provider
|
||||
android:name="org.microg.gms.feeds.SubscribedFeedsProvider"
|
||||
android:authorities="subscribedfeeds"
|
||||
android:exported="true"
|
||||
android:multiprocess="false"
|
||||
android:readPermission="android.permission.SUBSCRIBED_FEEDS_READ"
|
||||
android:writePermission="android.permission.SUBSCRIBED_FEEDS_WRITE" />
|
||||
|
||||
<!-- People -->
|
||||
|
||||
<service
|
||||
android:name=".people.service.PeopleService"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.gms.people.service.START" />
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<!-- Auth -->
|
||||
|
||||
|
@ -132,15 +152,8 @@
|
|||
<activity
|
||||
android:name="org.microg.gms.auth.AskPermissionActivity"
|
||||
android:theme="@style/Theme.AppCompat.Light.Dialog"
|
||||
android:exported="true" />
|
||||
|
||||
<provider
|
||||
android:name="org.microg.gms.feeds.SubscribedFeedsProvider"
|
||||
android:authorities="subscribedfeeds"
|
||||
android:exported="true"
|
||||
android:multiprocess="false"
|
||||
android:readPermission="android.permission.SUBSCRIBED_FEEDS_READ"
|
||||
android:writePermission="android.permission.SUBSCRIBED_FEEDS_WRITE" />
|
||||
android:excludeFromRecents="true" />
|
||||
|
||||
<service
|
||||
android:name=".auth.GetToken"
|
||||
|
|
2
GmsApi
2
GmsApi
|
@ -1 +1 @@
|
|||
Subproject commit 07e3208a26361d35253c1c50abca93689b643081
|
||||
Subproject commit 3243e7d3ecf2f7ff92279b61c4a7e7831356f5c7
|
|
@ -19,7 +19,7 @@ buildscript {
|
|||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.0.0'
|
||||
classpath 'com.android.tools.build:gradle:1.0.1'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,17 +21,30 @@
|
|||
|
||||
<TextView
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:text="@string/account_manager_title"
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<View
|
||||
android:id="@+id/no_progress_bar"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@color/dialog_border_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:visibility="gone"
|
||||
style="?android:attr/progressBarStyleHorizontal" />
|
||||
|
||||
<LinearLayout
|
||||
android:paddingTop="15dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
|
@ -75,7 +88,7 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:textSize="18sp"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:text="@string/ask_permission_title"
|
||||
android:text="@string/ask_scope_permission_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
|
|
@ -89,4 +89,89 @@
|
|||
<string name="permission_service_youtube_description">Allows app to access YouTube through any associated Google account.</string>
|
||||
<string name="permission_service_YouTubeUser_label">YouTube usernames</string>
|
||||
<string name="permission_service_YouTubeUser_description">Allows app to access YouTube username(s) used with any associated Google account.</string>
|
||||
|
||||
<string name="permission_scope_www.googleapis.com_auth_activity">View the activity history of your Google Apps</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_adexchange.buyer">Manage your Ad Exchange buyer account configuration</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_adexchange.seller.readonly">View your Ad Exchange data</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_adexchange.seller">View and manage your Ad Exchange data</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_adsensehost">View and manage your AdSense host data and associated accounts</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_adsense.readonly">View your AdSense data</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_adsense">View and manage your AdSense data</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_analytics.readonly">View your Google Analytics data</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_analytics">View and manage your Google Analytics data</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_androidpublisher">Access to the Google Play Android Developer</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_appengine.admin">App engine admin scope.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_apps.groups.migration">Read and write access to Groups Migration API.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_apps.groups.settings">View and manage the settings of a Google Apps Group</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_apps.licensing">Read/write access to License Manager API.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_apps.order">For reseller administrators and users read/write access when testing in the API\'s sandbox, or read/write access when calling an API operation directly.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_apps.order.readonly">In addition to the overall read/write OAuth scope, use the read only OAuth scope when retrieving the customer\'s data.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_apps_reporting_audit.readonly">Access to the Admin Audit API ReadOnly</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_appstate">Scope for using the App State service.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_bigquery.readonly">View your data in Google BigQuery</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_bigquery">View and manage your data in Google BigQuery</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_blogger">Manage your Blogger account</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_blogger.readonly">View your Blogger account</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_books">Manage your books</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_calendar">Manage your calendars</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_calendar.readonly">View your calendars</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_cloudprint">View and manage your google cloud print data</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_compute.readonly">View your Google Compute Engine resources</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_compute">View and manage your Google Compute Engine resources</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_coordinate.readonly">View your Google Coordinate jobs</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_coordinate">View and manage your Google Maps Coordinate jobs</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_devstorage.full_control">Manage your data and permissions in Google Cloud Storage</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_devstorage.read_only">View your data in Google Cloud Storage</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_devstorage.read_write">Manage your data in Google Cloud Storage</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_dfareporting">View and manage DoubleClick for Advertisers reports</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_drive.appdata">Allows access to the Application Data folder</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_drive.apps.readonly">View your Google Drive apps</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_drive.file">View and manage Google Drive files that you have opened or created with this app</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_drive.install">Special scope used to let users approve installation of an app</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_drive.metadata.readonly">View metadata for files and documents in your Google Drive</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_drive.readonly">View the files and documents in your Google Drive</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_drive.scripts">Modify your Google Apps Script scripts\' behavior</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_drive">View and manage the files and documents in your Google Drive</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_freebase.readonly">view your Freebase account</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_freebase">Sign in to Freebase with your account</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_fusiontables">Manage your Fusion Tables</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_fusiontables.readonly">View your Fusion Tables</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_games">Scope for accessing data from Google Play Games.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_gan">Manage your GAN data</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_gan.readonly">View your GAN data</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_gcm_for_chrome">CloudMessaging for chrome</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_glass.timeline">Glass timeline scope</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_gmail.compose">Create, read, update, and delete drafts. Send messages and drafts.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_gmail.modify">All read/write operations except immediate, permanent deletion of threads and messages, bypassing Trash.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_gmail.readonly">Read all resources and their metadata—no write operations.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_latitude.all.best">Manage your best-available location and location history</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_latitude.all.city">Manage your city-level location and location history</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_latitude.current.best">Manage your best-available location</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_latitude.current.city">Manage your city-level location</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_mapsengine">provides read and write access to the user\'s Maps Engine data from your application.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_mapsengine.readonly">provides read-only access to the user\'s Maps Engine data from your</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_orkut">Manage your Orkut activity</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_orkut.readonly">View your Orkut data</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_plus.login">Know your name, basic info, and list of people you\'re connected to on Google+</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_plus.me">Know who you are on Google</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_prediction">Manage your data in the Google Prediction API</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_shoppingapi">View your product data</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_siteverification">Manage the list of sites and domains you control</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_siteverification.verify_only">Manage your new site verifications with Google</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_structuredcontent">Read/write access to Shopping Content API.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_taskqueue.consumer">Consume Tasks from your Taskqueues</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_taskqueue">Manage your Tasks</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_tasks">Manage your tasks</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_tasks.readonly">View your tasks</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_tracks">Google Maps Tracks API, This scope allows read and write access to your project\'s data.</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_urlshortener">Manage your goo.gl short URLs</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_userinfo.email">View your email address</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_userinfo.profile">View basic information about your account</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_youtube">Manage your YouTube account</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_youtubepartner">View and manage your assets and associated content on YouTube</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_youtube.readonly">View your YouTube account</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_youtube.upload">Manage your YouTube videos</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_yt_analytics_monetary.readonly">View YouTube Analytics monetary reports for your YouTube content</string>
|
||||
<string name="permission_scope_www.googleapis.com_auth_yt_analytics.readonly">View YouTube Analytics reports for your YouTube content</string>
|
||||
|
||||
</resources>
|
|
@ -20,7 +20,8 @@
|
|||
<string name="google_account_type">com.google</string>
|
||||
<string name="google_account_label">Google</string>
|
||||
<string name="ask_permission_tos">By continuing, you allow this app and Google to use your information in accordance with their respective terms of service and privacy policies.</string>
|
||||
<string name="ask_permission_title">%s would like to:</string>
|
||||
<string name="ask_scope_permission_title">%s would like to:</string>
|
||||
<string name="ask_service_permission_title">%s would like to use:</string>
|
||||
<string name="account_manager_title">µg Google Account Manager</string>
|
||||
<string name="allow">Allow</string>
|
||||
<string name="deny">Deny</string>
|
||||
|
|
53
src/com/google/android/gms/people/service/PeopleService.java
Normal file
53
src/com/google/android/gms/people/service/PeopleService.java
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* 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 com.google.android.gms.people.service;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
import org.microg.gms.AbstractGmsServiceBroker;
|
||||
import org.microg.gms.people.service.PeopleServiceImpl;
|
||||
|
||||
import static org.microg.gms.common.Constants.ACTION_GMS_PEOPLE_SERVICE_START;
|
||||
|
||||
public class PeopleService extends Service {
|
||||
private static final String TAG = "GmsPeopleService";
|
||||
|
||||
private PeopleServiceImpl impl = new PeopleServiceImpl(this);
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker() {
|
||||
@Override
|
||||
public void getPeopleService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + packageName);
|
||||
callback.onPostInitComplete(0, impl.asBinder(), null);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
if (ACTION_GMS_PEOPLE_SERVICE_START.equals(intent.getAction())) {
|
||||
return broker.asBinder();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,8 +22,10 @@ import android.os.Bundle;
|
|||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import org.microg.gms.AbstractGmsServiceBroker;
|
||||
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
import org.microg.gms.AbstractGmsServiceBroker;
|
||||
import org.microg.gms.location.GoogleLocationManagerServiceImpl;
|
||||
|
||||
import static org.microg.gms.common.Constants.ACTION_GMS_LOCATION_MANAGER_SERVICE_START;
|
||||
|
@ -35,7 +37,7 @@ public class GoogleLocationManagerService extends Service {
|
|||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker() {
|
||||
@Override
|
||||
public void getGoogleLocationManagerService(IGmsCallbacks callback, int versionCode,
|
||||
String packageName, Bundle params) throws RemoteException {
|
||||
String packageName, Bundle params) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + packageName);
|
||||
callback.onPostInitComplete(0, impl.asBinder(), null);
|
||||
}
|
||||
|
|
|
@ -18,9 +18,8 @@ package org.microg.gms.auth;
|
|||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountAuthenticatorActivity;
|
||||
import android.accounts.AccountAuthenticatorResponse;
|
||||
import android.accounts.AccountManager;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
|
@ -41,11 +40,16 @@ import com.google.android.gms.R;
|
|||
import org.microg.gms.common.Utils;
|
||||
import org.microg.gms.userinfo.ProfileManager;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class AskPermissionActivity extends AccountAuthenticatorActivity {
|
||||
public static final String EXTRA_FROM_ACCOUNT_MANAGER = "from_account_manager";
|
||||
|
||||
private static final String TAG = "GmsAuthAskPermission";
|
||||
private Account account;
|
||||
private String packageName;
|
||||
private String service;
|
||||
private boolean fromAccountManager = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -63,6 +67,7 @@ public class AskPermissionActivity extends AccountAuthenticatorActivity {
|
|||
getIntent().getStringExtra(AccountManager.KEY_ACCOUNT_TYPE));
|
||||
packageName = getIntent().getStringExtra(AccountManager.KEY_ANDROID_PACKAGE_NAME);
|
||||
service = getIntent().getStringExtra(AccountManager.KEY_AUTHTOKEN);
|
||||
if (getIntent().hasExtra(EXTRA_FROM_ACCOUNT_MANAGER)) fromAccountManager = true;
|
||||
int callerUid = getIntent().getIntExtra(AccountManager.KEY_CALLER_UID, 0);
|
||||
Utils.checkPackage(this, packageName, callerUid);
|
||||
|
||||
|
@ -100,7 +105,11 @@ public class AskPermissionActivity extends AccountAuthenticatorActivity {
|
|||
}
|
||||
|
||||
((ImageView) findViewById(R.id.app_icon)).setImageDrawable(appIcon);
|
||||
((TextView) findViewById(R.id.title)).setText(getString(R.string.ask_permission_title, appLabel));
|
||||
if (isOAuth()) {
|
||||
((TextView) findViewById(R.id.title)).setText(getString(R.string.ask_scope_permission_title, appLabel));
|
||||
} else {
|
||||
((TextView) findViewById(R.id.title)).setText(getString(R.string.ask_service_permission_title, appLabel));
|
||||
}
|
||||
findViewById(android.R.id.button1).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -118,7 +127,43 @@ public class AskPermissionActivity extends AccountAuthenticatorActivity {
|
|||
|
||||
public void onAllow() {
|
||||
AuthManager.storePermission(this, account, packageName, service);
|
||||
finish();
|
||||
findViewById(android.R.id.button1).setEnabled(false);
|
||||
findViewById(android.R.id.button2).setEnabled(false);
|
||||
findViewById(R.id.progress_bar).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.no_progress_bar).setVisibility(View.GONE);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Context context = AskPermissionActivity.this;
|
||||
String sig = Utils.getFirstPackageSignatureDigest(context, packageName);
|
||||
AuthRequest request = new AuthRequest().fromContext(context)
|
||||
.email(account.name)
|
||||
.token(AccountManager.get(context).getPassword(account))
|
||||
.service(service)
|
||||
.app(packageName, sig)
|
||||
.hasPermission();
|
||||
if (fromAccountManager) {
|
||||
request.callerIsGms().calledFromAccountManager();
|
||||
} else {
|
||||
request.callerIsApp();
|
||||
}
|
||||
try {
|
||||
AuthResponse response = request.getResponse();
|
||||
AuthManager.storeResponse(context, account, packageName, sig, service, response);
|
||||
Bundle result = new Bundle();
|
||||
result.putString(AccountManager.KEY_AUTHTOKEN, response.auth);
|
||||
result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
|
||||
result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type);
|
||||
result.putString(AccountManager.KEY_ANDROID_PACKAGE_NAME, packageName);
|
||||
result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
|
||||
setAccountAuthenticatorResult(result);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
finish();
|
||||
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void onDeny() {
|
||||
|
@ -130,11 +175,11 @@ public class AskPermissionActivity extends AccountAuthenticatorActivity {
|
|||
super.finish();
|
||||
}
|
||||
|
||||
private class PermissionAdapter extends BaseAdapter {
|
||||
private boolean isOAuth() {
|
||||
return service.startsWith("oauth2:") || service.startsWith("oauth:");
|
||||
}
|
||||
|
||||
private boolean isOAuth() {
|
||||
return service.startsWith("oauth2:") || service.startsWith("oauth:");
|
||||
}
|
||||
private class PermissionAdapter extends BaseAdapter {
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
|
@ -162,11 +207,19 @@ public class AskPermissionActivity extends AccountAuthenticatorActivity {
|
|||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
String item = getItem(position);
|
||||
String label = "unknown";
|
||||
if (!isOAuth()) {
|
||||
int stringId = getResources().getIdentifier("permission_service_" + item + "_label", "string", getPackageName());
|
||||
if (stringId != 0) {
|
||||
label = getString(stringId);
|
||||
String labelResourceId;
|
||||
if (isOAuth()) {
|
||||
if (item.startsWith("https://")) {
|
||||
labelResourceId = "permission_scope_" + item.substring(8).replace("/", "_").replace("-", "_");
|
||||
} else {
|
||||
labelResourceId = "permission_scope_" + item.replace("/", "_").replace("-", "_");
|
||||
}
|
||||
} else {
|
||||
labelResourceId = "permission_service_" + item + "_label";
|
||||
}
|
||||
int labelResource = getResources().getIdentifier(labelResourceId, "string", getPackageName());
|
||||
if (labelResource != 0) {
|
||||
label = getString(labelResource);
|
||||
}
|
||||
View view = convertView;
|
||||
if (view == null) {
|
||||
|
|
|
@ -22,6 +22,7 @@ import android.content.Context;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.util.Log;
|
||||
|
||||
import org.microg.gms.common.Constants;
|
||||
import org.microg.gms.common.Utils;
|
||||
|
||||
public class AuthManager {
|
||||
|
@ -31,6 +32,7 @@ public class AuthManager {
|
|||
|
||||
public static void storeResponse(Context context, Account account, String packageName,
|
||||
String sig, String service, AuthResponse response) {
|
||||
if (service.startsWith("weblogin:")) return;
|
||||
AccountManager accountManager = AccountManager.get(context);
|
||||
if (response.accountId != null)
|
||||
accountManager.setUserData(account, "GoogleUserId", response.accountId);
|
||||
|
@ -48,6 +50,7 @@ public class AuthManager {
|
|||
|
||||
public static String getToken(Context context, Account account, String packageName,
|
||||
String sig, String service) {
|
||||
if (service.startsWith("weblogin:")) return null;
|
||||
AccountManager accountManager = AccountManager.get(context);
|
||||
return accountManager.peekAuthToken(account, buildTokenKey(packageName, sig, service));
|
||||
}
|
||||
|
@ -58,8 +61,13 @@ public class AuthManager {
|
|||
// https://developers.google.com/accounts/docs/CrossClientAuth
|
||||
Log.d(TAG, "Always permitting scope: " + service);
|
||||
return true;
|
||||
}
|
||||
if (!service.startsWith("oauth")) {
|
||||
} else if (service.startsWith("weblogin:")) {
|
||||
if (Constants.GMS_PACKAGE_SIGNATURE_SHA1.equals(sig)) {
|
||||
Log.d(TAG, "Permitting weblogin, is Google singed app!");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else if (!service.startsWith("oauth:") && !service.startsWith("oauth2:")) {
|
||||
if (context.getPackageManager().checkPermission(PERMISSION_TREE_BASE + service, packageName) == PackageManager.PERMISSION_GRANTED) {
|
||||
Log.d(TAG, "Permitting, permission is present");
|
||||
return true;
|
||||
|
@ -92,7 +100,8 @@ public class AuthManager {
|
|||
accountManager.setUserData(account, buildPermKey(packageName, sig, service), "1");
|
||||
}
|
||||
|
||||
private static String buildTokenKey(String packageName, String sig, String service) {
|
||||
public static String buildTokenKey(String packageName, String sig, String service) {
|
||||
if (service.startsWith("weblogin:")) return null;
|
||||
return packageName + ":" + sig + ":" + service;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,13 +18,14 @@ package org.microg.gms.auth;
|
|||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.accounts.AccountManagerFuture;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.RemoteException;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.auth.IAuthManagerService;
|
||||
|
@ -66,7 +67,7 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub {
|
|||
Utils.checkPackage(context, packageName, callerUid, getCallingUid());
|
||||
boolean notify = extras.getBoolean(KEY_HANDLE_NOTIFICATION, false);
|
||||
|
||||
Log.d(TAG, "getToken: account:" + accountName + " scope:" + scope + " extras:" + extras);
|
||||
Log.d(TAG, "getToken: account:" + accountName + " scope:" + scope + " extras:" + extras + ", notify: " + notify);
|
||||
Account account = new Account(accountName, GOOGLE_ACCOUNT_TYPE);
|
||||
String sig = Utils.getFirstPackageSignatureDigest(context, packageName);
|
||||
|
||||
|
@ -79,7 +80,12 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub {
|
|||
i.putExtra(AccountManager.KEY_ACCOUNT_TYPE, account.type);
|
||||
i.putExtra(AccountManager.KEY_ACCOUNT_NAME, account.name);
|
||||
i.putExtra(AccountManager.KEY_AUTHTOKEN, scope);
|
||||
result.putParcelable(KEY_USER_RECOVERY_INTENT, i);
|
||||
if (notify) {
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(i);
|
||||
} else {
|
||||
result.putParcelable(KEY_USER_RECOVERY_INTENT, i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.microg.gms.gservices;
|
|||
import android.content.ContentProvider;
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.net.Uri;
|
||||
|
||||
public class GServicesProvider extends ContentProvider{
|
||||
|
@ -29,7 +30,9 @@ public class GServicesProvider extends ContentProvider{
|
|||
|
||||
@Override
|
||||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
|
||||
return null;
|
||||
MatrixCursor cursor = new MatrixCursor(new String[]{"name", "value"});
|
||||
cursor.addRow(new Object[]{"", null});
|
||||
return cursor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
27
src/org/microg/gms/people/service/PeopleServiceImpl.java
Normal file
27
src/org/microg/gms/people/service/PeopleServiceImpl.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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.people.service;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Binder;
|
||||
|
||||
import com.google.android.gms.people.internal.IPeopleService;
|
||||
|
||||
public class PeopleServiceImpl extends IPeopleService.Stub {
|
||||
public PeopleServiceImpl(Context context) {
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue