update:2020.05.23

fix:10.0网络问题,设备号获取问题
add:
This commit is contained in:
2020-05-23 17:49:46 +08:00
parent f037e1cb12
commit 12172e6706
23 changed files with 61 additions and 68 deletions

14
.gitignore vendored Normal file
View File

@@ -0,0 +1,14 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx

View File

@@ -15,13 +15,13 @@ android {
applicationId "com.info.sn" applicationId "com.info.sn"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 28 targetSdkVersion 28
versionCode 18 versionCode 19
versionName "1.1.8" versionName "1.1.9"
multiDexEnabled true multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk { ndk {
//选择要添加的对应 cpu 类型的 .so 库。 //选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a' abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a',"x86"
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64' // 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
} }
manifestPlaceholders = [ manifestPlaceholders = [

View File

@@ -2,7 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.info.sn"> package="com.info.sn">
<uses-permission android:name="android.permission.ACTION_SCREEN_ON" /> <uses-permission android:name="android.permission.ACTION_SCREEN_ON" />
<uses-permission android:name="android.permission.ACTION_SCREEN_OFF" /> <uses-permission android:name="android.permission.ACTION_SCREEN_OFF" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.INSTALL_PACKAGES" />
@@ -11,7 +10,8 @@
<uses-permission android:name="android.permission.WRITE_SETTINGS" /> <uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" /> <uses-permission android:name="android.permission.DELETE_PACKAGES" />
<uses-permission android:name="android.permission.MASTER_CLEAR" /> <uses-permission android:name="android.permission.MASTER_CLEAR" />
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" /> <!-- 系统权限,有系统签名可以使用 --> <uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
<!-- 系统权限,有系统签名可以使用 -->
<!-- Required --> <!-- Required -->
<permission <permission
@@ -36,6 +36,8 @@
android:name=".MyApplication" android:name=".MyApplication"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher"
android:networkSecurityConfig="@xml/network"
android:label="@string/app_name" android:label="@string/app_name"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">

View File

@@ -156,7 +156,7 @@ public class MainActivity extends AppCompatActivity {
mHits[mHits.length - 1] = SystemClock.uptimeMillis(); mHits[mHits.length - 1] = SystemClock.uptimeMillis();
if (mHits[0] >= (SystemClock.uptimeMillis() - DURATION)) { if (mHits[0] >= (SystemClock.uptimeMillis() - DURATION)) {
mHits = new long[COUNTS];//重新初始化数组 mHits = new long[COUNTS];//重新初始化数组
Toast.makeText(this, "正在检查更新", Toast.LENGTH_SHORT).show(); ToastUtil.show("正在检查更新");
HTTPInterface.checkUpdateByself(handler, this.getPackageName(), String.valueOf(BuildConfig.VERSION_CODE)); HTTPInterface.checkUpdateByself(handler, this.getPackageName(), String.valueOf(BuildConfig.VERSION_CODE));
} }
} }
@@ -189,7 +189,7 @@ public class MainActivity extends AppCompatActivity {
public void exit() { public void exit() {
if ((System.currentTimeMillis() - mExitTime) > 2000) { if ((System.currentTimeMillis() - mExitTime) > 2000) {
Toast.makeText(MainActivity.this, "再按一次退出程序", Toast.LENGTH_SHORT).show(); ToastUtil.show("再按一次退出程序");
mExitTime = System.currentTimeMillis(); mExitTime = System.currentTimeMillis();
} else { } else {
finish(); finish();

View File

@@ -486,7 +486,9 @@ public class MyApplication extends Application {
ToastUtil.show("设备取消绑定"); ToastUtil.show("设备取消绑定");
dialog.dismiss(); dialog.dismiss();
} }
}).show(); });
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
dialog.show();
// AlertDialog.Builder builder = new AlertDialog.Builder(this) // AlertDialog.Builder builder = new AlertDialog.Builder(this)
// .setTitle("设备绑定") // .setTitle("设备绑定")
// .setIcon(R.mipmap.ic_launcher) // .setIcon(R.mipmap.ic_launcher)

View File

@@ -76,7 +76,7 @@ public class ApkUtils {
Intent intent = context.getPackageManager().getLaunchIntentForPackage((String) view.getTag(R.string.download_btn_had)); Intent intent = context.getPackageManager().getLaunchIntentForPackage((String) view.getTag(R.string.download_btn_had));
context.startActivity(intent); context.startActivity(intent);
} catch (Exception e) { } catch (Exception e) {
Toast.makeText(context, R.string.open_app_fail, Toast.LENGTH_LONG).show(); ToastUtil.show(String.valueOf(R.string.open_app_fail));
} }
return; return;
} }
@@ -275,12 +275,12 @@ public class ApkUtils {
public void onNext(Integer value) { public void onNext(Integer value) {
if (value == 2) { if (value == 2) {
//安装成功 //安装成功
Utils.showToast(context, "安装成功"); ToastUtil.show("安装成功");
Log.e("fanhuitong", "-----------安装成功-----------"); Log.e("fanhuitong", "-----------安装成功-----------");
} else { } else {
//安装错误 //安装错误
Log.e("fanhuitong", "------------安装错误-----------"); Log.e("fanhuitong", "------------安装错误-----------");
Utils.showToast(context, "安装失败"); ToastUtil.show("安装失败");
} }
} }
@@ -336,6 +336,7 @@ public class ApkUtils {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static boolean installApp(Context context, String apkPath) { public static boolean installApp(Context context, String apkPath) {
ToastUtil.show("正在安装应用..."); ToastUtil.show("正在安装应用...");
Process process = null; Process process = null;
@@ -464,6 +465,7 @@ public class ApkUtils {
} }
return name; return name;
} }
public static void installApk(Activity activity, File newApkFile) { public static void installApk(Activity activity, File newApkFile) {
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addCategory(Intent.CATEGORY_DEFAULT);
@@ -479,7 +481,8 @@ public class ApkUtils {
intent.setDataAndType(uri, type); intent.setDataAndType(uri, type);
activity.startActivity(intent); activity.startActivity(intent);
} }
public static void installApk(Context context, File newApkFile) {
public static void installApk(Context context, File newApkFile) {
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

View File

@@ -49,13 +49,13 @@ public class ToastUtil {
static Toast debugToast; static Toast debugToast;
public static void debugShow(final String msg) { public static void debugShow(final String msg) {
mainHandler.post(new Runnable() { debugHandler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
if (BuildConfig.LOG_DEBUG) { if (BuildConfig.LOG_DEBUG) {
if (toast != null) { if (debugToast != null) {
toast.setText(msg); debugToast.setText(msg);
toast.show(); debugToast.show();
} }
} }
} }

View File

@@ -48,6 +48,7 @@ import java.io.FileReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.LineNumberReader; import java.io.LineNumberReader;
import java.io.Reader; import java.io.Reader;
import java.lang.reflect.Method;
import java.net.NetworkInterface; import java.net.NetworkInterface;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
@@ -408,14 +409,14 @@ public class Utils {
public static void unInstallAPP(Context context, String packageName) { public static void unInstallAPP(Context context, String packageName) {
if (!TextUtils.isEmpty(packageName) && !AppsManagerUtils.isSystemApp(context, packageName)) { if (!TextUtils.isEmpty(packageName) && !AppsManagerUtils.isSystemApp(context, packageName)) {
if (AppsManagerUtils.isSystemApp(context, packageName)) { if (AppsManagerUtils.isSystemApp(context, packageName)) {
Toast.makeText(MyApplication.getAppContext(), "系统应用无法卸载!", Toast.LENGTH_SHORT).show(); ToastUtil.show("系统应用无法卸载!");
} else { } else {
Uri packageURI = Uri.parse("package:" + packageName); Uri packageURI = Uri.parse("package:" + packageName);
Intent intent = new Intent(Intent.ACTION_DELETE, packageURI); Intent intent = new Intent(Intent.ACTION_DELETE, packageURI);
context.startActivity(intent); context.startActivity(intent);
} }
} else { } else {
Toast.makeText(MyApplication.getAppContext(), "系统应用无法卸载!", Toast.LENGTH_SHORT).show(); ToastUtil.show("系统应用无法卸载!");
} }
} }
@@ -688,11 +689,24 @@ public class Utils {
* *
* @return * @return
*/ */
@SuppressLint({"MissingPermission", "NewApi"})
public static String getSerial() { public static String getSerial() {
return Build.SERIAL; String serial = "unknow";
// return "QNS3AI000111"; try {
// return "QNW8WJ900002"; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+
serial = Build.getSerial();
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {//8.0+
serial = Build.SERIAL;
} else {//8.0-
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class);
serial = (String) get.invoke(c, "ro.serialno");
}
} catch (Exception e) {
e.printStackTrace();
Log.e("e", "读取设备序列号异常:" + e.toString());
}
return serial;
} }
public static final long A_GB = 1073741824; public static final long A_GB = 1073741824;
@@ -860,5 +874,4 @@ public class Utils {
} }
} }

View File

@@ -67,7 +67,6 @@ public class CustomDialog extends Dialog {
setContentView(R.layout.custom_dialog); setContentView(R.layout.custom_dialog);
//按空白处不能取消动画 //按空白处不能取消动画
setCanceledOnTouchOutside(false); setCanceledOnTouchOutside(false);
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
//初始化界面控件 //初始化界面控件
initView(); initView();
//初始化界面数据 //初始化界面数据

View File

@@ -1,34 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>