mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-12-22 18:47:46 +01:00
Add new bits for auth/people api
This commit is contained in:
parent
93645ca68f
commit
7b74722c3d
2
extern/GmsApi
vendored
2
extern/GmsApi
vendored
@ -1 +1 @@
|
|||||||
Subproject commit fbe903fbcbcc27af3579c9b7b35c40b105224a01
|
Subproject commit 8d39059ce60908519a4642562c848d9da063e710
|
@ -28,7 +28,7 @@
|
|||||||
android:name="com.google.android.c2dm.permission.RECEIVE"
|
android:name="com.google.android.c2dm.permission.RECEIVE"
|
||||||
android:label="@string/perm_c2dm_receive_label"
|
android:label="@string/perm_c2dm_receive_label"
|
||||||
android:permissionGroup="android.permission-group.NETWORK"
|
android:permissionGroup="android.permission-group.NETWORK"
|
||||||
android:protectionLevel="dangerous"/>
|
android:protectionLevel="normal"/>
|
||||||
<permission
|
<permission
|
||||||
android:name="com.google.android.c2dm.permission.SEND"
|
android:name="com.google.android.c2dm.permission.SEND"
|
||||||
android:label="@string/perm_c2dm_send_label"
|
android:label="@string/perm_c2dm_send_label"
|
||||||
@ -275,6 +275,7 @@
|
|||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.microg.gms.auth.login.LoginActivity"
|
android:name="org.microg.gms.auth.login.LoginActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
@ -286,6 +287,7 @@
|
|||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.microg.gms.auth.AskPermissionActivity"
|
android:name="org.microg.gms.auth.AskPermissionActivity"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
@ -300,6 +302,11 @@
|
|||||||
android:name=".auth.TokenActivity"
|
android:name=".auth.TokenActivity"
|
||||||
android:exported="true"/>
|
android:exported="true"/>
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="org.microg.gms.auth.AccountContentProvider"
|
||||||
|
android:authorities="com.google.android.gms.auth.accounts"
|
||||||
|
android:exported="true"/>
|
||||||
|
|
||||||
<!-- Games -->
|
<!-- Games -->
|
||||||
|
|
||||||
<service
|
<service
|
||||||
|
@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013-2015 microG 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.auth;
|
||||||
|
|
||||||
|
import android.accounts.Account;
|
||||||
|
import android.accounts.AccountManager;
|
||||||
|
import android.content.ContentProvider;
|
||||||
|
import android.content.ContentValues;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.google.android.gms.R;
|
||||||
|
|
||||||
|
public class AccountContentProvider extends ContentProvider {
|
||||||
|
private static final String TAG = "GmsAuthProvider";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreate() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Bundle call(String method, String arg, Bundle extras) {
|
||||||
|
// FIXME: Restrict access!
|
||||||
|
if ("get_accounts".equals(method) && getContext().getString(R.string.google_account_type).equals(arg)) {
|
||||||
|
Bundle result = new Bundle();
|
||||||
|
result.putParcelableArray("accounts", AccountManager.get(getContext()).getAccountsByType(arg));
|
||||||
|
return result;
|
||||||
|
} else if ("clear_password".equals(method)) {
|
||||||
|
Account a = extras.getParcelable("clear_password");
|
||||||
|
AccountManager.get(getContext()).clearPassword(a);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
throw new UnsupportedOperationException(String.format("Unsupported method call %s(%s).", method, arg));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public String getType(Uri uri) {
|
||||||
|
return "text/plain";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Uri insert(Uri uri, ContentValues values) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delete(Uri uri, String selection, String[] selectionArgs) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
}
|
@ -31,6 +31,7 @@ import com.google.android.gms.common.data.DataHolder;
|
|||||||
import com.google.android.gms.common.internal.ICancelToken;
|
import com.google.android.gms.common.internal.ICancelToken;
|
||||||
import com.google.android.gms.people.internal.IPeopleCallbacks;
|
import com.google.android.gms.people.internal.IPeopleCallbacks;
|
||||||
import com.google.android.gms.people.internal.IPeopleService;
|
import com.google.android.gms.people.internal.IPeopleService;
|
||||||
|
import com.google.android.gms.people.model.AccountMetadata;
|
||||||
|
|
||||||
import org.microg.gms.common.NonCancelToken;
|
import org.microg.gms.common.NonCancelToken;
|
||||||
|
|
||||||
@ -48,13 +49,15 @@ public class PeopleServiceImpl extends IPeopleService.Stub {
|
|||||||
public void loadOwners(final IPeopleCallbacks callbacks, boolean var2, boolean var3, final String accountName, String var5, int sortOrder) {
|
public void loadOwners(final IPeopleCallbacks callbacks, boolean var2, boolean var3, final String accountName, String var5, int sortOrder) {
|
||||||
Log.d(TAG, "loadOwners: " + var2 + ", " + var3 + ", " + accountName + ", " + var5 + ", " + sortOrder);
|
Log.d(TAG, "loadOwners: " + var2 + ", " + var3 + ", " + accountName + ", " + var5 + ", " + sortOrder);
|
||||||
AccountManager accountManager = AccountManager.get(context);
|
AccountManager accountManager = AccountManager.get(context);
|
||||||
Bundle extras = new Bundle();
|
Bundle accountMetadata = new Bundle();
|
||||||
String accountType = context.getString(R.string.google_account_type);
|
String accountType = context.getString(R.string.google_account_type);
|
||||||
for (Account account : accountManager.getAccountsByType(accountType)) {
|
for (Account account : accountManager.getAccountsByType(accountType)) {
|
||||||
if (accountName == null || account.name.equals(accountName)) {
|
if (accountName == null || account.name.equals(accountName)) {
|
||||||
extras.putParcelable(account.name, null);
|
accountMetadata.putParcelable(account.name, new AccountMetadata());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Bundle extras = new Bundle();
|
||||||
|
extras.putBundle("account_metadata", accountMetadata);
|
||||||
try {
|
try {
|
||||||
DatabaseHelper databaseHelper = new DatabaseHelper(context);
|
DatabaseHelper databaseHelper = new DatabaseHelper(context);
|
||||||
DataHolder dataHolder = DataHolder.fromCursor(databaseHelper.getOwners(), 0, extras);
|
DataHolder dataHolder = DataHolder.fromCursor(databaseHelper.getOwners(), 0, extras);
|
||||||
|
Loading…
Reference in New Issue
Block a user