version:3.3.3
fix: update:优化网络连接
This commit is contained in:
@@ -74,8 +74,8 @@ android {
|
||||
|
||||
official {
|
||||
flavorDimensions "default"
|
||||
versionCode 63
|
||||
versionName "3.2.3"
|
||||
versionCode 73
|
||||
versionName "3.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,9 +179,39 @@ android {
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
Huaruian8768 {
|
||||
storeFile file("keystore/Huaruian8768.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "Huaruian8768"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
Huaruian8768Debug.initWith(debug)
|
||||
Huaruian8768Debug {
|
||||
manifestPlaceholders = [
|
||||
AK: "7IubK1Ugeuxga4KKC5VQyjTeQlExsYZq"
|
||||
]
|
||||
buildConfigField "String", "platform", '"G10J"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.Huaruian8768
|
||||
}
|
||||
|
||||
Huaruian8768Release.initWith(release)
|
||||
Huaruian8768Release {
|
||||
manifestPlaceholders = [
|
||||
AK: "7IubK1Ugeuxga4KKC5VQyjTeQlExsYZq"
|
||||
]
|
||||
buildConfigField "String", "platform", '"G10J"'
|
||||
signingConfig signingConfigs.Huaruian8768
|
||||
}
|
||||
|
||||
iPlay50SEDebug.initWith(debug)
|
||||
iPlay50SEDebug {
|
||||
manifestPlaceholders = [
|
||||
@@ -485,7 +515,7 @@ dependencies {
|
||||
//bugly
|
||||
implementation 'com.tencent.bugly:crashreport:4.1.9.2'
|
||||
//腾讯移动推送 TPNS
|
||||
implementation 'com.tencent.tpns:tpns:1.4.3.4-release'
|
||||
implementation 'com.tencent.tpns:tpns:1.4.4.2-release'
|
||||
//百度地图
|
||||
implementation 'com.baidu.lbsyun:BaiduMapSDK_Location:9.1.8'
|
||||
//工具类
|
||||
|
||||
BIN
app/keystore/Huaruian8768.jks
Normal file
BIN
app/keystore/Huaruian8768.jks
Normal file
Binary file not shown.
@@ -12,7 +12,7 @@ import com.fuying.sn.activity.main.MainActivity;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
private static String TAG = SplashActivity.class.getSimpleName();
|
||||
private static final String TAG = "SplashActivity";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
@@ -25,7 +25,7 @@ import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
* @author jgy02
|
||||
*/
|
||||
public class MainAPresenter implements MainAContact.Presenter {
|
||||
private static final String TAG = MainAPresenter.class.getSimpleName();
|
||||
private static final String TAG = "MainAPresenter";
|
||||
|
||||
private MainAContact.MainView mView;
|
||||
private Context mContext;
|
||||
|
||||
@@ -66,7 +66,7 @@ import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class MainActivity extends BaseActivity implements MainAContact.MainView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private static final String TAG = MainActivity.class.getSimpleName();
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
@BindView(R.id.tv_exit)
|
||||
TextView tv_exit;
|
||||
@@ -220,6 +220,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
@Override
|
||||
protected void onPostExecute(Long aLong) {
|
||||
super.onPostExecute(aLong);
|
||||
SystemClock.setCurrentTimeMillis(aLong);
|
||||
Log.e(TAG, "getTimeFromNtpServer: " + aLong);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseApplication extends Application {
|
||||
private static final String TAG = BaseApplication.class.getSimpleName();
|
||||
private static final String TAG = "BaseApplication";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
|
||||
58
app/src/main/java/com/fuying/sn/base/rx/BaseRxService.java
Normal file
58
app/src/main/java/com/fuying/sn/base/rx/BaseRxService.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.fuying.sn.base.rx;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.annotation.CheckResult;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.LifecycleTransformer;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
public abstract class BaseRxService extends Service implements LifecycleProvider<ActivityEvent> {
|
||||
private final BehaviorSubject<ActivityEvent> lifecycleSubject = BehaviorSubject.create();
|
||||
|
||||
public BehaviorSubject<ActivityEvent> getLifecycleSubject() {
|
||||
return lifecycleSubject;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final Observable<ActivityEvent> lifecycle() {
|
||||
return lifecycleSubject.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull ActivityEvent event) {
|
||||
return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final <T> LifecycleTransformer<T> bindToLifecycle() {
|
||||
return RxLifecycleAndroid.bindActivity(lifecycleSubject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
lifecycleSubject.onNext(ActivityEvent.CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
lifecycleSubject.onNext(ActivityEvent.DESTROY);
|
||||
}
|
||||
}
|
||||
18
app/src/main/java/com/fuying/sn/bean/BlacklistBean.java
Normal file
18
app/src/main/java/com/fuying/sn/bean/BlacklistBean.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.fuying.sn.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class BlacklistBean implements Serializable {
|
||||
private static final long serialVersionUID = 1686627090518410825L;
|
||||
|
||||
List<String> blacklist;
|
||||
|
||||
public List<String> getBlacklist() {
|
||||
return blacklist;
|
||||
}
|
||||
|
||||
public void setBlacklist(List<String> blacklist) {
|
||||
this.blacklist = blacklist;
|
||||
}
|
||||
}
|
||||
@@ -4,19 +4,19 @@ public class CommonConfig {
|
||||
public static final String MMKV_ID = "InterProcessKV";
|
||||
|
||||
/*首次开机*/
|
||||
public final static String JGY_FIRST_BOOT = "first_boot";
|
||||
public static final String JGY_FIRST_BOOT = "first_boot";
|
||||
/*保存的应用版本号*/
|
||||
public final static String SN_VERSIONCODE = "SN_VERSIONCODE";
|
||||
public static final String SN_VERSIONCODE = "SN_VERSIONCODE";
|
||||
/*首次连接*/
|
||||
public final static String JGY_FIRST_CONNECT = "first_connect";
|
||||
public static final String JGY_FIRST_CONNECT = "first_connect";
|
||||
/*后台的白名单*/
|
||||
public final static String ONLY_SHORTCUT_LIST = "only_jgy_shortcut_list";
|
||||
public static final String ONLY_SHORTCUT_LIST = "only_jgy_shortcut_list";
|
||||
/*获取设备的标签*/
|
||||
public final static String DEVICES_TAG = "DEVICES_TAG";
|
||||
public static final String DEVICES_TAG = "DEVICES_TAG";
|
||||
/*默认桌面key*/
|
||||
public final static String DESKTOP_APP_KEY = "desktop_app_key";
|
||||
public final static String BROWSER_APP_KEY = "browser_app_key";
|
||||
public final static String TYPEWRITING_APP_KEY = "typewriting_app_key";
|
||||
public static final String DESKTOP_APP_KEY = "desktop_app_key";
|
||||
public static final String BROWSER_APP_KEY = "browser_app_key";
|
||||
public static final String TYPEWRITING_APP_KEY = "typewriting_app_key";
|
||||
|
||||
public static final String isLogined = "isLogined";
|
||||
public static final String AES_KEY = "0123456789ABCDEF";
|
||||
@@ -32,71 +32,83 @@ public class CommonConfig {
|
||||
|
||||
public static final String DEVICES_IS_BIND_KEY = "is_bind_state";
|
||||
|
||||
/**
|
||||
* 设备重启标志 重启后请求接口,Service重启不请求
|
||||
*/
|
||||
public final static String DEVICES_REBOOT = "device_reboot_mark";
|
||||
|
||||
/**
|
||||
* 管控系统指令
|
||||
*/
|
||||
|
||||
/*USB模式-充电*/
|
||||
public final static String AOLE_ACTION_USB_USB_CHARGE = "aole_action_usb_usb_charge";
|
||||
public static final String AOLE_ACTION_USB_USB_CHARGE = "aole_action_usb_usb_charge";
|
||||
/*USB模式-MTP*/
|
||||
public final static String AOLE_ACTION_USB_USB_MTP = "aole_action_usb_usb_mtp";
|
||||
public static final String AOLE_ACTION_USB_USB_MTP = "aole_action_usb_usb_mtp";
|
||||
/*USB模式-MIDI*/
|
||||
public final static String AOLE_ACTION_USB_USB_MIDI = "aole_action_usb_usb_midi";
|
||||
public static final String AOLE_ACTION_USB_USB_MIDI = "aole_action_usb_usb_midi";
|
||||
/*投屏开关*/
|
||||
public final static String AOLE_ACTION_SCREEN_SHARE = "aole_app_screen_share";
|
||||
public static final String AOLE_ACTION_SCREEN_SHARE = "aole_app_screen_share";
|
||||
/*内部白名单*/
|
||||
public static final String AOLE_APP_WEB_WHITE_LIST = "app_web_white_list";
|
||||
/*内部黑名单*/
|
||||
public final static String AOLE_APP_WEB_WHITE_LIST = "app_web_white_list";
|
||||
public static final String AOLE_APP_WEB_BLACK_LIST = "app_web_black_list";
|
||||
/*应用安装白名单*/
|
||||
public final static String AOLE_ACTION_APP_FORBID = "aole_app_forbid";
|
||||
public static final String AOLE_ACTION_APP_FORBID = "aole_app_forbid";
|
||||
/*指定应用安装源 非指定包名不能安装apk*/
|
||||
public static final String APP_SOURCE_WHITE_LIST = "app_source_white_list";
|
||||
/*强制安装应用,禁止卸载*/
|
||||
public final static String AOLE_ACTION_FORCE_APP = "aole_force_app";
|
||||
public static final String AOLE_ACTION_FORCE_APP = "aole_force_app";
|
||||
/*禁止升级的应用列表*/
|
||||
public final static String AOLE_ACTION_DISALLOW_UPGRADE = "upgrade_disallow";
|
||||
public static final String AOLE_ACTION_DISALLOW_UPGRADE = "upgrade_disallow";
|
||||
/*全局 更新获取的包名*/
|
||||
public final static String AOLE_ACTION_OVERALL_APP = "overall_app_packages";
|
||||
public static final String AOLE_ACTION_OVERALL_APP = "overall_app_packages";
|
||||
|
||||
/*应用ID管控*/
|
||||
public final static String AOLE_ACTION_APP_FORBID_ID = "aole_app_forbid_id";
|
||||
public static final String AOLE_ACTION_APP_FORBID_ID = "aole_app_forbid_id";
|
||||
/*应用ID管控*/
|
||||
public final static String AOLE_ACTION_APP_FORBID_ARRAY = "DeselectViewArray";
|
||||
public static final String AOLE_ACTION_APP_FORBID_ARRAY = "DeselectViewArray";
|
||||
|
||||
/*禁止应用滑动*/
|
||||
public final static String AOLE_ACTION_DISABLE_SLIDE = "aole_disable_slide";
|
||||
public static final String AOLE_ACTION_DISABLE_SLIDE = "aole_disable_slide";
|
||||
/*开机自启应用*/
|
||||
public final static String AOLE_ACTION_APP_POWER_ON = "aole_app_power_on";
|
||||
public static final String AOLE_ACTION_APP_POWER_ON = "aole_app_power_on";
|
||||
|
||||
/*禁止联网应用*/
|
||||
public final static String AOLE_ACTION_NETWORK_DISALLOW = "aole_network_disallow";
|
||||
@Deprecated
|
||||
public static final String AOLE_ACTION_NETWORK_DISALLOW = "aole_network_disallow";
|
||||
/*允许联网应用*/
|
||||
public final static String AOLE_ACTION_NETWORK_ALLOW = "aole_network_allow";
|
||||
@Deprecated
|
||||
public static final String AOLE_ACTION_NETWORK_ALLOW = "aole_network_allow";
|
||||
|
||||
|
||||
/*存储卡管控*/
|
||||
public final static String AOLE_ACTION_SDCARD_FORBID_ON = "aole_sdcard_forbid_on";
|
||||
public static final String AOLE_ACTION_SDCARD_FORBID_ON = "aole_sdcard_forbid_on";
|
||||
/*开发者选项管控*/
|
||||
public final static String AOLE_ACTION_DEVELOPER_OPTIONS = "aole_Developeroptions";
|
||||
public static final String AOLE_ACTION_DEVELOPER_OPTIONS = "aole_Developeroptions";
|
||||
/*显示导航栏*/
|
||||
public final static String AOLE_ACTION_SHOW_NAVIGATION_BAR = "aole_show_NavigationBar";
|
||||
public static final String AOLE_ACTION_SHOW_NAVIGATION_BAR = "aole_show_NavigationBar";
|
||||
/*隐藏导航栏*/
|
||||
public final static String AOLE_ACTION_HIDE_NAVIGATION_BAR = "aole_hide_NavigationBar";
|
||||
public static final String AOLE_ACTION_HIDE_NAVIGATION_BAR = "aole_hide_NavigationBar";
|
||||
/*显示状态栏*/
|
||||
public final static String AOLE_ACTION_SHOW_STATUS_BAR = "aole_show_statusBar";
|
||||
public static final String AOLE_ACTION_SHOW_STATUS_BAR = "aole_show_statusBar";
|
||||
/*隐藏状态栏*/
|
||||
public final static String AOLE_ACTION_HIDE_STATUS_BAR = "aole_hide_statusBar";
|
||||
public static final String AOLE_ACTION_HIDE_STATUS_BAR = "aole_hide_statusBar";
|
||||
/*热点*/
|
||||
public final static String AOLE_ACTION_HOTSPOT_FORBID_ON = "aole_hotspot_forbid_on";
|
||||
public static final String AOLE_ACTION_HOTSPOT_FORBID_ON = "aole_hotspot_forbid_on";
|
||||
/*蓝牙总开关*/
|
||||
public final static String AOLE_ACTION_BHT_FORBID_ON = "aole_bht_forbid_on";
|
||||
public static final String AOLE_ACTION_BHT_FORBID_ON = "aole_bht_forbid_on";
|
||||
/*蓝牙传输开关*/
|
||||
public final static String AOLE_ACTION_BT_FORBID_ON = "aole_bt_forbid_on";
|
||||
public static final String AOLE_ACTION_BT_FORBID_ON = "aole_bt_forbid_on";
|
||||
/*蓝牙音频开关*/
|
||||
public final static String AOLE_ACTION_BHTVIDEO_FORBID_ON = "aole_bhtvideo_forbid_on";
|
||||
public static final String AOLE_ACTION_BHTVIDEO_FORBID_ON = "aole_bhtvideo_forbid_on";
|
||||
/*电话白名单开关*/
|
||||
public final static String AOLE_ACTION_WHITE_LIST_ON = "aole_white_list_on";
|
||||
public static final String AOLE_ACTION_WHITE_LIST_ON = "aole_white_list_on";
|
||||
/*电话白名单列表*/
|
||||
public final static String AOLE_ACTION_WHITE_LIST_ARRAY = "aole_white_list_Array";
|
||||
public static final String AOLE_ACTION_WHITE_LIST_ARRAY = "aole_white_list_Array";
|
||||
/*恢复出厂设置开关*/
|
||||
public final static String AOLE_ACTION_RESTORE_FORBID_ON = "aole_restore_forbid_on";
|
||||
public static final String AOLE_ACTION_RESTORE_FORBID_ON = "aole_restore_forbid_on";
|
||||
/*WiFi白名单*/
|
||||
public final static String AOLE_ACTION_AOLE_SSID_WHITE_LIST = "aole_ssid_whiteList";
|
||||
public static final String AOLE_ACTION_AOLE_SSID_WHITE_LIST = "aole_ssid_whiteList";
|
||||
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
|
||||
|
||||
public class RunningAppManager {
|
||||
private static final String TAG = RunningAppManager.class.getSimpleName();
|
||||
private static final String TAG = "RunningAppManager";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static RunningAppManager mRunningAppManager;
|
||||
@@ -186,9 +186,24 @@ public class RunningAppManager {
|
||||
if ("org.chromium.browser".equals(topPackage)) {
|
||||
JGYUtils.getInstance().killPackage("org.chromium.browser");
|
||||
}
|
||||
Log.i(TAG, "checkForegroundAppName: topPackage = " + topPackage);
|
||||
String appPackageName = getAppPackageName();
|
||||
Log.d(TAG, "checkForegroundAppName: topPackage = " + topPackage);
|
||||
Log.d(TAG, "checkForegroundAppName: appPackageName = " + appPackageName);
|
||||
|
||||
if (!JGYUtils.getInstance().isScreenOn()) {
|
||||
if (!TextUtils.isEmpty(appPackageName)) {
|
||||
NetInterfaceManager.getInstance().sendCloseApp(appPackageName, new NetInterfaceManager.CompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
NetInterfaceManager.getInstance().getAppTimeControl();
|
||||
NetInterfaceManager.getInstance().getSnTimeControl();
|
||||
}
|
||||
});
|
||||
}
|
||||
mMMKV.encode(RUNNING_APP_PACKAGENAME, "");
|
||||
AppUsedTimeUtils.getInstance().setApp_package("");
|
||||
return;
|
||||
}
|
||||
if (allowPackage.contains(topPackage)) {//排除在外的包名都写入空值
|
||||
if (!TextUtils.isEmpty(appPackageName)) {
|
||||
if (!topPackage.equals(appPackageName)) {
|
||||
@@ -892,7 +907,9 @@ public class RunningAppManager {
|
||||
Log.e(TAG, "inControlTime: havaConfigure = " + havaConfigure);
|
||||
MachineControl machineControl = TimeControlManager.getInstance().getGlobalMachineControl();
|
||||
Log.e(TAG, "inControlTime: inControlTime = " + machineControl);
|
||||
|
||||
if (machineControl == null) {
|
||||
return false;
|
||||
}
|
||||
Log.e(TAG, "inControlTime: globalRemainingTime = " + globalRemainingTime);
|
||||
//整机额度开关
|
||||
int is_quota = machineControl.getIs_quota();
|
||||
@@ -1516,17 +1533,17 @@ public class RunningAppManager {
|
||||
for (PartTime partTime : partTimeHashSet) {
|
||||
if (inControlTime(partTime)) {
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private boolean inControlTime(PartTime partTime) {
|
||||
String startTime = partTime.getStart_time();
|
||||
String endTime = partTime.getEnd_time();
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TimeControlManager {
|
||||
private static final String TAG = TimeControlManager.class.getSimpleName();
|
||||
private static final String TAG = "TimeControlManager";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static TimeControlManager mTimeControlManager;
|
||||
@@ -125,6 +125,7 @@ public class TimeControlManager {
|
||||
AppTimeControl temp = mAppTimeControlMap.get(pkg);
|
||||
if (temp == null) {
|
||||
String jsonString = mCacheHelper.getAsString(UrlAddress.GET_APP_TIME_CONTROL);
|
||||
Log.e(TAG, "getAppTimeControl: jsonString = " + jsonString);
|
||||
//为 "" 是已经请求成功的
|
||||
if (jsonString == null) {
|
||||
return null;
|
||||
|
||||
@@ -105,7 +105,7 @@ public class CacheHelper {
|
||||
|
||||
public void put(String key, String value) {
|
||||
// Log.e(TAG, "put: key = " + key + " value = " + value);
|
||||
mMMKV.encode(key, System.currentTimeMillis());
|
||||
mMMKV.encode(key + "_time", System.currentTimeMillis());
|
||||
mMMKV.encode(key + "_mmkv", value);
|
||||
|
||||
DiskLruCache.Editor edit = null;
|
||||
|
||||
@@ -16,6 +16,8 @@ import com.fuying.sn.R;
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class AppletQRCodeFragment extends Fragment {
|
||||
private static final String TAG = "AppletQRCodeFragment";
|
||||
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
@@ -24,7 +26,6 @@ public class AppletQRCodeFragment extends Fragment {
|
||||
private String mParam2;
|
||||
|
||||
private ImageView qr_code;
|
||||
private String TAG = AppletQRCodeFragment.class.getSimpleName();
|
||||
|
||||
public AppletQRCodeFragment() {
|
||||
// Required empty public constructor
|
||||
|
||||
@@ -22,6 +22,8 @@ import com.fuying.sn.utils.Utils;
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class QRCodeFragment extends Fragment {
|
||||
private static final String TAG = "QRCodeFragment";
|
||||
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
@@ -30,7 +32,6 @@ public class QRCodeFragment extends Fragment {
|
||||
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
private String TAG = QRCodeFragment.class.getSimpleName();
|
||||
private View mView ;
|
||||
public QRCodeFragment() {
|
||||
// Required empty public constructor
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.baidu.location.LocationClientOption;
|
||||
import com.fuying.sn.utils.SPUtils;
|
||||
|
||||
public class AmapManager {
|
||||
private static final String TAG = AmapManager.class.getSimpleName();
|
||||
private static final String TAG = "AmapManager";
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static AmapManager sInstance;
|
||||
private Context mContext;
|
||||
|
||||
@@ -6,13 +6,13 @@ import android.util.Log;
|
||||
|
||||
import com.fuying.sn.config.CommonConfig;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.fuying.sn.utils.TimeUtils;
|
||||
|
||||
public class ConnectManager {
|
||||
private static final String TAG = ConnectManager.class.getSimpleName();
|
||||
private static final String TAG = "ConnectManager";
|
||||
|
||||
|
||||
public static final long ONE_MINUTES_TIME = 60 * 1000;
|
||||
public static final long ONE_SECOND_TIME = 1000;
|
||||
public static final long ONE_MINUTES_TIME = 60 * ONE_SECOND_TIME;
|
||||
public static final long FIFTEEN_MINUTES_TIME = ONE_MINUTES_TIME * 15;
|
||||
public static final long HALF_HOUR_TIME = FIFTEEN_MINUTES_TIME * 2;
|
||||
public static final long ONE_HOUR_TIME = HALF_HOUR_TIME * 2;
|
||||
@@ -92,7 +92,7 @@ public class ConnectManager {
|
||||
long lastTime = mMMKV.decodeLong(key, 0);
|
||||
long intervalTime = getConnectModeTime(connectMode);
|
||||
//防止一分钟内重复请求
|
||||
return nowTime - lastTime > intervalTime && nowTime - lastTime > ONE_MINUTES_TIME;
|
||||
return nowTime - lastTime > intervalTime && nowTime - lastTime > ONE_SECOND_TIME;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.function.Predicate;
|
||||
* @author jgy02
|
||||
*/
|
||||
public class ControlManager {
|
||||
private static final String TAG = ControlManager.class.getSimpleName();
|
||||
private static final String TAG = "ControlManager";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static ControlManager sInstance;
|
||||
@@ -201,7 +201,10 @@ public class ControlManager {
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
break;
|
||||
}
|
||||
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
||||
Intent usbIntent = new Intent(usbStatus);
|
||||
if (JGYUtils.getInstance().checkAppPlatform() != JGYUtils.G11JPlatform) {
|
||||
usbIntent.setPackage("com.android.settings");
|
||||
}
|
||||
// if (!BuildConfig.DEBUG)
|
||||
mContext.sendBroadcast(usbIntent);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.tencent.mmkv.MMKV;
|
||||
* 控制面板管理类
|
||||
*/
|
||||
public class ControlPanelManager {
|
||||
private static final String TAG = ControlPanelManager.class.getSimpleName();
|
||||
private static final String TAG = "ControlPanelManager";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static ControlPanelManager sInstance;
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.fuying.sn.utils.SPUtils;
|
||||
import com.fuying.sn.utils.ToastUtil;
|
||||
|
||||
public class DeviceManager {
|
||||
private static final String TAG = DeviceManager.class.getSimpleName();
|
||||
private static final String TAG = "DeviceManager";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static DeviceManager sInstance;
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.fuying.sn.bean.AppUploadInfo;
|
||||
import com.fuying.sn.bean.AppletQRCode;
|
||||
import com.fuying.sn.bean.BaseResponse;
|
||||
import com.fuying.sn.bean.BatchID;
|
||||
import com.fuying.sn.bean.BlacklistBean;
|
||||
import com.fuying.sn.bean.CloudLessonSetting;
|
||||
import com.fuying.sn.bean.Label;
|
||||
import com.fuying.sn.bean.MyAppUsageBean;
|
||||
@@ -54,6 +55,7 @@ import com.fuying.sn.network.api.AddAppInstall;
|
||||
import com.fuying.sn.network.api.AppTimeControlApi;
|
||||
import com.fuying.sn.network.api.AppUsageRecordApi;
|
||||
import com.fuying.sn.network.api.BindDevices;
|
||||
import com.fuying.sn.network.api.BlacklistApi;
|
||||
import com.fuying.sn.network.api.Browser;
|
||||
import com.fuying.sn.network.api.BrowserLabel;
|
||||
import com.fuying.sn.network.api.CloudLessonSettingApi;
|
||||
@@ -144,7 +146,7 @@ import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class NetInterfaceManager {
|
||||
private static final String TAG = NetInterfaceManager.class.getSimpleName();
|
||||
private static final String TAG = "NetInterfaceManager";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static NetInterfaceManager INSTANCE;
|
||||
@@ -441,6 +443,13 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<BlacklistBean>> getBlacklistObservable() {
|
||||
return mRetrofit.create(BlacklistApi.class)
|
||||
.getBlacklist()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<AppInfo>>> getAdminAppObservable() {
|
||||
return mRetrofit.create(GetAdminAppApi.class)
|
||||
.getAdminApp(Utils.getSerial())
|
||||
@@ -703,10 +712,12 @@ public class NetInterfaceManager {
|
||||
set.add(JGYUtils.MTK8515Tag);
|
||||
} else if (platform == JGYUtils.G13Platform) {
|
||||
set.add(JGYUtils.G13Tag);
|
||||
} else if (platform == JGYUtils.G6Platform) {
|
||||
set.add(JGYUtils.G6Tag);
|
||||
} else if (platform == JGYUtils.iPlay50SEPlatform) {
|
||||
set.add(JGYUtils.iPlay50SETag);
|
||||
} else if (platform == JGYUtils.G6Platform) {
|
||||
set.add(JGYUtils.G6Tag);
|
||||
} else if (platform == JGYUtils.G11JPlatform) {
|
||||
set.add(JGYUtils.G11JTag);
|
||||
}
|
||||
});
|
||||
clearAndAppendTags(set);
|
||||
@@ -728,10 +739,12 @@ public class NetInterfaceManager {
|
||||
set.add(JGYUtils.MTK8515Tag);
|
||||
} else if (platform == JGYUtils.G13Platform) {
|
||||
set.add(JGYUtils.G13Tag);
|
||||
} else if (platform == JGYUtils.G6Platform) {
|
||||
set.add(JGYUtils.G6Tag);
|
||||
} else if (platform == JGYUtils.iPlay50SEPlatform) {
|
||||
set.add(JGYUtils.iPlay50SETag);
|
||||
} else if (platform == JGYUtils.G6Platform) {
|
||||
set.add(JGYUtils.G6Tag);
|
||||
} else if (platform == JGYUtils.G11JPlatform) {
|
||||
set.add(JGYUtils.G11JTag);
|
||||
}
|
||||
});
|
||||
XGPushManager.clearAndAppendTags(mContext, "clearAndAppendTags :" + System.currentTimeMillis(), set, new XGIOperateCallback() {
|
||||
@@ -1585,41 +1598,41 @@ public class NetInterfaceManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void getAppStart(List<AppInfo> appInfoList) {
|
||||
getAppStartControl()
|
||||
.subscribe(new Observer<BaseResponse<List<AppStart>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAppStart", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppStart>> listBaseResponse) {
|
||||
Log.e("getAppStart", "onNext: " + listBaseResponse.data);
|
||||
int code = listBaseResponse.code;
|
||||
if (code == 200) {
|
||||
List<AppStart> list = listBaseResponse.data;
|
||||
setAppState(list);
|
||||
checkPackageAndVersion(list, appInfoList);
|
||||
} else {
|
||||
setInvalid();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAppStart", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppStart", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
// public void getAppStart(List<AppInfo> appInfoList) {
|
||||
// getAppStartControl()
|
||||
// .subscribe(new Observer<BaseResponse<List<AppStart>>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(@NonNull Disposable d) {
|
||||
// Log.e("getAppStart", "onSubscribe: ");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(@NonNull BaseResponse<List<AppStart>> listBaseResponse) {
|
||||
// Log.e("getAppStart", "onNext: " + listBaseResponse.data);
|
||||
// int code = listBaseResponse.code;
|
||||
// if (code == 200) {
|
||||
// List<AppStart> list = listBaseResponse.data;
|
||||
// setAppState(list);
|
||||
// checkPackageAndVersion(list, appInfoList);
|
||||
// } else {
|
||||
// setInvalid();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(@NonNull Throwable e) {
|
||||
// Log.e("getAppStart", "onError: " + e.getMessage());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// Log.e("getAppStart", "onComplete: ");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
public void setAppState(List<AppStart> list) {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "null");
|
||||
// Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "null");
|
||||
// setAppAutoStart( list);
|
||||
// setAppNetwork(list);
|
||||
setAppUpdate(list);
|
||||
@@ -1703,37 +1716,6 @@ public class NetInterfaceManager {
|
||||
}
|
||||
}
|
||||
|
||||
//应用联网管控
|
||||
private void setAppNetwork(List<AppStart> list) {
|
||||
String network_allow = "";
|
||||
String network_not = "";
|
||||
if (null != list && list.size() != 0) {
|
||||
for (AppStart app : list) {
|
||||
int is_network = app.getIs_network();
|
||||
String app_package = app.getApp_package();
|
||||
if (is_network == 1) {
|
||||
if (!network_allow.contains(app_package)) {
|
||||
network_allow += app_package + ",";
|
||||
}
|
||||
} else {
|
||||
if (!network_not.contains(app_package)) {
|
||||
network_not += app_package + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(network_allow) && network_allow.endsWith(",")) {
|
||||
network_allow = network_allow.substring(0, network_allow.length() - 1);
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, network_allow);
|
||||
Log.e(TAG, "not::" + network_allow);
|
||||
}
|
||||
if (!TextUtils.isEmpty(network_not) && network_not.endsWith(",")) {
|
||||
network_not = network_not.substring(0, network_not.length() - 1);
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, network_not);
|
||||
Log.e(TAG, "ban::" + network_not);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//app更新
|
||||
@SuppressLint("NewApi")
|
||||
private void setAppUpdate(List<AppStart> list) {
|
||||
@@ -1848,8 +1830,8 @@ public class NetInterfaceManager {
|
||||
|
||||
public void setInvalid() {
|
||||
boolean aole_app_power_on = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_POWER_ON, "");
|
||||
boolean aole_network_allow = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
boolean aole_network_disallow = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
// boolean aole_network_allow = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
// boolean aole_network_disallow = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
boolean writeSucceed = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, "");
|
||||
}
|
||||
|
||||
@@ -2771,7 +2753,7 @@ public class NetInterfaceManager {
|
||||
}
|
||||
|
||||
public void getAppJump(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
|
||||
ConnectMode connectMode = ConnectMode.DEFAULT;
|
||||
if (refresh) {
|
||||
connectMode = ConnectMode.DEFAULT;
|
||||
}
|
||||
@@ -2791,21 +2773,95 @@ public class NetInterfaceManager {
|
||||
}
|
||||
|
||||
public void getAppJump(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||
getAppJumpObservable()
|
||||
// getAppJumpObservable()
|
||||
// .compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
// .subscribe(getAppJumpObserver(callback));
|
||||
|
||||
Observable.zip(getAppJumpObservable(), getBlacklistObservable(), getBlacklistBiFunction()).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(getAppJumpObserver(callback));
|
||||
.subscribe(getBlacklistObserver());
|
||||
}
|
||||
|
||||
public void getAppJump(CompleteCallback callback) {
|
||||
getAppJumpObservable()
|
||||
.subscribe(getAppJumpObserver(callback));
|
||||
// getAppJumpObservable()
|
||||
// .subscribe(getAppJumpObserver(callback));
|
||||
|
||||
Observable.zip(getAppJumpObservable(), getBlacklistObservable(), getBlacklistBiFunction()).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getBlacklistObserver());
|
||||
}
|
||||
|
||||
public void getAppJump() {
|
||||
getAppJumpObservable()
|
||||
.subscribe(getAppJumpObserver(null));
|
||||
// getAppJumpObservable()
|
||||
// .subscribe(getAppJumpObserver(null));
|
||||
|
||||
Observable.zip(getAppJumpObservable(), getBlacklistObservable(), getBlacklistBiFunction()).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getBlacklistObserver());
|
||||
}
|
||||
|
||||
private BiFunction<BaseResponse<List<AppJump>>, BaseResponse<BlacklistBean>, List<String>> getBlacklistBiFunction() {
|
||||
return new BiFunction<BaseResponse<List<AppJump>>, BaseResponse<BlacklistBean>, List<String>>() {
|
||||
@Override
|
||||
public List<String> apply(BaseResponse<List<AppJump>> listBaseResponse, BaseResponse<BlacklistBean> blacklistBeanBaseResponse) throws Throwable {
|
||||
Log.e("getBlacklistBiFunction", "apply: listBaseResponse = " + listBaseResponse);
|
||||
Log.e("getBlacklistBiFunction", "apply: blacklistBeanBaseResponse = " + blacklistBeanBaseResponse);
|
||||
List<String> blackListUrls = new ArrayList<>();
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppJump> appJumpList = listBaseResponse.data;
|
||||
if (appJumpList != null && !appJumpList.isEmpty()) {
|
||||
List<String> urls = appJumpList.stream().map(new java.util.function.Function<AppJump, String>() {
|
||||
@Override
|
||||
public String apply(AppJump appJump) {
|
||||
return appJump.getAddress();
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
blackListUrls.addAll(urls);
|
||||
}
|
||||
}
|
||||
if (blacklistBeanBaseResponse.code == 200) {
|
||||
BlacklistBean blacklistBean = blacklistBeanBaseResponse.data;
|
||||
List<String> stringList = blacklistBean.getBlacklist();
|
||||
if (stringList != null && !stringList.isEmpty()) {
|
||||
blackListUrls.addAll(stringList);
|
||||
}
|
||||
}
|
||||
return blackListUrls;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Observer<List<String>> getBlacklistObserver() {
|
||||
return new Observer<List<String>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getBlacklistObserver", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull List<String> strings) {
|
||||
Log.e("getBlacklistObserver", "onNext: " + strings);
|
||||
if (strings == null || strings.isEmpty()) {
|
||||
mCacheHelper.put(UrlAddress.GET_APP_JUMP, "");
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_APP_WEB_BLACK_LIST, "");
|
||||
} else {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_APP_WEB_BLACK_LIST, String.join(",", strings));
|
||||
mCacheHelper.put(UrlAddress.GET_APP_JUMP, GsonUtils.toJSONString(strings));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getBlacklistObserver", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getBlacklistObserver", "onComplete: ");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Observer<BaseResponse<List<AppJump>>> getAppJumpObserver(CompleteCallback completeCallback) {
|
||||
return new Observer<BaseResponse<List<AppJump>>>() {
|
||||
@@ -2820,7 +2876,7 @@ public class NetInterfaceManager {
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppJump> appJumpList = listBaseResponse.data;
|
||||
if (appJumpList == null || appJumpList.size() == 0) {
|
||||
boolean putString = Settings.System.putString(crv, CommonConfig.AOLE_APP_WEB_WHITE_LIST, "");
|
||||
boolean putString = Settings.System.putString(crv, CommonConfig.AOLE_APP_WEB_BLACK_LIST, "");
|
||||
mCacheHelper.put(UrlAddress.GET_APP_JUMP, "");
|
||||
Log.e(TAG, "getAppJump: " + putString);
|
||||
} else {
|
||||
@@ -2830,13 +2886,13 @@ public class NetInterfaceManager {
|
||||
return appJump.getAddress();
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
boolean putString = Settings.System.putString(crv, CommonConfig.AOLE_APP_WEB_WHITE_LIST, String.join(",", urls));
|
||||
boolean putString = Settings.System.putString(crv, CommonConfig.AOLE_APP_WEB_BLACK_LIST, String.join(",", urls));
|
||||
mCacheHelper.put(UrlAddress.GET_APP_JUMP, GsonUtils.toJSONString(urls));
|
||||
Log.e(TAG, "getAppJump: " + putString);
|
||||
}
|
||||
} else {
|
||||
mCacheHelper.put(UrlAddress.GET_APP_JUMP, "");
|
||||
boolean putString = Settings.System.putString(crv, CommonConfig.AOLE_APP_WEB_WHITE_LIST, "");
|
||||
boolean putString = Settings.System.putString(crv, CommonConfig.AOLE_APP_WEB_BLACK_LIST, "");
|
||||
Log.e(TAG, "getAppJump: " + putString);
|
||||
}
|
||||
}
|
||||
@@ -2994,7 +3050,7 @@ public class NetInterfaceManager {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<ScreenPassword> screenPasswordBaseResponse) {
|
||||
Log.e("getLockScreenPwdObserver", "onSubscribe: " + screenPasswordBaseResponse);
|
||||
Log.e("onNext", "onSubscribe: ");
|
||||
if (screenPasswordBaseResponse.code == 200) {
|
||||
ScreenPassword screenPassword = screenPasswordBaseResponse.data;
|
||||
if (screenPassword == null || TextUtils.isEmpty(screenPassword.getPwd())) {
|
||||
|
||||
@@ -53,6 +53,8 @@ public class UrlAddress {
|
||||
public final static String GET_APP_START = "sn/querySnAppStart";
|
||||
/*发app跳转管控*/
|
||||
public final static String GET_APP_JUMP = "sn/querySnJump";
|
||||
/*全局黑名单列表*/
|
||||
public final static String GLOBAL_BLACKLIST = "common/blacklist";
|
||||
/*app内部管控*/
|
||||
public final static String QUERY_APP_INSIDE = "control/queryAppInside";
|
||||
/*发送卸载或者安装信息*/
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.fuying.sn.network.api;
|
||||
|
||||
import com.fuying.sn.bean.BaseResponse;
|
||||
import com.fuying.sn.bean.BlacklistBean;
|
||||
import com.fuying.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
|
||||
public interface BlacklistApi {
|
||||
@GET(UrlAddress.GLOBAL_BLACKLIST)
|
||||
Observable<BaseResponse<BlacklistBean>> getBlacklist();
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import retrofit2.http.POST;
|
||||
public interface ScreenState {
|
||||
@FormUrlEncoded
|
||||
@POST(BuildConfig.SCREEN_URL)
|
||||
@Deprecated
|
||||
Observable<BaseResponse> setScreenState(
|
||||
@Field("sn")String sn ,
|
||||
@Field("online") int stateCode
|
||||
|
||||
@@ -22,7 +22,7 @@ import okio.Buffer;
|
||||
* v1.0 2022-07-15 16:16:52
|
||||
*/
|
||||
public class RepeatRequestInterceptor implements Interceptor {
|
||||
private static final String TAG = RepeatRequestInterceptor.class.getSimpleName();
|
||||
private static final String TAG = "RepeatRequestInterceptor";
|
||||
|
||||
private final ConcurrentHashMap<String, Long> requestIdsMap = new ConcurrentHashMap<>();
|
||||
public static final String REPEAT_REQUEST_PROTOCOL = "OKHTTP_REPEAT_REQUEST_PROTOCOL";
|
||||
|
||||
@@ -24,7 +24,8 @@ import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class APKinstallReceiver extends BroadcastReceiver {
|
||||
private static String TAG = APKinstallReceiver.class.getSimpleName();
|
||||
private static final String TAG = "APKinstallReceiver";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static Context mContext;
|
||||
private static NewAppListener newAppListener;
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.util.Log;
|
||||
import com.baidu.location.BDAbstractLocationListener;
|
||||
import com.baidu.location.BDLocation;
|
||||
import com.baidu.location.LocationClient;
|
||||
import com.fuying.sn.config.CommonConfig;
|
||||
import com.fuying.sn.manager.AmapManager;
|
||||
import com.fuying.sn.network.NetInterfaceManager;
|
||||
import com.fuying.sn.service.ControlPanelService;
|
||||
@@ -16,36 +17,31 @@ import com.fuying.sn.service.main.MainService;
|
||||
import com.fuying.sn.service.ManagerService;
|
||||
import com.fuying.sn.service.DownloadService;
|
||||
import com.fuying.sn.service.StepService;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
private static String TAG = BootReceiver.class.getSimpleName();
|
||||
private static final String TAG = "BootReceiver";
|
||||
public static final String BOOT_COMPLETED = "zuoyeos.action.BOOT_COMPLETED";
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
Log.e("SNBootReceiver", action);
|
||||
if (Intent.ACTION_BOOT_COMPLETED.equals(action)
|
||||
// || Intent.ACTION_BATTERY_CHANGED.equals(action)
|
||||
// || Intent.ACTION_BATTERY_LOW.equals(action)
|
||||
// || Intent.ACTION_BATTERY_OKAY.equals(action)
|
||||
// || Intent.ACTION_POWER_CONNECTED.equals(action)
|
||||
// || Intent.ACTION_POWER_DISCONNECTED.equals(action)
|
||||
// || Intent.ACTION_DATE_CHANGED.equals(action)
|
||||
// || Intent.ACTION_TIME_TICK.equals(action)
|
||||
// || Intent.ACTION_USER_PRESENT.equals(action)
|
||||
// || Intent.ACTION_SCREEN_ON.equals(action)
|
||||
// || Intent.ACTION_SCREEN_OFF.equals(action)
|
||||
|| BOOT_COMPLETED.equals(action)
|
||||
|| "android.intent.action.BATTERY_LEVEL_CHANGED".equals(action)
|
||||
) {
|
||||
switch (action) {
|
||||
case Intent.ACTION_BOOT_COMPLETED:
|
||||
mMMKV.encode(CommonConfig.DEVICES_REBOOT, true);
|
||||
case BOOT_COMPLETED:
|
||||
case "android.intent.action.BATTERY_LEVEL_CHANGED":
|
||||
context.startService(new Intent(context, MainService.class));
|
||||
context.startService(new Intent(context, GuardService.class));
|
||||
context.startService(new Intent(context, StepService.class));
|
||||
context.startService(new Intent(context, DownloadService.class));
|
||||
context.startService(new Intent(context, ManagerService.class));
|
||||
context.startService(new Intent(context, ControlPanelService.class));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,14 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class LogDBManager {
|
||||
private static String TAG = "LogDBManager";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static LogDBManager sInstance;
|
||||
private Context mContext;
|
||||
private LogDBHelper mDBHelper;
|
||||
|
||||
private static final String TABLE_NAME = "logtable";
|
||||
private static String TAG = LogDBManager.class.getSimpleName();
|
||||
|
||||
private LogDBManager(Context context) {
|
||||
if (context == null) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
public class ControlPanelService extends Service {
|
||||
private static final String TAG = ControlPanelService.class.getSimpleName();
|
||||
private static final String TAG = "ControlPanelService";
|
||||
|
||||
public ControlPanelService() {
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.io.File;
|
||||
|
||||
// 下载管理服务
|
||||
public class DownloadService extends Service {
|
||||
private static final String TAG = DownloadService.class.getSimpleName();
|
||||
private static final String TAG = "DownloadService";
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.fuying.sn.utils.ServiceAliveUtils;
|
||||
* @time Created by 2018/8/17 11:27
|
||||
*/
|
||||
public class GuardService extends Service {
|
||||
private final static String TAG = GuardService.class.getSimpleName();
|
||||
private static final String TAG = "GuardService";
|
||||
private ServiceConnection mServiceConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
||||
|
||||
@@ -35,7 +35,7 @@ import okhttp3.RequestBody;
|
||||
public class LogcatService extends Service {
|
||||
public final static String LOGCAT_START_ACTION = "START";
|
||||
public final static String LOGCAT_STOP_ACTION = "STOP";
|
||||
private String TAG = LogcatService.class.getSimpleName();
|
||||
private static final String TAG = "LogcatService";
|
||||
|
||||
|
||||
public LogcatService() {
|
||||
|
||||
@@ -51,7 +51,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
* @author jgy02
|
||||
*/
|
||||
public class ManagerService extends Service implements NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private String TAG = ManagerService.class.getSimpleName();
|
||||
private static final String TAG = "ManagerService";
|
||||
|
||||
public static final String ACTION_LOCK = "LockScreenReceiver_lockscreen";
|
||||
public static final String ACTION_UNLOCK = "LockScreenReceiver_unlockscreen";
|
||||
@@ -528,13 +528,13 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta
|
||||
switch (action) {
|
||||
case Intent.ACTION_USER_PRESENT:
|
||||
case Intent.ACTION_SCREEN_ON:
|
||||
sendScreenState(1);
|
||||
// sendScreenState(1);
|
||||
break;
|
||||
case Intent.ACTION_SCREEN_OFF:
|
||||
case Intent.ACTION_SHUTDOWN:
|
||||
case Intent.ACTION_FACTORY_RESET:
|
||||
case Intent.ACTION_MASTER_CLEAR:
|
||||
sendScreenState(0);
|
||||
// sendScreenState(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RemoteService extends Service {
|
||||
private String TAG = RemoteService.class.getSimpleName();
|
||||
private static final String TAG = "RemoteService";
|
||||
|
||||
public RemoteService() {
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.net.URI;
|
||||
* @time Created by 2018/8/17 11:26
|
||||
*/
|
||||
public class StepService extends Service implements NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private final static String TAG = StepService.class.getSimpleName();
|
||||
private static final String TAG = "StepService";
|
||||
|
||||
public JWebSocketClient client;
|
||||
private JWebSocketClientBinder mBinder = new JWebSocketClientBinder();
|
||||
|
||||
@@ -37,7 +37,7 @@ import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
* @author jgy02
|
||||
*/
|
||||
public class MainSPresenter implements MainSContact.Presenter {
|
||||
private static final String TAG = MainSPresenter.class.getSimpleName();
|
||||
private static final String TAG = "MainSPresenter";
|
||||
|
||||
private MainSContact.MainView mView;
|
||||
private Context mContext;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.fuying.sn.service.main;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -25,6 +23,7 @@ import com.baidu.location.BDLocation;
|
||||
import com.baidu.location.LocationClient;
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.fuying.sn.BuildConfig;
|
||||
import com.fuying.sn.base.rx.BaseRxService;
|
||||
import com.fuying.sn.bean.BaseResponse;
|
||||
import com.fuying.sn.bean.SnInfo;
|
||||
import com.fuying.sn.config.CommonConfig;
|
||||
@@ -48,12 +47,7 @@ import com.tencent.android.tpush.XGPushConfig;
|
||||
import com.tencent.android.tpush.XGPushManager;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.LifecycleTransformer;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -65,40 +59,16 @@ import io.reactivex.rxjava3.core.ObservableEmitter;
|
||||
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
/**
|
||||
* @author jgy02
|
||||
*/
|
||||
public class MainService extends Service implements MainSContact.MainView, NetworkUtils.OnNetworkStatusChangedListener, LifecycleProvider<ActivityEvent> {
|
||||
private String TAG = MainService.class.getSimpleName();
|
||||
public class MainService extends BaseRxService implements MainSContact.MainView, NetworkUtils.OnNetworkStatusChangedListener, LifecycleProvider<ActivityEvent> {
|
||||
private static final String TAG = "MainService";
|
||||
|
||||
public MainSPresenter mPresenter;
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
//执行所有请求的时间
|
||||
long runningTime;
|
||||
|
||||
private final BehaviorSubject<ActivityEvent> lifecycleSubject = BehaviorSubject.create();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Observable<ActivityEvent> lifecycle() {
|
||||
return lifecycleSubject.hide();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> LifecycleTransformer<T> bindUntilEvent(@NotNull ActivityEvent event) {
|
||||
return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> LifecycleTransformer<T> bindToLifecycle() {
|
||||
return RxLifecycleAndroid.bindActivity(lifecycleSubject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
Log.e(TAG, "网络未连接");
|
||||
@@ -111,16 +81,22 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
ToastUtil.show("网络已连接");
|
||||
String WiFiAlias = Utils.getWifiAlias(this);
|
||||
Log.e(TAG, "onConnected: WiFiAlias = " + WiFiAlias);
|
||||
// NTPTimeTask task = new NTPTimeTask();
|
||||
// task.execute("ntp.aliyun.com");
|
||||
|
||||
NTPTimeTask task = new NTPTimeTask();
|
||||
task.execute("ntp.aliyun.com");
|
||||
|
||||
|
||||
boolean reboot = mMMKV.decodeBool(CommonConfig.DEVICES_REBOOT, false);
|
||||
Log.e(TAG, "onConnected: reboot = " + reboot);
|
||||
// if (reboot) {
|
||||
//第一次开机联网后直接连接
|
||||
// TODO: 2022/11/21 有些设备联网了但是立刻请求还是失败
|
||||
Log.e(TAG, "onConnected run: 15秒后请求网络");
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// NetInterfaceManager.getInstance().updateAdminInfo();
|
||||
if (JGYUtils.getInstance().isScreenOn()) {
|
||||
·// NetInterfaceManager.getInstance().updateAdminInfo();
|
||||
// if (JGYUtils.getInstance().isScreenOn()) {
|
||||
Log.e(TAG, "getSnInfo1");
|
||||
NetInterfaceManager.getInstance().getAppWhiteList(() -> {
|
||||
Log.e("onConnected", "onNext: getAppWhiteList");
|
||||
@@ -129,9 +105,14 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
mPresenter.getAppAndWhite();
|
||||
SPUtils.put(MainService.this, CommonConfig.JGY_FIRST_BOOT, 1);
|
||||
tPushInit();
|
||||
}
|
||||
// }
|
||||
}
|
||||
}, 15000);
|
||||
mMMKV.encode(CommonConfig.DEVICES_REBOOT, false);
|
||||
// }
|
||||
// NetInterfaceManager.getInstance().updateAdminInfo();
|
||||
// NetInterfaceManager.getInstance().getAppTimeControl();
|
||||
// NetInterfaceManager.getInstance().getSnTimeControl();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,11 +131,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.e(TAG, "onCreate: ");
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
|
||||
lifecycleSubject.onNext(ActivityEvent.CREATE);
|
||||
mPresenter = new MainSPresenter(this);
|
||||
mPresenter.setLifecycle(lifecycleSubject);
|
||||
mPresenter.setLifecycle(getLifecycleSubject());
|
||||
mPresenter.attachView(this);
|
||||
|
||||
// if (BuildConfig.DEBUG){
|
||||
@@ -163,6 +144,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
// Settings.System.putInt(getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
|
||||
// }
|
||||
|
||||
boolean reboot = mMMKV.decodeBool(CommonConfig.DEVICES_REBOOT, false);
|
||||
Log.e(TAG, "onCreate: reboot = " + reboot);
|
||||
boolean networkConnected = JGYUtils.getInstance().isNetworkConnected();
|
||||
Log.e(TAG, "onCreate: networkConnected = " + networkConnected);
|
||||
// if (networkConnected && reboot) {
|
||||
Log.e(TAG, "onCreate run: 20秒后请求网络");
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
@Override
|
||||
@@ -180,6 +166,12 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
}
|
||||
}
|
||||
}, 20000);
|
||||
mMMKV.encode(CommonConfig.DEVICES_REBOOT, false);
|
||||
// } else {
|
||||
// NetInterfaceManager.getInstance().updateAdminInfo();
|
||||
// NetInterfaceManager.getInstance().getAppTimeControl();
|
||||
// NetInterfaceManager.getInstance().getSnTimeControl();
|
||||
// }
|
||||
|
||||
Log.e(TAG, "onCreate: IMEI = " + Utils.getIMEI(MainService.this));
|
||||
String aole_app_forbid = Settings.System.getString(getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID);
|
||||
@@ -203,13 +195,17 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
versionIsUpdate();
|
||||
registerReceivers();
|
||||
startService();
|
||||
Settings.System.putString(getContentResolver(), CommonConfig.APP_SOURCE_WHITE_LIST, DEFAULT_SOURCE);
|
||||
}
|
||||
|
||||
private static final String DEFAULT_SOURCE = "com.fuying.sn,com.fuying.appstore,com.fuying.fuxiaoying";
|
||||
|
||||
private void versionIsUpdate() {
|
||||
int oldVersionCode = (int) SPUtils.get(this, CommonConfig.SN_VERSIONCODE, 0);
|
||||
if (oldVersionCode < BuildConfig.VERSION_CODE) {
|
||||
Log.e(TAG, "onCreate: " + "upgrade successful");
|
||||
try {
|
||||
Settings.System.putString(getContentResolver(), CommonConfig.APP_SOURCE_WHITE_LIST, DEFAULT_SOURCE);
|
||||
new CacheUtils().cleanApplicationUserData(this, "com.aoleyun.os");
|
||||
File file = new File(JGYUtils.getInstance().getDownLoadPath());
|
||||
Log.e(TAG, "versionIsUpdate: " + file.getAbsolutePath());
|
||||
@@ -290,7 +286,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
lifecycleSubject.onNext(ActivityEvent.DESTROY);
|
||||
NetworkUtils.unregisterNetworkStatusChangedListener(this);
|
||||
mPresenter.detachView();
|
||||
unregisterReceivers();
|
||||
@@ -311,8 +306,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
@Override
|
||||
protected void onPostExecute(Long aLong) {
|
||||
super.onPostExecute(aLong);
|
||||
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||
am.setTime(aLong);
|
||||
// AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||
// am.setTime(aLong);
|
||||
SystemClock.setCurrentTimeMillis(aLong);
|
||||
Log.e(TAG, "getTimeFromNtpServer: " + aLong);
|
||||
tPushInit();
|
||||
}
|
||||
@@ -604,6 +600,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void setMyAppList() {
|
||||
Log.e(TAG, "SettingFinish: " + (SystemClock.elapsedRealtime() - runningTime) + " ms");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
public static final String TEST_ACTION = "com.qq.xgdemo.activity.TEST_ACTION";
|
||||
public static final String LogTag = "xg.test";
|
||||
|
||||
private static final String TAG = MessageReceiver.class.getSimpleName();
|
||||
private static final String TAG = "MessageReceiver";
|
||||
|
||||
private Context mContext;
|
||||
private ContentResolver mResolver;
|
||||
@@ -937,7 +937,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
}
|
||||
|
||||
synchronized private void sendStartTime(Context context, String jsonString) {
|
||||
NetInterfaceManager.getInstance().sendRunningApp();
|
||||
// NetInterfaceManager.getInstance().sendRunningApp();
|
||||
NetInterfaceManager.getInstance().updateAdminInfo();
|
||||
NetInterfaceManager.getInstance().SendAppInstallInfo();
|
||||
NetInterfaceManager.getInstance().getAppAndWhite();
|
||||
@@ -1008,27 +1008,27 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
}
|
||||
|
||||
synchronized private void setAppNetworkstate(Context context, String jsonString) {
|
||||
if (!TextUtils.isEmpty(jsonString)) {
|
||||
JsonObject extra = GsonUtils.getJsonObject(jsonString);
|
||||
String package0 = extra.get("package0").getAsString();
|
||||
String package1 = extra.get("package1").getAsString();
|
||||
if (package0.length() != 0) {
|
||||
boolean aole_network_allow = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_ALLOW, package0);
|
||||
Log.e("fht", "aole_network_allow::" + aole_network_allow + ":" + Settings.System.getString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_ALLOW));
|
||||
} else {
|
||||
boolean aole_network_allow = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
Log.e("fht", "aole_network_allow::" + aole_network_allow + ":" + Settings.System.getString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_ALLOW));
|
||||
}
|
||||
if (package1.length() != 0) {
|
||||
boolean aole_network_disallow = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, package1);
|
||||
Log.e("fht", "aole_network_disallow::" + aole_network_disallow + ":" + Settings.System.getString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_DISALLOW));
|
||||
} else {
|
||||
boolean aole_network_disallow = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
Log.e("fht", "aole_network_disallow::" + aole_network_disallow + ":" + Settings.System.getString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_DISALLOW));
|
||||
}
|
||||
} else {
|
||||
ToastUtil.debugShow("setAppNetworkstate jsonString is NULL");
|
||||
}
|
||||
// if (!TextUtils.isEmpty(jsonString)) {
|
||||
// JsonObject extra = GsonUtils.getJsonObject(jsonString);
|
||||
// String package0 = extra.get("package0").getAsString();
|
||||
// String package1 = extra.get("package1").getAsString();
|
||||
// if (package0.length() != 0) {
|
||||
// boolean aole_network_allow = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_ALLOW, package0);
|
||||
// Log.e("fht", "aole_network_allow::" + aole_network_allow + ":" + Settings.System.getString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_ALLOW));
|
||||
// } else {
|
||||
// boolean aole_network_allow = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
// Log.e("fht", "aole_network_allow::" + aole_network_allow + ":" + Settings.System.getString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_ALLOW));
|
||||
// }
|
||||
// if (package1.length() != 0) {
|
||||
// boolean aole_network_disallow = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, package1);
|
||||
// Log.e("fht", "aole_network_disallow::" + aole_network_disallow + ":" + Settings.System.getString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_DISALLOW));
|
||||
// } else {
|
||||
// boolean aole_network_disallow = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
// Log.e("fht", "aole_network_disallow::" + aole_network_disallow + ":" + Settings.System.getString(context.getContentResolver(), CommonConfig.AOLE_ACTION_NETWORK_DISALLOW));
|
||||
// }
|
||||
// } else {
|
||||
// ToastUtil.debugShow("setAppNetworkstate jsonString is NULL");
|
||||
// }
|
||||
}
|
||||
|
||||
synchronized private void setAppLockedstate(Context context, String jsonString) {
|
||||
@@ -1299,7 +1299,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||
int is_ground = jsonObject.get("is_ground").getAsInt();
|
||||
if (is_ground == 0) {
|
||||
boolean putString = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, "");
|
||||
boolean putString = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, "");
|
||||
Log.e(TAG, "setAppInsideNetwork: " + putString);
|
||||
} else if (is_ground == 1) {
|
||||
NetInterfaceManager.getInstance().getAppJump();
|
||||
|
||||
@@ -62,7 +62,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
|
||||
public class ApkUtils {
|
||||
private static String TAG = ApkUtils.class.getSimpleName();
|
||||
private static final String TAG = "ApkUtils";
|
||||
|
||||
/**
|
||||
* 获取第三方应用
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
|
||||
public class AppUsedTimeUtils {
|
||||
private static final String TAG = AppUsedTimeUtils.class.getSimpleName();
|
||||
private static final String TAG = "AppUsedTimeUtils";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static AppUsedTimeUtils sInstance;
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
public class AudioMngHelper {
|
||||
|
||||
private final String TAG = "AudioMngHelper";
|
||||
private static final String TAG = "AudioMngHelper";
|
||||
private final boolean OpenLog = true;
|
||||
|
||||
private AudioManager audioManager;
|
||||
|
||||
@@ -14,7 +14,7 @@ import android.util.Log;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class CacheUtils {
|
||||
private static final String TAG = CacheUtils.class.getSimpleName();
|
||||
private static final String TAG = "CacheUtils";
|
||||
|
||||
private final long MAX_WAIT_TIME = 60 * 1000;
|
||||
private final long WAIT_TIME_INCR = 10 * 1000;
|
||||
|
||||
@@ -82,7 +82,7 @@ import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
|
||||
|
||||
|
||||
public class JGYUtils {
|
||||
private static final String TAG = JGYUtils.class.getSimpleName();
|
||||
private static final String TAG = "JGYUtils";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static JGYUtils sInstance;
|
||||
@@ -90,15 +90,17 @@ public class JGYUtils {
|
||||
private ContentResolver resolver;
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
public static final int UnknowPlatform = 0;
|
||||
|
||||
public static final int MTKPlatform = 1;
|
||||
public static final int ZhanruiPlatform = 2;
|
||||
public static final int M40sePlatform = 4;
|
||||
public static final int T30ProPlatform = 5;
|
||||
public static final int MTK8515Platform = 6;
|
||||
public static final int G13Platform = 7;
|
||||
public static final int UnknowPlatform = 0;
|
||||
public static final int iPlay50SEPlatform = 8;
|
||||
public static final int G6Platform = 10;
|
||||
public static final int G11JPlatform = 11;
|
||||
|
||||
|
||||
public static final String MTKTag = "MTK";
|
||||
@@ -109,36 +111,37 @@ public class JGYUtils {
|
||||
public static final String G13Tag = "G13";
|
||||
public static final String iPlay50SETag = "ipaly50SE";
|
||||
public static final String G6Tag = "G6";
|
||||
public static final String G11JTag = "G10J";
|
||||
|
||||
|
||||
private HashSet<String> ownApp = new HashSet<String>() {{
|
||||
this.add("com.android.settings");
|
||||
this.add("com.android.deskclock");
|
||||
// this.add("com.android.settings");
|
||||
// this.add("com.android.deskclock");
|
||||
this.add("com.tt.ttutils");
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
this.add("com.fuying.sn");
|
||||
this.add("com.appstore.uiui");
|
||||
this.add("com.alarmclock.uiui");
|
||||
this.add("com.android.uiuios");
|
||||
this.add("com.aoleyun.os");
|
||||
this.add("com.jiaoguanyi.appstore");
|
||||
this.add("com.jiaoguanyi.store");
|
||||
// this.add("com.appstore.uiui");
|
||||
// this.add("com.alarmclock.uiui");
|
||||
// this.add("com.android.uiuios");
|
||||
// this.add("com.aoleyun.os");
|
||||
// this.add("com.jiaoguanyi.appstore");
|
||||
// this.add("com.jiaoguanyi.store");
|
||||
this.add("com.fuying.appstore");
|
||||
this.add("com.fuying.info");
|
||||
this.add("com.fuying.browser");
|
||||
this.add("com.uiui.health");
|
||||
this.add("com.uiui.videoplayer");
|
||||
// this.add("com.uiui.health");
|
||||
// this.add("com.uiui.videoplayer");
|
||||
this.add("com.fuying.os");
|
||||
this.add("com.uiui.info");
|
||||
this.add("com.aoleyunos.dop1");
|
||||
this.add("com.aoleyunos.dop2");
|
||||
this.add("com.uiui.aios");
|
||||
this.add("com.uiuios.jgy1");
|
||||
this.add("com.uiuios.jgy2");
|
||||
this.add("com.info.chat");
|
||||
this.add("com.info.learning");
|
||||
this.add("com.uiui.multios");
|
||||
this.add("com.uiui.city");
|
||||
// this.add("com.uiui.info");
|
||||
// this.add("com.aoleyunos.dop1");
|
||||
// this.add("com.aoleyunos.dop2");
|
||||
// this.add("com.uiui.aios");
|
||||
// this.add("com.uiuios.jgy1");
|
||||
// this.add("com.uiuios.jgy2");
|
||||
// this.add("com.info.chat");
|
||||
// this.add("com.info.learning");
|
||||
// this.add("com.uiui.multios");
|
||||
// this.add("com.uiui.city");
|
||||
}};
|
||||
|
||||
private HashSet<String> fuxiaoyingApp = new HashSet<String>() {{
|
||||
@@ -525,12 +528,15 @@ public class JGYUtils {
|
||||
} else if (G13Tag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "G13");
|
||||
return G13Platform;
|
||||
} else if (G6Tag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "G6");
|
||||
return G6Platform;
|
||||
} else if (iPlay50SETag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "ipaly50SE");
|
||||
return iPlay50SEPlatform;
|
||||
} else if (G6Tag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "G6");
|
||||
return G6Platform;
|
||||
} else if (G11JTag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "G10J");
|
||||
return G11JPlatform;
|
||||
} else {
|
||||
Log.i(TAG, "checkAppPlatform: " + "没有数据");
|
||||
return UnknowPlatform;
|
||||
@@ -564,10 +570,12 @@ public class JGYUtils {
|
||||
getAppPlatformCallback.AppPlatform(MTK8515Platform);
|
||||
} else if (G13Tag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(G13Platform);
|
||||
} else if (G6Tag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(G6Platform);
|
||||
} else if (iPlay50SETag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(iPlay50SEPlatform);
|
||||
} else if (G6Tag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(G6Platform);
|
||||
} else if (G11JTag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(G11JPlatform);
|
||||
} else {
|
||||
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||
}
|
||||
@@ -579,8 +587,9 @@ public class JGYUtils {
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.T30ProPlatform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTK8515Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G13Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G6Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.iPlay50SEPlatform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G6Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11JPlatform
|
||||
) {
|
||||
return getProperty("ro.build.display.id", "获取失败");
|
||||
} else {
|
||||
@@ -1007,115 +1016,6 @@ public class JGYUtils {
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
synchronized public void setAppNetwork(HashSet<String> blackList) {
|
||||
Log.e(TAG, "setAppNetwork: " + "设置应用联网管控" + blackList);
|
||||
String dis = Settings.System.getString(resolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW);
|
||||
String not = Settings.System.getString(resolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW);
|
||||
//清除旧数据
|
||||
if (!TextUtils.isEmpty(dis)) {
|
||||
Log.e(TAG, "setAppNetwork: dis = " + dis);
|
||||
Settings.System.putString(resolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
}
|
||||
if (!TextUtils.isEmpty(not)) {
|
||||
Log.e(TAG, "setAppNetwork: not = " + not);
|
||||
Settings.System.putString(resolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
}
|
||||
|
||||
String oldBlackList = (String) SPUtils.get(mContext, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
HashSet<String> oldBlackListSet = new HashSet<>(Arrays.asList(oldBlackList.split(",")));
|
||||
//去空
|
||||
oldBlackListSet.removeIf(s -> TextUtils.isEmpty(s.trim()));
|
||||
//之前禁止上网得列表
|
||||
Log.e(TAG, "setAppNetwork: oldBlackListSet: " + oldBlackListSet);
|
||||
if (oldBlackListSet.size() == 0) {
|
||||
Log.e(TAG, "setAppNetwork: blackList: " + blackList);
|
||||
for (String pkg : blackList) {
|
||||
if (TextUtils.isEmpty(pkg)) continue;
|
||||
//发送没有安装的
|
||||
if (!ApkUtils.isAvailable(mContext, pkg)) {
|
||||
Log.e(TAG, "setAppNetwork: skip: " + pkg);
|
||||
continue;
|
||||
} else {
|
||||
Log.e(TAG, "setAppNetwork: " + pkg + " 已安装");
|
||||
}
|
||||
Intent netControlNotIntent = new Intent(CommonConfig.AOLE_ACTION_NETWORK_DISALLOW);
|
||||
netControlNotIntent.putExtra("package_name", pkg);
|
||||
netControlNotIntent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(netControlNotIntent);
|
||||
}
|
||||
} else {
|
||||
//减少的
|
||||
Set<String> removedNet = oldBlackListSet;
|
||||
//增加的
|
||||
Set<String> addedNet = new HashSet<>();
|
||||
for (String pkg : blackList) {
|
||||
if (TextUtils.isEmpty(pkg)) continue;
|
||||
if (removedNet.contains(pkg)) {
|
||||
removedNet.remove(pkg);
|
||||
} else {
|
||||
addedNet.add(pkg);
|
||||
}
|
||||
}
|
||||
|
||||
Log.e(TAG, "setAppNetwork: removedNet: " + removedNet);
|
||||
Log.e(TAG, "setAppNetwork: addedNet: " + addedNet);
|
||||
for (String pkg : removedNet) {
|
||||
if (TextUtils.isEmpty(pkg)) continue;
|
||||
Intent netControlNotIntent = new Intent(CommonConfig.AOLE_ACTION_NETWORK_ALLOW);
|
||||
netControlNotIntent.putExtra("package_name", pkg);
|
||||
netControlNotIntent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(netControlNotIntent);
|
||||
}
|
||||
for (String pkg : addedNet) {
|
||||
if (TextUtils.isEmpty(pkg)) continue;
|
||||
if (!ApkUtils.isAvailable(mContext, pkg)) {
|
||||
Log.e(TAG, "setAppNetwork: skip: " + pkg);
|
||||
continue;
|
||||
} else {
|
||||
Log.e(TAG, "setAppNetwork: " + pkg + " 已安装");
|
||||
}
|
||||
Intent netControlNotIntent = new Intent(CommonConfig.AOLE_ACTION_NETWORK_DISALLOW);
|
||||
netControlNotIntent.putExtra("package_name", pkg);
|
||||
netControlNotIntent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(netControlNotIntent);
|
||||
}
|
||||
}
|
||||
|
||||
String net_not = String.join(",", blackList);
|
||||
SPUtils.put(mContext, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
||||
//Settings.System.putString(resolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
||||
Log.e("fht", "not::" + net_not);
|
||||
|
||||
//Intent netControlIntent = new Intent(CommonConfig.AOLE_ACTION_NETWORK_DISALLOW);
|
||||
//netControlIntent.putExtra("package_name", net_not);
|
||||
//sendBroadcast(netControlIntent);
|
||||
|
||||
//Intent netControlNotIntent = new Intent(CommonConfig.AOLE_ACTION_NETWORK_ALLOW);
|
||||
//netControlNotIntent.putExtra("package_name", net_ok);
|
||||
//sendBroadcast(netControlNotIntent);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
synchronized public void onBootSendNetwork() {
|
||||
String oldBlackListString = (String) SPUtils.get(mContext, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
HashSet<String> oldBlackListSet = new HashSet<>(Arrays.asList(oldBlackListString.split(",")));
|
||||
Log.e(TAG, "setAppNetwork: oldBlackListSet: " + oldBlackListSet);
|
||||
oldBlackListSet.removeIf(s -> TextUtils.isEmpty(s.trim()));
|
||||
for (String pkg : oldBlackListSet) {
|
||||
if (TextUtils.isEmpty(pkg)) continue;
|
||||
if (!ApkUtils.isAvailable(mContext, pkg)) {
|
||||
Log.e(TAG, "setAppNetwork: skip: " + pkg);
|
||||
continue;
|
||||
}
|
||||
Intent netControlNotIntent = new Intent(CommonConfig.AOLE_ACTION_NETWORK_DISALLOW);
|
||||
netControlNotIntent.putExtra("package_name", pkg);
|
||||
netControlNotIntent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(netControlNotIntent);
|
||||
}
|
||||
}
|
||||
|
||||
//删除用户除了在应用市场的其他应用
|
||||
public void deleteOtherApp() {
|
||||
int locked = Settings.System.getInt(resolver, "qch_unlock_ipad", 0);
|
||||
@@ -1346,6 +1246,9 @@ public class JGYUtils {
|
||||
|
||||
|
||||
public String getIMEI() {
|
||||
if (BuildConfig.DEBUG) {
|
||||
// return "861918053899168";
|
||||
}
|
||||
String IMEI = "unknow";
|
||||
String IMEI1, IMEI2, IMEI3;
|
||||
//获取手机设备号
|
||||
|
||||
@@ -23,11 +23,12 @@ import java.util.Map;
|
||||
*/
|
||||
|
||||
public class SPUtils {
|
||||
private static final String TAG = "SPUtils";
|
||||
|
||||
/**
|
||||
* 保存在手机里面的文件名
|
||||
*/
|
||||
public static final String FILE_NAME = "share_data";
|
||||
private static String TAG = SPUtils.class.getSimpleName();
|
||||
|
||||
/**
|
||||
* 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class TimeUtils {
|
||||
private static final String TAG = TimeUtils.class.getSimpleName();
|
||||
private static final String TAG = "TimeUtils";
|
||||
private static DateFormat df = new SimpleDateFormat("HH:mm");
|
||||
public static final String START_TIME_KEY = "START_TIME";
|
||||
public static final String END_TIME_KEY = "END_TIME";
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.fuying.sn.R;
|
||||
import com.fuying.sn.manager.DeviceManager;
|
||||
|
||||
public class ToastUtil {
|
||||
private static String TAG = ToastUtil.class.getSimpleName();
|
||||
private static final String TAG = "ToastUtil";
|
||||
|
||||
public static void show(final String msg) {
|
||||
ToastUtils.make()
|
||||
|
||||
@@ -28,7 +28,7 @@ import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class URLUtils {
|
||||
private static String TAG = URLUtils.class.getSimpleName();
|
||||
private static final String TAG = "URLUtils";
|
||||
private Context mContext;
|
||||
private HashSet<String> baseURLList = new HashSet<>();
|
||||
private HashSet<String> nohttpURLList = new HashSet<>();
|
||||
|
||||
@@ -96,7 +96,7 @@ import java.util.regex.Pattern;
|
||||
import static android.content.Context.WIFI_SERVICE;
|
||||
|
||||
public class Utils {
|
||||
private static final String TAG = Utils.class.getSimpleName();
|
||||
private static final String TAG = "Utils";
|
||||
|
||||
// MD5 设备地址标识
|
||||
public static String getMAC(Context context) {
|
||||
|
||||
@@ -115,6 +115,7 @@
|
||||
tools:layout_editor_absoluteX="0dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_update"
|
||||
android:layout_width="@dimen/dp_150"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginBottom="@dimen/dp_32"
|
||||
|
||||
12
build.gradle
12
build.gradle
@@ -3,10 +3,12 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://jitpack.io" }
|
||||
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
|
||||
maven { url 'http://developer.huawei.com/repo/' }
|
||||
maven { url 'https://maven.aliyun.com/repository/central' }
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.6.4'
|
||||
@@ -20,10 +22,12 @@ buildscript {
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://jitpack.io" }
|
||||
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
|
||||
maven { url 'http://developer.huawei.com/repo/' }
|
||||
maven { url 'https://maven.aliyun.com/repository/central' }
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
}
|
||||
gradle.projectsEvaluated {
|
||||
tasks.withType(JavaCompile) {
|
||||
|
||||
Reference in New Issue
Block a user