Skip to content

Commit 2495212

Browse files
committed
+ 支持app内安装更新apk
1 parent 5a27c40 commit 2495212

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
<uses-permission android:name="android.permission.INTERNET"/>
77
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
88
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
9+
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
910

1011
<application
12+
android:name="com.surcumference.fingerprint.XApplication"
1113
android:allowBackup="true"
1214
android:icon="@mipmap/ic_launcher"
1315
android:label="@string/app_name"
@@ -40,6 +42,15 @@
4042
android:name=".util.XPreferenceProvider"
4143
android:authorities="com.surcumference.fingerprintpay.XPreferenceProvider"
4244
android:exported="true"/>
45+
<provider
46+
android:name="android.support.v4.content.FileProvider"
47+
android:authorities="com.surcumference.fingerprintpay.fileprovider"
48+
android:exported="false"
49+
android:grantUriPermissions="true">
50+
<meta-data
51+
android:name="android.support.FILE_PROVIDER_PATHS"
52+
android:resource="@xml/file_paths" />
53+
</provider>
4354

4455
<activity-alias
4556
android:enabled="true"

app/src/main/java/com/surcumference/fingerprint/Constant.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class Constant {
1414
public static final String AUTHORITY_ALIPAY = "com.eg.android.AlipayGphone.asUpgradeFileProvider";
1515
public static final String AUTHORITY_TAOBAO = "com.taobao.taobao.interactProvider";
1616
public static final String AUTHORITY_QQ = "com.tencent.mobileqq.fileprovider";
17+
public static final String AUTHORITY_FINGERPRINT_PAY = BuildConfig.APPLICATION_ID + ".fileprovider";
1718
public static final String HELP_URL_WECHAT = "https://github.com/eritpchy/Xposed-Fingerprint-pay/blob/master/doc/WeChat/README.md";
1819
public static final String HELP_URL_ALIPAY = "https://github.com/eritpchy/Xposed-Fingerprint-pay/blob/master/doc/Alipay/README.md";
1920
public static final String HELP_URL_TAOBAO = "https://github.com/eritpchy/Xposed-Fingerprint-pay/blob/master/doc/Taobao/README.md";
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.surcumference.fingerprint;
2+
3+
import android.app.Application;
4+
import android.content.Context;
5+
6+
import com.surcumference.fingerprint.bean.PluginType;
7+
import com.surcumference.fingerprint.plugin.PluginApp;
8+
9+
public class XApplication extends Application {
10+
11+
@Override
12+
protected void attachBaseContext(Context base) {
13+
super.attachBaseContext(base);
14+
PluginApp.setup(PluginType.Xposed, null);
15+
}
16+
}

app/src/main/java/com/surcumference/fingerprint/util/FileUtils.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.support.v4.content.FileProvider;
66
import android.text.TextUtils;
77

8+
import com.surcumference.fingerprint.BuildConfig;
89
import com.surcumference.fingerprint.Constant;
910
import com.surcumference.fingerprint.util.log.L;
1011

@@ -120,6 +121,8 @@ public static String getAuthorityForPackage(String packageName) {
120121
return Constant.AUTHORITY_TAOBAO;
121122
} else if (Constant.PACKAGE_NAME_WECHAT.equals(packageName)) {
122123
return Constant.AUTHORITY_WECHAT;
124+
} else if (BuildConfig.APPLICATION_ID.equals(packageName)) {
125+
return Constant.AUTHORITY_FINGERPRINT_PAY;
123126
} else {
124127
throw new RuntimeException("getAuthorityForPackage package:" + packageName + " is not support yet");
125128
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<paths>
3+
<files-path name="files" path="." />
4+
<cache-path name="cache" path="." />
5+
<external-path name="external" path="." />
6+
<external-files-path name="external-files" path="." />
7+
<external-cache-path name="external-cache" path="." />
8+
</paths>

0 commit comments

Comments
 (0)