update:2020.11.13
fix:增加WiFi热点管控
add:
This commit is contained in:
2020-11-13 14:33:10 +08:00
parent 05b6974d06
commit fc826c656c
5 changed files with 72 additions and 7 deletions

View File

@@ -9,11 +9,11 @@ def releaseTime() {
} }
android { android {
compileSdkVersion 29 compileSdkVersion 30
defaultConfig { defaultConfig {
applicationId "com.jiaoguanyi.appstore" applicationId "com.jiaoguanyi.appstore"
minSdkVersion 20 minSdkVersion 20
targetSdkVersion 29 targetSdkVersion 30
// versionCode 105 // versionCode 105
// versionName "3.1.0"//测试jiaoguanyi.cn // versionName "3.1.0"//测试jiaoguanyi.cn
@@ -89,8 +89,9 @@ android {
} }
newl { newl {
flavorDimensions "default" flavorDimensions "default"
versionCode 161 versionCode 157
versionName "1.1.6" // versionCode 1028
versionName "1.1.7"
/*********************************极光推送************************************/ /*********************************极光推送************************************/
manifestPlaceholders = [ manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore", JPUSH_PKGNAME: "com.jiaoguanyi.appstore",

View File

@@ -4,6 +4,7 @@
package="com.mjsheng.myappstore" package="com.mjsheng.myappstore"
android:sharedUserId="android.uid.system"> android:sharedUserId="android.uid.system">
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<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" />
@@ -19,6 +20,7 @@
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!--静默安装权限--> <!--静默安装权限-->
<uses-permission <uses-permission
android:name="android.permission.INSTALL_PACKAGES" android:name="android.permission.INSTALL_PACKAGES"

View File

@@ -14,6 +14,8 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.net.ConnectivityManager;
import android.net.wifi.WifiManager;
import android.os.BatteryManager; import android.os.BatteryManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@@ -102,6 +104,9 @@ import org.lzh.framework.updatepluginlib.UpdateBuilder;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@@ -1705,7 +1710,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
if (setting_bht == 0) {//蓝牙总开关开启 if (setting_bht == 0) {//蓝牙总开关开启
String setting_context = data.optString("setting_context");// String setting_context = data.optString("setting_context");//
if (setting_bhtvideo == 0) { if (setting_bhtvideo == 0) {
if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ")&& !setting_context.equals("null")) { if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ") && !setting_context.equals("null")) {
Log.e("SystemSetting", "setting_context:" + setting_context); Log.e("SystemSetting", "setting_context:" + setting_context);
Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", setting_context); Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
} else { } else {
@@ -1721,8 +1726,53 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
} }
int setting_hotspot = changeNum(data.optInt("setting_hotspot"));//热点 //热点
boolean qch_hotspot_forbid_on = Settings.System.putInt(this.mContext.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库 // ConnectivityManager mConnectivityManager =(ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
// mConnectivityManager.stopTethering(ConnectivityManager.TETHERING_WIFI);
// try {
// Method method = mConnectivityManager.getClass().getMethod("stopTethering", Integer.TYPE);
// method.invoke(mConnectivityManager, 0);
// } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
// e.printStackTrace();
// }
// ConnectivityManager connManager = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
//
// Field iConnMgrField = null;
// try {
// iConnMgrField = connManager.getClass().getDeclaredField("mService");
// iConnMgrField.setAccessible(true);
// Object iConnMgr = iConnMgrField.get(connManager);
// Class<?> iConnMgrClass = Class.forName(iConnMgr.getClass().getName());
//
//// if(isEnable){
//// Method startTethering = iConnMgrClass.getMethod("startTethering", int.class, ResultReceiver.class, boolean.class,String.class);
//// startTethering.invoke(iConnMgr, 0, null, true,context.getPackageName());
//// }else{
// Method startTethering = iConnMgrClass.getMethod("stopTethering", int.class, String.class);
// startTethering.invoke(iConnMgr, 0, getPackageName());
//// }
//
// } catch (NoSuchFieldException e) {
// e.printStackTrace();
// } catch (NoSuchMethodException e) {
// e.printStackTrace();
// } catch (IllegalAccessException e) {
// e.printStackTrace();
// } catch (InvocationTargetException e) {
// e.printStackTrace();
// } catch (ClassNotFoundException e) {
// e.printStackTrace();
// }
int setting_hotspot = changeNum(data.optInt("setting_hotspot"));
if (setting_hotspot == 1) {
Intent intent = new Intent();
intent.setAction("qch_hotspot_close");
intent.setPackage("com.android.settings");
sendStickyBroadcast(intent);
}
boolean qch_hotspot_forbid_on = Settings.System.putInt(getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot); Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on); Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);

View File

@@ -393,6 +393,12 @@ public class MyJPushReceiver extends BroadcastReceiver {
} }
int setting_hotspot = changeNum(data.optInt("setting_hotspot"));//热点 int setting_hotspot = changeNum(data.optInt("setting_hotspot"));//热点
if (setting_hotspot == 1) {
Intent intent = new Intent();
intent.setAction("qch_hotspot_close");
intent.setPackage("com.android.settings");
this.mContext.sendStickyBroadcast(intent);
}
boolean qch_hotspot_forbid_on = Settings.System.putInt(this.mContext.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库 boolean qch_hotspot_forbid_on = Settings.System.putInt(this.mContext.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot); Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on); Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);

View File

@@ -1003,6 +1003,12 @@ public class InitJpushServer extends Service {
} }
int setting_hotspot = changeNum(data.optInt("setting_hotspot"));//热点 int setting_hotspot = changeNum(data.optInt("setting_hotspot"));//热点
if (setting_hotspot == 1) {
Intent intent = new Intent();
intent.setAction("qch_hotspot_close");
intent.setPackage("com.android.settings");
this.sendStickyBroadcast(intent);
}
boolean qch_hotspot_forbid_on = Settings.System.putInt(this.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库 boolean qch_hotspot_forbid_on = Settings.System.putInt(this.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot); Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on); Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);