mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-12-24 03:35:50 +01:00
Add dummy TapAndPay service
This commit is contained in:
parent
ee8e5427c4
commit
6ba9bbb03b
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2013-2017 microG Project Team
|
||||
~ Copyright (C) 2013-2019 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.
|
||||
@ -90,7 +90,9 @@
|
||||
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
<uses-permission android:name="android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST" tools:ignore="ProtectedPermissions"/>
|
||||
<uses-permission
|
||||
android:name="android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST"
|
||||
tools:ignore="ProtectedPermissions"/>
|
||||
|
||||
<uses-sdk tools:overrideLibrary="
|
||||
com.takisoft.fix.support.v7.preference,
|
||||
@ -100,14 +102,14 @@
|
||||
android.arch.lifecycle.viewmodel,
|
||||
android.arch.core,
|
||||
android.support.v7.mediarouter,
|
||||
android.support.v7.palette" />
|
||||
android.support.v7.palette"/>
|
||||
|
||||
<application
|
||||
android:name="android.support.multidex.MultiDexApplication"
|
||||
android:allowBackup="false"
|
||||
android:extractNativeLibs="false"
|
||||
android:icon="@mipmap/ic_core_service_app"
|
||||
android:label="@string/gms_app_name"
|
||||
android:name="android.support.multidex.MultiDexApplication">
|
||||
android:label="@string/gms_app_name">
|
||||
<meta-data
|
||||
android:name="fake-signature"
|
||||
android:value="@string/fake_signature"/>
|
||||
@ -405,7 +407,7 @@
|
||||
|
||||
<service android:name="com.google.android.gms.cast.media.CastMediaRouteProviderService">
|
||||
<intent-filter>
|
||||
<action android:name="android.media.MediaRouteProviderService" />
|
||||
<action android:name="android.media.MediaRouteProviderService"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
@ -421,8 +423,8 @@
|
||||
<activity
|
||||
android:name="org.microg.gms.ui.SettingsActivity"
|
||||
android:icon="@mipmap/ic_microg_settings"
|
||||
android:roundIcon="@mipmap/ic_microg_settings"
|
||||
android:label="@string/gms_settings_name"
|
||||
android:roundIcon="@mipmap/ic_microg_settings"
|
||||
android:theme="@style/Theme.AppCompat.Settings.Dashboard">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
@ -438,16 +440,23 @@
|
||||
<!-- microG Settings embedded in System Settings on SDK 23 and newer -->
|
||||
<activity-alias
|
||||
android:name="org.microg.gms.ui.SettingsActivityLink"
|
||||
android:targetActivity="org.microg.gms.ui.SettingsActivity"
|
||||
android:icon="@drawable/microg_light_color_24"
|
||||
android:label="@string/gms_settings_name"
|
||||
android:targetActivity="org.microg.gms.ui.SettingsActivity"
|
||||
android:theme="@style/Theme.AppCompat.Settings.Dashboard">
|
||||
<intent-filter>
|
||||
<action android:name="com.android.settings.action.EXTRA_SETTINGS"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="com.android.settings.category" android:value="com.android.settings.category.device"/>
|
||||
<meta-data android:name="com.android.settings.icon" android:resource="@drawable/microg_light_color_24"/>
|
||||
<meta-data android:name="com.android.settings.summary" android:resource="@string/gms_settings_summary"/>
|
||||
|
||||
<meta-data
|
||||
android:name="com.android.settings.category"
|
||||
android:value="com.android.settings.category.device"/>
|
||||
<meta-data
|
||||
android:name="com.android.settings.icon"
|
||||
android:resource="@drawable/microg_light_color_24"/>
|
||||
<meta-data
|
||||
android:name="com.android.settings.summary"
|
||||
android:resource="@string/gms_settings_summary"/>
|
||||
</activity-alias>
|
||||
|
||||
<activity
|
||||
@ -627,6 +636,11 @@
|
||||
<action android:name="com.google.android.gms.wallet.service.BIND"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
<service android:name="org.microg.gms.tapandpay.TapAndPayService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.gms.tapandpay.service.BIND"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service android:name="org.microg.gms.cast.CastDeviceControllerService">
|
||||
<intent-filter>
|
||||
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2019 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.tapandpay;
|
||||
|
||||
import com.google.android.gms.tapandpay.internal.ITapAndPayService;
|
||||
import android.os.Parcel;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
public class TapAndPayImpl extends ITapAndPayService.Stub {
|
||||
private static final String TAG = "GmsTapAndPayImpl";
|
||||
|
||||
@Override
|
||||
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
|
||||
if (super.onTransact(code, data, reply, flags)) return true;
|
||||
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2019 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.tapandpay;
|
||||
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.google.android.gms.common.api.CommonStatusCodes;
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
import org.microg.gms.BaseService;
|
||||
import org.microg.gms.common.GmsService;
|
||||
|
||||
public class TapAndPayService extends BaseService {
|
||||
public TapAndPayService() {
|
||||
super("GmsTapAndPaySvc", GmsService.TAP_AND_PAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException {
|
||||
callback.onPostInitComplete(CommonStatusCodes.SUCCESS, new TapAndPayImpl(), null);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (C) 2019 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.wearable;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.google.android.gms.common.api.CommonStatusCodes;
|
||||
import com.google.android.gms.common.data.DataHolder;
|
||||
import com.google.android.gms.wearable.Node;
|
||||
import com.google.android.gms.wearable.WearableStatusCodes;
|
||||
import com.google.android.gms.wearable.internal.NodeParcelable;
|
||||
|
||||
import org.microg.gms.common.PackageUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class CapabilityManager {
|
||||
private static final Uri ROOT = Uri.parse("wear:/capabilities/");
|
||||
private final Context context;
|
||||
private final WearableImpl wearable;
|
||||
private final String packageName;
|
||||
|
||||
private Set<String> capabilities = new HashSet<String>();
|
||||
|
||||
public CapabilityManager(Context context, WearableImpl wearable, String packageName) {
|
||||
this.context = context;
|
||||
this.wearable = wearable;
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
private Uri buildCapabilityUri(String capability, boolean withAuthority) {
|
||||
Uri.Builder builder = ROOT.buildUpon();
|
||||
if (withAuthority) builder.authority(wearable.getLocalNodeId());
|
||||
builder.appendPath(packageName);
|
||||
builder.appendPath(PackageUtils.firstSignatureDigest(context, packageName));
|
||||
builder.appendPath(Uri.encode(capability));
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public Set<String> getNodesForCapability(String capability) {
|
||||
DataHolder dataHolder = wearable.getDataItemsByUriAsHolder(buildCapabilityUri(capability, false), packageName);
|
||||
Set<String> nodes = new HashSet<>();
|
||||
for (int i = 0; i < dataHolder.getCount(); i++) {
|
||||
nodes.add(dataHolder.getString("host", i, 0));
|
||||
}
|
||||
dataHolder.close();
|
||||
return nodes;
|
||||
}
|
||||
|
||||
public int add(String capability) {
|
||||
if (this.capabilities.contains(capability)) {
|
||||
return WearableStatusCodes.DUPLICATE_CAPABILITY;
|
||||
}
|
||||
DataItemInternal dataItem = new DataItemInternal(buildCapabilityUri(capability, true));
|
||||
DataItemRecord record = wearable.putDataItem(packageName, PackageUtils.firstSignatureDigest(context, packageName), wearable.getLocalNodeId(), dataItem);
|
||||
this.capabilities.add(capability);
|
||||
wearable.syncRecordToAll(record);
|
||||
return CommonStatusCodes.SUCCESS;
|
||||
}
|
||||
|
||||
public int remove(String capability) {
|
||||
if (!this.capabilities.contains(capability)) {
|
||||
return WearableStatusCodes.UNKNOWN_CAPABILITY;
|
||||
}
|
||||
wearable.deleteDataItems(buildCapabilityUri(capability, true), packageName);
|
||||
capabilities.remove(capability);
|
||||
return CommonStatusCodes.SUCCESS;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user