version:2.3
fix:增加上传日志功能,优化一键加速功能 update:
This commit is contained in:
@@ -61,8 +61,8 @@ android {
|
||||
//新平台正式
|
||||
newly {
|
||||
flavorDimensions "default"
|
||||
versionCode 12
|
||||
versionName "2.1"
|
||||
versionCode 14
|
||||
versionName "2.3"
|
||||
/*********************************极光推送************************************/
|
||||
manifestPlaceholders = [
|
||||
XG_ACCESS_ID : "1500026372",
|
||||
@@ -83,8 +83,8 @@ android {
|
||||
|
||||
MTKnewly {
|
||||
flavorDimensions "default"
|
||||
versionCode 4
|
||||
versionName "1.3"
|
||||
versionCode 5
|
||||
versionName "1.4"
|
||||
/*********************************极光推送************************************/
|
||||
manifestPlaceholders = [
|
||||
XG_ACCESS_ID : "1500026372",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.aoleyun.sn"
|
||||
coreApp="true"
|
||||
package="com.aoleyun.sn"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
|
||||
@@ -75,11 +75,11 @@
|
||||
|
||||
<!-- ##############################极光推送############################## -->
|
||||
<!-- Required -->
|
||||
<!-- <permission-->
|
||||
<!-- android:name="${JPUSH_PKGNAME}.permission.JPUSH_MESSAGE"-->
|
||||
<!-- android:protectionLevel="signature" />-->
|
||||
<!-- <permission-->
|
||||
<!-- android:name="${JPUSH_PKGNAME}.permission.JPUSH_MESSAGE"-->
|
||||
<!-- android:protectionLevel="signature" />-->
|
||||
<!-- Required -->
|
||||
<!-- <uses-permission android:name="${JPUSH_PKGNAME}.permission.JPUSH_MESSAGE" />-->
|
||||
<!-- <uses-permission android:name="${JPUSH_PKGNAME}.permission.JPUSH_MESSAGE" />-->
|
||||
|
||||
<!-- 高德地图 -->
|
||||
<!-- 用于进行网络定位 -->
|
||||
@@ -131,11 +131,14 @@
|
||||
android:launchMode="singleTop" />
|
||||
<activity android:name=".activity.TopActivity" />
|
||||
<activity
|
||||
android:name=".activity.CheckNetActivity"
|
||||
android:name=".activity.requestlog.RequestLogActivity"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name=".activity.checknet.CheckNetActivity"
|
||||
android:theme="@style/activity_styles" />
|
||||
|
||||
<service
|
||||
android:name=".service.MainService"
|
||||
android:name=".service.main.MainService"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
@@ -265,7 +268,7 @@
|
||||
<!-- 接收网络变化 连接/断开 since 1.6.3 -->
|
||||
<action android:name="cn.jpush.android.intent.CONNECTION" />
|
||||
|
||||
<!-- <category android:name="${JPUSH_PKGNAME}" />-->
|
||||
<!-- <category android:name="${JPUSH_PKGNAME}" />-->
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<!-- Required. For publish channel feature -->
|
||||
@@ -294,160 +297,164 @@
|
||||
|
||||
<!-- ##############################极光推送############################## -->
|
||||
<!-- Rich push 核心功能 since 2.0.6 -->
|
||||
<!-- <activity-->
|
||||
<!-- android:name="cn.jpush.android.ui.PopWinActivity"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- android:theme="@style/MyDialogStyle"-->
|
||||
<!-- tools:replace="android:exported" />-->
|
||||
<!-- <activity-->
|
||||
<!-- android:name="cn.jpush.android.ui.PopWinActivity"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- android:theme="@style/MyDialogStyle"-->
|
||||
<!-- tools:replace="android:exported" />-->
|
||||
<!-- Required SDK核心功能 -->
|
||||
<!-- <activity-->
|
||||
<!-- android:name="cn.jpush.android.ui.PushActivity"-->
|
||||
<!-- android:configChanges="orientation|keyboardHidden"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- android:theme="@android:style/Theme.NoTitleBar"-->
|
||||
<!-- tools:replace="android:exported">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.ui.PushActivity" />-->
|
||||
<!-- <activity-->
|
||||
<!-- android:name="cn.jpush.android.ui.PushActivity"-->
|
||||
<!-- android:configChanges="orientation|keyboardHidden"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- android:theme="@android:style/Theme.NoTitleBar"-->
|
||||
<!-- tools:replace="android:exported">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.ui.PushActivity" />-->
|
||||
|
||||
<!-- <category android:name="android.intent.category.DEFAULT" />-->
|
||||
<!-- <category android:name="com.aoleyun.sn" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </activity>-->
|
||||
<!-- <category android:name="android.intent.category.DEFAULT" />-->
|
||||
<!-- <category android:name="com.aoleyun.sn" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </activity>-->
|
||||
<!-- Required SDK 核心功能 -->
|
||||
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
||||
<!-- <service-->
|
||||
<!-- android:name="cn.jpush.android.service.PushService"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- android:process=":pushcore">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.REGISTER" />-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.REPORT" />-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.PushService" />-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.PUSH_TIME" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </service>-->
|
||||
<!-- <service-->
|
||||
<!-- android:name="cn.jpush.android.service.PushService"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- android:process=":pushcore">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.REGISTER" />-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.REPORT" />-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.PushService" />-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.PUSH_TIME" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </service>-->
|
||||
<!-- since 3.0.9 Required SDK 核心功能 -->
|
||||
<!-- <provider-->
|
||||
<!-- android:name="cn.jpush.android.service.DataProvider"-->
|
||||
<!-- android:authorities="com.aoleyun.sn.DataProvider"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- android:process=":pushcore"-->
|
||||
<!-- tools:replace="android:authorities" />-->
|
||||
<!-- <provider-->
|
||||
<!-- android:name="cn.jpush.android.service.DataProvider"-->
|
||||
<!-- android:authorities="com.aoleyun.sn.DataProvider"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- android:process=":pushcore"-->
|
||||
<!-- tools:replace="android:authorities" />-->
|
||||
<!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
|
||||
<!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
|
||||
<!-- <service-->
|
||||
<!-- android:name="cn.jpush.android.service.DaemonService"-->
|
||||
<!-- android:enabled="true"-->
|
||||
<!-- android:exported="true">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.DaemonService" />-->
|
||||
<!-- <service-->
|
||||
<!-- android:name="cn.jpush.android.service.DaemonService"-->
|
||||
<!-- android:enabled="true"-->
|
||||
<!-- android:exported="true">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.DaemonService" />-->
|
||||
|
||||
<!-- <category android:name="com.aoleyun.sn" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </service>-->
|
||||
<!-- <category android:name="com.aoleyun.sn" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </service>-->
|
||||
<!-- since 3.1.0 Required SDK 核心功能 -->
|
||||
<!-- <provider-->
|
||||
<!-- android:name="cn.jpush.android.service.DownloadProvider"-->
|
||||
<!-- android:authorities="com.aoleyun.sn.DownloadProvider"-->
|
||||
<!-- android:exported="true"-->
|
||||
<!-- tools:replace="android:authorities" />-->
|
||||
<!-- <provider-->
|
||||
<!-- android:name="cn.jpush.android.service.DownloadProvider"-->
|
||||
<!-- android:authorities="com.aoleyun.sn.DownloadProvider"-->
|
||||
<!-- android:exported="true"-->
|
||||
<!-- tools:replace="android:authorities" />-->
|
||||
<!-- Required SDK核心功能 -->
|
||||
<!-- <receiver-->
|
||||
<!-- android:name="cn.jpush.android.service.PushReceiver"-->
|
||||
<!-- android:enabled="true"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- tools:replace="android:exported">-->
|
||||
<!-- <intent-filter android:priority="1000">-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />-->
|
||||
<!-- <!– Required 显示通知栏 –>-->
|
||||
<!-- <category android:name="com.aoleyun.sn" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.USER_PRESENT" />-->
|
||||
<!-- <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- <!– Optional –>-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.PACKAGE_ADDED" />-->
|
||||
<!-- <action android:name="android.intent.action.PACKAGE_REMOVED" />-->
|
||||
<!-- <receiver-->
|
||||
<!-- android:name="cn.jpush.android.service.PushReceiver"-->
|
||||
<!-- android:enabled="true"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- tools:replace="android:exported">-->
|
||||
<!-- <intent-filter android:priority="1000">-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />-->
|
||||
<!-- <!– Required 显示通知栏 –>-->
|
||||
<!-- <category android:name="com.aoleyun.sn" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.USER_PRESENT" />-->
|
||||
<!-- <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- <!– Optional –>-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.PACKAGE_ADDED" />-->
|
||||
<!-- <action android:name="android.intent.action.PACKAGE_REMOVED" />-->
|
||||
|
||||
<!-- <data android:scheme="package" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </receiver>-->
|
||||
<!-- <data android:scheme="package" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </receiver>-->
|
||||
<!-- Required SDK核心功能 -->
|
||||
<!-- <receiver-->
|
||||
<!-- android:name="cn.jpush.android.service.AlarmReceiver"-->
|
||||
<!-- android:exported="false" />-->
|
||||
<!-- <receiver-->
|
||||
<!-- android:name="cn.jpush.android.service.AlarmReceiver"-->
|
||||
<!-- android:exported="false" />-->
|
||||
<!-- since 3.3.0 Required SDK核心功能 -->
|
||||
<!-- <activity-->
|
||||
<!-- android:name="cn.jpush.android.service.JNotifyActivity"-->
|
||||
<!-- android:exported="true"-->
|
||||
<!-- android:taskAffinity="jpush.custom"-->
|
||||
<!-- android:theme="@android:style/Theme.Translucent.NoTitleBar">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.JNotifyActivity" />-->
|
||||
<!-- <activity-->
|
||||
<!-- android:name="cn.jpush.android.service.JNotifyActivity"-->
|
||||
<!-- android:exported="true"-->
|
||||
<!-- android:taskAffinity="jpush.custom"-->
|
||||
<!-- android:theme="@android:style/Theme.Translucent.NoTitleBar">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.JNotifyActivity" />-->
|
||||
|
||||
<!-- <category android:name="com.aoleyun.sn" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </activity>-->
|
||||
<!-- <category android:name="com.aoleyun.sn" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </activity>-->
|
||||
<!-- Since JCore2.0.0 Required SDK核心功能 -->
|
||||
<!-- 这个Service要继承JCommonService -->
|
||||
<!-- <service-->
|
||||
<!-- android:name=".jpush.PushService"-->
|
||||
<!-- android:process=":pushcore">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jiguang.user.service.action" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </service>-->
|
||||
<!-- <service-->
|
||||
<!-- android:name=".jpush.PushService"-->
|
||||
<!-- android:process=":pushcore">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jiguang.user.service.action" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </service>-->
|
||||
<!-- User defined. For test only 用户自定义的广播接收器 -->
|
||||
<!-- <receiver-->
|
||||
<!-- android:name=".jpush.MyReceiver"-->
|
||||
<!-- android:enabled="true"-->
|
||||
<!-- android:exported="false">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.REGISTRATION" />-->
|
||||
<!-- <!– Required 用户注册SDK的intent –>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />-->
|
||||
<!-- <!– Required 用户接收SDK消息的intent –>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />-->
|
||||
<!-- <!– Required 用户接收SDK通知栏信息的intent –>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />-->
|
||||
<!-- <!– Required 用户打开自定义通知栏的intent –>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.CONNECTION" />-->
|
||||
<!-- <!– 接收网络变化 连接/断开 since 1.6.3 –>-->
|
||||
<!-- <category android:name="com.aoleyun.sn" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </receiver>-->
|
||||
<!-- <receiver-->
|
||||
<!-- android:name=".jpush.MyReceiver"-->
|
||||
<!-- android:enabled="true"-->
|
||||
<!-- android:exported="false">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.REGISTRATION" />-->
|
||||
<!-- <!– Required 用户注册SDK的intent –>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />-->
|
||||
<!-- <!– Required 用户接收SDK消息的intent –>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />-->
|
||||
<!-- <!– Required 用户接收SDK通知栏信息的intent –>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />-->
|
||||
<!-- <!– Required 用户打开自定义通知栏的intent –>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.CONNECTION" />-->
|
||||
<!-- <!– 接收网络变化 连接/断开 since 1.6.3 –>-->
|
||||
<!-- <category android:name="com.aoleyun.sn" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </receiver>-->
|
||||
<!-- User defined. For test only 用户自定义接收消息器,3.0.7开始支持,目前新tag/alias接口设置结果会在该广播接收器对应的方法中回调 -->
|
||||
<!-- <receiver android:name=".jpush.MyJPushMessageReceiver">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />-->
|
||||
<!-- <receiver android:name=".jpush.MyJPushMessageReceiver">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />-->
|
||||
|
||||
<!-- <category android:name="com.aoleyun.sn" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </receiver>-->
|
||||
<!-- <category android:name="com.aoleyun.sn" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </receiver>-->
|
||||
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="JPUSH_CHANNEL"-->
|
||||
<!-- android:value="developer-default" />-->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="JPUSH_CHANNEL"-->
|
||||
<!-- android:value="developer-default" />-->
|
||||
<!-- Required. AppKey copied from Portal -->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="JPUSH_APPKEY"-->
|
||||
<!-- android:value="${JPUSH_APPKEY}" />-->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="CHANNEL_VALUE"-->
|
||||
<!-- android:value="${channel_value}" />-->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="JPUSH_APPKEY"-->
|
||||
<!-- android:value="${JPUSH_APPKEY}" />-->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="CHANNEL_VALUE"-->
|
||||
<!-- android:value="${channel_value}" />-->
|
||||
|
||||
<!-- 应用的其它配置 -->
|
||||
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
|
||||
<uses-library
|
||||
android:name="org.apache.http.legacy"
|
||||
android:required="false" />
|
||||
<!-- 【必须】 移动推送 TPNS 默认通知 -->
|
||||
<activity android:name="com.tencent.android.tpush.TpnsActivity"
|
||||
<activity
|
||||
android:name="com.tencent.android.tpush.TpnsActivity"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<data
|
||||
android:scheme="tpns"
|
||||
android:host="com.aoleyun.sn"/>
|
||||
android:host="com.aoleyun.sn"
|
||||
android:scheme="tpns" />
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
@@ -480,7 +487,8 @@
|
||||
android:process=":xg_vip_service" />
|
||||
|
||||
<!-- 【必须】通知 service ,android:name 部分改为包名.XGVIP_PUSH_ACTION -->
|
||||
<service android:name="com.tencent.android.tpush.rpc.XGRemoteService"
|
||||
<service
|
||||
android:name="com.tencent.android.tpush.rpc.XGRemoteService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<!-- 【必须】请修改为当前APP名包.XGVIP_PUSH_ACTION -->
|
||||
@@ -517,14 +525,15 @@
|
||||
</receiver>
|
||||
|
||||
<!-- MQTT START -->
|
||||
<service android:exported="false"
|
||||
android:process=":xg_vip_service"
|
||||
android:name="com.tencent.tpns.mqttchannel.services.MqttService" />
|
||||
<service
|
||||
android:name="com.tencent.tpns.mqttchannel.services.MqttService"
|
||||
android:exported="false"
|
||||
android:process=":xg_vip_service" />
|
||||
|
||||
<provider
|
||||
android:exported="false"
|
||||
android:name="com.tencent.tpns.baseapi.base.SettingsContentProvider"
|
||||
android:authorities="com.aoleyun.sn.XG_SETTINGS_PROVIDER" />
|
||||
android:authorities="com.aoleyun.sn.XG_SETTINGS_PROVIDER"
|
||||
android:exported="false" />
|
||||
|
||||
<!-- MQTT END-->
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.aoleyun.sn.action;
|
||||
|
||||
public class JGYActions {
|
||||
/*
|
||||
* 需要写到底层的数据
|
||||
* */
|
||||
//设备锁定状态
|
||||
public final static String ACTION_QCH_UNLOCK_IPAD = "qch_unlock_ipad";
|
||||
//应用管理-允许联网
|
||||
public final static String ACTION_HR_RECEIVER_JGY = "qch_jgy_network_allow";
|
||||
//应用管理-禁止联网
|
||||
public final static String ACTION_HR_RECEIVER_JGY_DIS = "qch_jgy_network_disallow";
|
||||
//
|
||||
public final static String ACTION_STATUS_BAR_STATUS = "jgy_statusbar_status";
|
||||
//
|
||||
|
||||
/*
|
||||
* 应用内部的数据
|
||||
* */
|
||||
|
||||
//后台上传所有应用包名 将添加到桌面
|
||||
// TODO: 2021/10/13
|
||||
public final static String ACTION_JGY_SHORTCUTLIST = "only_jgy_shortcut_list";
|
||||
|
||||
|
||||
}
|
||||
@@ -23,10 +23,11 @@ import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.activity.main.MainActivity;
|
||||
import com.aoleyun.sn.base.BaseApplication;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
import com.aoleyun.sn.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.service.LogcatService;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.utils.SPUtils;
|
||||
@@ -43,7 +44,6 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
private static String TAG = SplashActivity.class.getSimpleName();
|
||||
private Button bt_log;
|
||||
@@ -78,6 +78,8 @@ public class SplashActivity extends AppCompatActivity {
|
||||
|
||||
private void initView() {
|
||||
if (BuildConfig.DEBUG) {
|
||||
JGYUtils.getInstance().cleanBackgroundMemory();
|
||||
NetInterfaceManager.getInstance().uploadLogFile();
|
||||
bt_log = findViewById(R.id.bt_log);
|
||||
bt_log.setVisibility(View.VISIBLE);
|
||||
bt_log.setOnClickListener(view -> {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
package com.aoleyun.sn.activity;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
package com.aoleyun.sn.activity.checknet;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -18,12 +16,11 @@ import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.activity.main.MainContact;
|
||||
import com.aoleyun.sn.activity.main.MainPresenter;
|
||||
import com.aoleyun.sn.base.BaseActivity;
|
||||
import com.aoleyun.sn.service.MainService;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.aoleyun.sn.utils.ExampleUtil;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.utils.SaveListUtils;
|
||||
@@ -37,7 +34,7 @@ import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
|
||||
public class CheckNetActivity extends BaseActivity implements MainContact.MainView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
public class CheckNetActivity extends BaseActivity implements CheckNetContact.MainView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
@BindView(R.id.giv_1)
|
||||
GifImageView giv_1;
|
||||
@BindView(R.id.giv_2)
|
||||
@@ -54,7 +51,7 @@ public class CheckNetActivity extends BaseActivity implements MainContact.MainVi
|
||||
Button bt_confirm;
|
||||
|
||||
private static final String TAG = CheckNetActivity.class.getSimpleName();
|
||||
private MainPresenter mPresenter;
|
||||
private CheckNetPresenter mPresenter;
|
||||
|
||||
private boolean netWorkIsRunning = false;
|
||||
private boolean updateApp = false;
|
||||
@@ -92,7 +89,7 @@ public class CheckNetActivity extends BaseActivity implements MainContact.MainVi
|
||||
@Override
|
||||
public void initView() {
|
||||
ButterKnife.bind(this);
|
||||
mPresenter = new MainPresenter(this);
|
||||
mPresenter = new CheckNetPresenter(this);
|
||||
mPresenter.attachView(this);
|
||||
mPresenter.setProvider(this);
|
||||
JGYUtils.startServices(CheckNetActivity.this);
|
||||
@@ -121,6 +118,7 @@ public class CheckNetActivity extends BaseActivity implements MainContact.MainVi
|
||||
finish();
|
||||
}
|
||||
});
|
||||
mPresenter.getFirstConnect();
|
||||
}
|
||||
|
||||
private static class Resut {
|
||||
@@ -176,32 +174,6 @@ public class CheckNetActivity extends BaseActivity implements MainContact.MainVi
|
||||
// mPresenter.getStudesInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQRImage(Bitmap qrImage) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchText(String text, int visibility) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClassText(String text, int visibility) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNumberText(String text, int visibility) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNameText(String text, int visibility) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHead(String url) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loocked 后台1是锁定,底层0是锁定
|
||||
*/
|
||||
@@ -212,8 +184,6 @@ public class CheckNetActivity extends BaseActivity implements MainContact.MainVi
|
||||
//设置极光推送别名
|
||||
mPresenter.setJpushAlias();
|
||||
if (loocked) {
|
||||
//上传APP信息
|
||||
ApkUtils.getAppInfo(this);
|
||||
if (netWorkIsRunning || MainService.netWorkIsRunning) {
|
||||
//如果正在执行,不执行
|
||||
return;
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.aoleyun.sn.activity.checknet;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.aoleyun.sn.base.BasePresenter;
|
||||
import com.aoleyun.sn.base.BaseView;
|
||||
|
||||
public class CheckNetContact {
|
||||
public interface Presenter extends BasePresenter<MainView> {
|
||||
//获取设备锁定状态
|
||||
void getLockedState();
|
||||
//是否第一次联网
|
||||
void getFirstConnect();
|
||||
//关闭所有功能
|
||||
void setDisableSetting();
|
||||
//发送mac地址
|
||||
void sendMACAddress();
|
||||
//更新设备信息
|
||||
void updateDeviceInfo();
|
||||
//获取时间管控
|
||||
void getSnTimeControl();
|
||||
//获取电子书包激活码
|
||||
void getEBagCode();
|
||||
//设置击关推送别名
|
||||
void setJpushAlias();
|
||||
//设置极光推送平台标签
|
||||
void setJpushPlatformTags(int platform);
|
||||
//获取应用市场更新
|
||||
void checkStoreUpdate();
|
||||
//获取设备信息更新
|
||||
void checkInfoUpdate();
|
||||
//获取桌面升级
|
||||
void checkDesktopUpdate();
|
||||
//获取通知升级
|
||||
void checkNotifyUpdate();
|
||||
//获取浏览器升级
|
||||
void checkBrowserUpdate();
|
||||
//手动获取设备信息更新
|
||||
void buttonCheckUpdate(View view);
|
||||
//获取测试应用更新
|
||||
void checkTestUpdate();
|
||||
//开始
|
||||
//设置极光推送标签
|
||||
void setPushTags();
|
||||
//获取开发者选项
|
||||
void getDeveloper();
|
||||
//获取设备后台设置
|
||||
void getSystemSettingbegin();
|
||||
//获取可被写入的安装包名
|
||||
void getAppLimit();
|
||||
//获取设备批次
|
||||
void getDeviceBatch(String packageList);
|
||||
//获取强制下载apk
|
||||
void getForceDownload();
|
||||
//获取浏览器上网管控设置
|
||||
void getBrowserList();
|
||||
//获取浏览器书签设置管控
|
||||
void getBrowserBookmarks(String whitelist);
|
||||
//设置白名单的url
|
||||
void getBrowserWhiteList();
|
||||
//获取应用图标桌面可见性管控
|
||||
void getDesktopIcon();
|
||||
//获取应用自启升级和网络权限管理
|
||||
void getAppAutoStartUpdateAndNet();
|
||||
//获取第三方应用子页面ID连网限制
|
||||
void getAppIDControl();
|
||||
//获取第三方应用内部网页跳转屏蔽
|
||||
void setAppinsideWeb();
|
||||
//获取系统其他管控设置
|
||||
void setSystemSetting();
|
||||
//获取系统默认程序设置
|
||||
void getDefaultApp();
|
||||
//获取自定义版本内置app
|
||||
void getROMApp();
|
||||
//设置开机动画
|
||||
void setLogoImg();
|
||||
//应用霸屏
|
||||
void setTopApp();
|
||||
//获取桌面
|
||||
void getDefaultDesktop();
|
||||
//获取关机时间
|
||||
void getPoweroffTime();
|
||||
//获取wifi密码
|
||||
void getWiFiPasswd();
|
||||
/*
|
||||
* MainService
|
||||
* */
|
||||
//获取屏幕锁状态
|
||||
void getScreenLockState();
|
||||
}
|
||||
|
||||
public interface MainView extends BaseView {
|
||||
//获取设备锁定状态
|
||||
void setLockedState(boolean loocked);
|
||||
//是否第一次联网
|
||||
void setFirstConnect(boolean state);
|
||||
//发送mac地址
|
||||
void sendMACFinish();
|
||||
//更新设备信息
|
||||
void updateDeviceInfoFinish();
|
||||
//获取时间管控
|
||||
void getSnTimeControlFinish();
|
||||
//获取电子书包激活码
|
||||
void getEBagCodeFinish();
|
||||
//设置击关推送别名
|
||||
void setAliasFinish();
|
||||
//设置极光推送平台标签
|
||||
void setJpushPlatformTagsFinish();
|
||||
//获取应用市场更新
|
||||
void checkStoreUpdateFinish();
|
||||
//获取设备信息更新
|
||||
void checkInfoUpdateFinish();
|
||||
//获取桌面升级
|
||||
void checkDesktopUpdateFinish();
|
||||
//获取通知升级
|
||||
void checkNotifyUpdateFinish();
|
||||
//获取浏览器升级
|
||||
void checkBrowserUpdateFinish();
|
||||
//手动获取设备信息更新
|
||||
void buttonCheckUpdateFinish(boolean update, JsonObject jsonObject);
|
||||
//获取测试应用更新
|
||||
void checkTestUpdateFinish();
|
||||
//开始
|
||||
//设置极光推送标签
|
||||
void setTagsFinish(boolean noTag);
|
||||
//获取开发者选项结束
|
||||
void getDeveloperFinish();
|
||||
//设置设备后台设置
|
||||
void getSystemSettingbegin();
|
||||
//获取可被写入的安装包名结束
|
||||
void getAppLimitFinish(String packageList);
|
||||
//获取设备批次结束
|
||||
void getDeviceBatchFinish();
|
||||
//获取强制下载apk结束
|
||||
void getForceDownloadFinish();
|
||||
//获取浏览器上网管控设置结束
|
||||
void getBrowserListFinish(String whitelist);
|
||||
//获取浏览器书签设置管控结束
|
||||
void getBrowserBookmarksFinish();
|
||||
//获取应用图标桌面可见性管控结束
|
||||
void getDesktopIconFinish();
|
||||
//获取应用自启升级和网络权限管理结束
|
||||
void getAppAutoStartUpdateAndNetFinish();
|
||||
//获取第三方应用子页面ID连网限制结束
|
||||
void getAppIDControlFinish();
|
||||
//获取第三方应用内部网页跳转屏蔽结束
|
||||
void setAppinsideWebFinish();
|
||||
//获取系统其他管控设置结束
|
||||
void setSystemSettingFinish();
|
||||
//获取系统默认程序设置
|
||||
void setDefaultAppFinish();
|
||||
//获取自定义版本内置app
|
||||
void getROMAppFinish();
|
||||
|
||||
//设置开机动画
|
||||
void setLogoImgFinish();
|
||||
//获取应用霸屏结束
|
||||
void setTopAppFinish();
|
||||
//获取桌面结束
|
||||
void getDefaultDesktopFinish();
|
||||
//获取关机时间
|
||||
void setPoweroffTime();
|
||||
//获取wifi密码结束
|
||||
void setWiFiPasswd();
|
||||
/*
|
||||
* MainService
|
||||
* */
|
||||
//设置屏幕锁状态结束
|
||||
void setScreenLockStateFinish(boolean locked, String tips);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
package com.aoleyun.sn.activity.main;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.aoleyun.sn.base.BasePresenter;
|
||||
import com.aoleyun.sn.base.BaseView;
|
||||
|
||||
public class MainAContact {
|
||||
public interface Presenter extends BasePresenter<MainView> {
|
||||
//设置二维码
|
||||
void getQRImage(String mac);
|
||||
//获取学生信息
|
||||
void getStudesInfo();
|
||||
//获取设备锁定状态
|
||||
void getLockedState();
|
||||
//手动获取设备信息更新
|
||||
void buttonCheckUpdate(View view);
|
||||
}
|
||||
|
||||
public interface MainView extends BaseView {
|
||||
//获取二维码
|
||||
void setQRImage(Bitmap qrImage);
|
||||
//设置批次信息
|
||||
void setBatchText(String text, int visibility);
|
||||
//设置班级信息
|
||||
void setClassText(String text, int visibility);
|
||||
//设置学号信息
|
||||
void setNumberText(String text, int visibility);
|
||||
//设置姓名信息
|
||||
void setNameText(String text, int visibility);
|
||||
//设置头像
|
||||
void setHead(String url);
|
||||
//获取设备锁定状态
|
||||
void setLockedState(boolean loocked);
|
||||
//手动获取设备信息更新
|
||||
void buttonCheckUpdateFinish(boolean update, JsonObject jsonObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
package com.aoleyun.sn.activity.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.StudentsInfo;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.utils.AES.CXAESUtil;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.utils.SPUtils;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle2.LifecycleProvider;
|
||||
import com.trello.rxlifecycle2.android.ActivityEvent;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* MainActivity和MainService 的 Presenter
|
||||
*
|
||||
* @author jgy
|
||||
*/
|
||||
public class MainAPresenter implements MainAContact.Presenter {
|
||||
private static final String TAG = MainAPresenter.class.getSimpleName();
|
||||
private MainAContact.MainView mView;
|
||||
private Context mContext;
|
||||
|
||||
public static final String GET_SETTING_FINISH_TIME = "GET_SETTING_FINISH_TIME";
|
||||
|
||||
//是否有接口请求成功
|
||||
public boolean requestSucceeded = false;
|
||||
private final String DEFAULT_INFO = "暂无信息";
|
||||
private final int OK = 200;
|
||||
|
||||
private final static int NOTFOUND = -300;
|
||||
|
||||
private LifecycleProvider<ActivityEvent> provider;
|
||||
|
||||
public void setProvider(LifecycleProvider<ActivityEvent> provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public LifecycleProvider<ActivityEvent> getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public MainAPresenter(Context context) {
|
||||
this.mContext = context;
|
||||
Log.e(TAG, "MainSPresenter: " + context.getClass());
|
||||
}
|
||||
|
||||
public boolean isRequestSucceeded() {
|
||||
return requestSucceeded;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachView(@androidx.annotation.NonNull MainAContact.MainView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
private native String getAeskey();
|
||||
|
||||
@Override
|
||||
public void getQRImage(String mac) {
|
||||
Log.e(TAG, "getQRImage: " + mac);
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("sn", Utils.getSerial());
|
||||
jsonObject.addProperty("mac", mac);
|
||||
String json = jsonObject.toString();
|
||||
String content = mac;
|
||||
try {
|
||||
content = CXAESUtil.encrypt(getAeskey(), json);
|
||||
Log.e(TAG, "getQRImage: " + content);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "getQRImage: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
mView.setQRImage(JGYUtils.getInstance().createQRImage(content, 300, 300));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过sn获取用户信息
|
||||
*/
|
||||
@Override
|
||||
public void getStudesInfo() {
|
||||
setState();
|
||||
NetInterfaceManager.getInstance()
|
||||
.getStudesInfoObservable()
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<StudentsInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e(TAG + ":" + "getStudesInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<StudentsInfo> studentsInfoBaseResponse) {
|
||||
requestSucceeded = true;
|
||||
Log.e(TAG + ":" + "getStudesInfo", "onNext: " + studentsInfoBaseResponse.data);
|
||||
if (studentsInfoBaseResponse.code == OK) {
|
||||
String sno = studentsInfoBaseResponse.data.getSno();
|
||||
String realname = studentsInfoBaseResponse.data.getRealname();
|
||||
String classes = studentsInfoBaseResponse.data.getClasses();
|
||||
String batch = studentsInfoBaseResponse.data.getBatch();
|
||||
String head_img = studentsInfoBaseResponse.data.getHead_img();
|
||||
if (TextUtils.isEmpty(sno)) {
|
||||
mView.setNumberText("", View.GONE);
|
||||
SPUtils.put(mContext, CommonConfig.STUDENT_ID, DEFAULT_INFO);
|
||||
} else {
|
||||
mView.setNumberText(sno, View.VISIBLE);
|
||||
SPUtils.put(mContext, CommonConfig.STUDENT_ID, sno);
|
||||
}
|
||||
if (TextUtils.isEmpty(realname)) {
|
||||
mView.setNameText("", View.GONE);
|
||||
SPUtils.put(mContext, CommonConfig.REALNAME, DEFAULT_INFO);
|
||||
} else {
|
||||
mView.setNameText(realname, View.VISIBLE);
|
||||
SPUtils.put(mContext, CommonConfig.REALNAME, realname);
|
||||
}
|
||||
if (TextUtils.isEmpty(classes)) {
|
||||
mView.setClassText("", View.GONE);
|
||||
SPUtils.put(mContext, CommonConfig.CLASS_NAME, DEFAULT_INFO);
|
||||
} else {
|
||||
mView.setClassText(classes, View.VISIBLE);
|
||||
SPUtils.put(mContext, CommonConfig.CLASS_NAME, classes);
|
||||
}
|
||||
if (TextUtils.isEmpty(batch)) {
|
||||
mView.setBatchText("", View.GONE);
|
||||
SPUtils.put(mContext, CommonConfig.BATCH_NAME, DEFAULT_INFO);
|
||||
} else {
|
||||
mView.setBatchText(batch, View.VISIBLE);
|
||||
SPUtils.put(mContext, CommonConfig.BATCH_NAME, batch);
|
||||
}
|
||||
if (TextUtils.isEmpty(head_img)) {
|
||||
mView.setHead("");
|
||||
SPUtils.put(mContext, CommonConfig.HEAD_IMG, "");
|
||||
} else {
|
||||
mView.setHead(head_img);
|
||||
SPUtils.put(mContext, CommonConfig.HEAD_IMG, head_img);
|
||||
}
|
||||
|
||||
SPUtils.put(mContext, CommonConfig.ADMIN_ID, studentsInfoBaseResponse.data.getAdmin_id());
|
||||
} else {
|
||||
/*
|
||||
* 没有获取到的时候显示缓存
|
||||
* */
|
||||
Log.e(TAG + ":" + "getStudesInfo", "onNext: " + studentsInfoBaseResponse.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e(TAG + ":" + "getStudesInfo", "onError: " + e.getMessage());
|
||||
setState();
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
//如果是解锁状态就隐藏,锁定就显示缓存
|
||||
if (Settings.System.getInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, 0) == 1) {
|
||||
mView.setNumberText("", View.GONE);
|
||||
mView.setNameText("", View.GONE);
|
||||
mView.setClassText("", View.GONE);
|
||||
mView.setBatchText("", View.GONE);
|
||||
}
|
||||
Log.e(TAG + ":" + "getStudesInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setState() {
|
||||
String batch = (String) SPUtils.get(mContext, CommonConfig.BATCH_NAME, DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(batch) || batch.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setBatchText("", View.GONE);
|
||||
} else {
|
||||
mView.setBatchText(batch, View.VISIBLE);
|
||||
}
|
||||
|
||||
String classes = (String) SPUtils.get(mContext, CommonConfig.CLASS_NAME, DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(classes) || classes.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setClassText("", View.GONE);
|
||||
} else {
|
||||
mView.setClassText(classes, View.VISIBLE);
|
||||
}
|
||||
|
||||
String sno = (String) SPUtils.get(mContext, CommonConfig.STUDENT_ID, DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(sno) || sno.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setNumberText("", View.GONE);
|
||||
} else {
|
||||
mView.setNumberText(sno, View.VISIBLE);
|
||||
}
|
||||
String realname = (String) SPUtils.get(mContext, CommonConfig.REALNAME, DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(realname) || realname.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setNameText("", View.GONE);
|
||||
} else {
|
||||
mView.setNameText(realname, View.VISIBLE);
|
||||
}
|
||||
String head_img = (String) SPUtils.get(mContext, CommonConfig.HEAD_IMG, DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(head_img) || head_img.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setHead("");
|
||||
} else {
|
||||
mView.setHead(head_img);
|
||||
}
|
||||
}
|
||||
|
||||
private long lastgetLockedTime;
|
||||
|
||||
private long one_minute = 1000 * 60;
|
||||
|
||||
@Override
|
||||
public void getLockedState() {
|
||||
MMKV mmkv = MMKV.defaultMMKV();
|
||||
lastgetLockedTime = mmkv.decodeLong(MainAPresenter.GET_SETTING_FINISH_TIME);
|
||||
Log.e(TAG, "getLockedState: " + lastgetLockedTime);
|
||||
if (System.currentTimeMillis() - lastgetLockedTime < one_minute) {
|
||||
Log.e(TAG, "getLockedState: lastgetLockedTime = " + lastgetLockedTime);
|
||||
return;
|
||||
}
|
||||
|
||||
NetInterfaceManager.getInstance().getLockedState(provider, new NetInterfaceManager.ObserverCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG, "onComplete: ");
|
||||
int locked = Settings.System.getInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
|
||||
Log.e(TAG + ":" + "getLockedState", "locked: " + locked);
|
||||
mView.setLockedState(locked == JGYActions.FRAME_CODE_LOCKED);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonCheckUpdate(View view) {
|
||||
checkUpdateInfo();
|
||||
}
|
||||
|
||||
private void checkUpdateInfo() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUpdateApi()
|
||||
.getUpdate(BuildConfig.APPLICATION_ID,
|
||||
JGYUtils.getInstance().checkAppPlatform())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e(TAG + ":" + "checkUpdateInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
requestSucceeded = true;
|
||||
Log.e(TAG + ":" + "checkUpdateInfo", "onNext: " + response);
|
||||
if (response.code == OK) {
|
||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||
long versionCode = jsonObject.get("version_code").getAsLong();
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
PackageInfo info = null;
|
||||
try {
|
||||
info = pm.getPackageInfo(BuildConfig.APPLICATION_ID, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (null == info || info.versionCode < versionCode) {
|
||||
mView.buttonCheckUpdateFinish(true, jsonObject);
|
||||
} else {
|
||||
mView.buttonCheckUpdateFinish(false, null);
|
||||
}
|
||||
} else {
|
||||
mView.buttonCheckUpdateFinish(false, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e(TAG + ":" + "checkUpdateInfo", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + ":" + "checkUpdateInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.aoleyun.sn.activity.main;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@@ -19,13 +20,12 @@ import android.widget.TextView;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.activity.requestlog.RequestLogActivity;
|
||||
import com.aoleyun.sn.base.BaseActivity;
|
||||
import com.aoleyun.sn.service.MainService;
|
||||
import com.aoleyun.sn.rlog.LogDBManager;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.ExampleUtil;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
@@ -33,7 +33,9 @@ import com.aoleyun.sn.utils.SaveListUtils;
|
||||
import com.aoleyun.sn.utils.SysSettingUtils;
|
||||
import com.aoleyun.sn.utils.ToastUtil;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -48,7 +50,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class MainActivity extends BaseActivity implements MainContact.MainView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
public class MainActivity extends BaseActivity implements MainAContact.MainView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private static final String TAG = MainActivity.class.getSimpleName();
|
||||
|
||||
@BindView(R.id.imageView)
|
||||
@@ -84,9 +86,37 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
@BindView(R.id.tv_customversion)
|
||||
TextView tv_customversion;
|
||||
|
||||
private MainPresenter mPresenter;
|
||||
@OnClick({R.id.back, R.id.tv_title, R.id.chkupd})
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.back:
|
||||
lazyExit();
|
||||
break;
|
||||
case R.id.tv_title:
|
||||
continuousClick(COUNTS, DURATION);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final static int COUNTS = 3;// 点击次数
|
||||
final static long DURATION = 1000;// 规定有效时间
|
||||
long[] mHits = new long[COUNTS];
|
||||
|
||||
private void continuousClick(int count, long time) {
|
||||
//每次点击时,数组向前移动一位
|
||||
System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);
|
||||
//为数组最后一位赋值
|
||||
mHits[mHits.length - 1] = SystemClock.uptimeMillis();
|
||||
if (mHits[0] >= (SystemClock.uptimeMillis() - DURATION)) {
|
||||
mHits = new long[COUNTS];//重新初始化数组
|
||||
startActivity(new Intent(MainActivity.this, RequestLogActivity.class));
|
||||
}
|
||||
}
|
||||
|
||||
private MainAPresenter mPresenter;
|
||||
|
||||
private boolean netWorkIsRunning = false;
|
||||
private boolean updateApp = false;
|
||||
|
||||
//jiguang
|
||||
@@ -98,6 +128,19 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
public static final String KEY_MESSAGE = "message";
|
||||
public static final String KEY_EXTRAS = "extras";
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
Log.e("OnNetworkStatusChanged", "onDisconnected: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
Log.e("OnNetworkStatusChanged", "onConnected: ");
|
||||
timeMillis = SystemClock.elapsedRealtime();
|
||||
//直接获取数据
|
||||
mPresenter.getLockedState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_main;
|
||||
@@ -106,12 +149,11 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
@Override
|
||||
public void initView() {
|
||||
ButterKnife.bind(this);
|
||||
mPresenter = new MainPresenter(this);
|
||||
mPresenter = new MainAPresenter(this);
|
||||
mPresenter.attachView(this);
|
||||
mPresenter.setProvider(this);
|
||||
JGYUtils.startServices(MainActivity.this);
|
||||
Log.e(TAG, "initView: " + "start request");
|
||||
mPresenter.getFirstConnect();
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
getDevicesInfo();
|
||||
setStoreUpdateListener(bt_checkupdate);
|
||||
@@ -149,7 +191,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
// showSNErrorDialog("SN数据与平台不符,请联系管理员!");
|
||||
}
|
||||
//设置极光推送标签
|
||||
JGYUtils.getInstance().getAppPlatform(platform -> mPresenter.setJpushPlatformTags(platform));
|
||||
// JGYUtils.getInstance().getAppPlatform(platform -> mPresenter.setJpushPlatformTags(platform));
|
||||
}
|
||||
|
||||
private void showSNErrorDialog(String content) {
|
||||
@@ -224,103 +266,19 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
*/
|
||||
@Override
|
||||
public void setLockedState(boolean loocked) {
|
||||
//发送设备mac地址和信息
|
||||
mPresenter.sendMACAddress();
|
||||
//设置极光推送别名
|
||||
mPresenter.setJpushAlias();
|
||||
//设置极光推送标签
|
||||
mPresenter.setPushTags();
|
||||
Log.e(TAG, "netWorkIsRunning: " + netWorkIsRunning);
|
||||
Log.e(TAG, "MainService.netWorkIsRunning: " + MainService.netWorkIsRunning);
|
||||
Log.e(TAG, "setLockedState: " + loocked);
|
||||
if (loocked) {
|
||||
iv_locked.setVisibility(View.VISIBLE);
|
||||
iv_locked.setImageDrawable(getDrawable(R.drawable.locked));
|
||||
//上传APP信息
|
||||
ApkUtils.getAppInfo(this);
|
||||
if (netWorkIsRunning || MainService.netWorkIsRunning) {
|
||||
//如果正在执行,不执行
|
||||
return;
|
||||
}
|
||||
SaveListUtils.getList();
|
||||
netWorkIsRunning = true;
|
||||
} else {
|
||||
iv_locked.setVisibility(View.VISIBLE);
|
||||
iv_locked.setImageDrawable(getDrawable(R.drawable.unlock));
|
||||
netWorkIsRunning = false;
|
||||
SysSettingUtils.setEnableSetting(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 首次使用默认关闭所有功能
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
@Override
|
||||
public void setFirstConnect(boolean state) {
|
||||
Log.e(TAG, "isFirstConnect: " + "end request");
|
||||
if (state) {
|
||||
mPresenter.setDisableSetting();
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMACFinish() {
|
||||
mPresenter.updateDeviceInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeviceInfoFinish() {
|
||||
mPresenter.getSnTimeControl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSnTimeControlFinish() {
|
||||
mPresenter.getEBagCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getEBagCodeFinish() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAliasFinish() {
|
||||
mPresenter.checkStoreUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJpushPlatformTagsFinish() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkStoreUpdateFinish() {
|
||||
mPresenter.checkInfoUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkInfoUpdateFinish() {
|
||||
mPresenter.checkDesktopUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkDesktopUpdateFinish() {
|
||||
mPresenter.checkNotifyUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkNotifyUpdateFinish() {
|
||||
mPresenter.checkBrowserUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkBrowserUpdateFinish() {
|
||||
mPresenter.checkTestUpdate();
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
public void buttonCheckUpdateFinish(boolean update, JsonObject jsonObject) {
|
||||
this.updateApp = !update;
|
||||
@@ -333,32 +291,6 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkTestUpdateFinish() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param noTag 为空,没有,错误都返回true
|
||||
* 设备可以没有批次,但是没有批次相当于没有数据了,就不执行下面的请求了
|
||||
*/
|
||||
@Override
|
||||
public void setTagsFinish(boolean noTag) {
|
||||
if (noTag) {
|
||||
Log.e(TAG, "setTagsFinished: " + "not set tag");
|
||||
netWorkIsRunning = false;
|
||||
Log.e(TAG, "SettingFinished: " + (SystemClock.elapsedRealtime() - timeMillis) + " ms");
|
||||
} else {
|
||||
mPresenter.getSystemSettingbegin();
|
||||
}
|
||||
mPresenter.getDeveloper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeveloperFinish() {
|
||||
Log.e(TAG, "getDeveloperFinished: ");
|
||||
}
|
||||
|
||||
private void showDialog(JsonObject jsonObject) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("更新:");
|
||||
@@ -383,113 +315,16 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
builder.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSystemSettingbegin() {
|
||||
mPresenter.getAppLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppLimitFinish(String packageList) {
|
||||
mPresenter.getDeviceBatch(packageList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeviceBatchFinish() {
|
||||
mPresenter.getForceDownload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getForceDownloadFinish() {
|
||||
mPresenter.getBrowserList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBrowserListFinish(String whitelist) {
|
||||
mPresenter.getBrowserBookmarks(whitelist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBrowserBookmarksFinish() {
|
||||
mPresenter.getBrowserWhiteList();
|
||||
mPresenter.getDesktopIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDesktopIconFinish() {
|
||||
mPresenter.getAppAutoStartUpdateAndNet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppAutoStartUpdateAndNetFinish() {
|
||||
mPresenter.getAppIDControl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppIDControlFinish() {
|
||||
mPresenter.setAppinsideWeb();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAppinsideWebFinish() {
|
||||
mPresenter.setSystemSetting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSystemSettingFinish() {
|
||||
mPresenter.getDefaultApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultAppFinish() {
|
||||
mPresenter.getROMApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getROMAppFinish() {
|
||||
mPresenter.setLogoImg();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogoImgFinish() {
|
||||
mPresenter.setTopApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTopAppFinish() {
|
||||
mPresenter.getDefaultDesktop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDefaultDesktopFinish() {
|
||||
mPresenter.getPoweroffTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPoweroffTime() {
|
||||
mPresenter.getWiFiPasswd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWiFiPasswd() {
|
||||
MMKV.defaultMMKV().encode(MainPresenter.GET_SETTING_FINISH_TIME, System.currentTimeMillis());
|
||||
netWorkIsRunning = false;
|
||||
Log.e(TAG, "SettingFinished: " + (SystemClock.elapsedRealtime() - timeMillis) + " ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScreenLockStateFinish(boolean locked, String tips) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
isForeground = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
isForeground = false;
|
||||
super.onPause();
|
||||
isForeground = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -526,17 +361,6 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick({R.id.back, R.id.chkupd})
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.back:
|
||||
lazyExit();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void setStoreUpdateListener(View view) {
|
||||
ObservableOnSubscribe<View> mObservableOnSubscribe = new ObservableOnSubscribe<View>() {
|
||||
@Override
|
||||
@@ -593,19 +417,6 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
Log.e("OnNetworkStatusChanged", "onDisconnected: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
Log.e("OnNetworkStatusChanged", "onConnected: ");
|
||||
timeMillis = SystemClock.elapsedRealtime();
|
||||
//直接获取数据
|
||||
mPresenter.getLockedState();
|
||||
}
|
||||
|
||||
public static class MessageReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.aoleyun.sn.activity.requestlog;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.base.BaseActivity;
|
||||
import com.aoleyun.sn.rlog.LogBean;
|
||||
import com.aoleyun.sn.rlog.LogDBManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class RequestLogActivity extends BaseActivity implements RequestLogContact.MainView {
|
||||
private static final String TAG = RequestLogActivity.class.getSimpleName();
|
||||
private RequestLogAdapter mAdapter;
|
||||
|
||||
@BindView(R.id.recyclerview)
|
||||
RecyclerView mRecyclerView;
|
||||
@BindView(R.id.iv_delete)
|
||||
ImageView iv_delete;
|
||||
@BindView(R.id.iv_refresh)
|
||||
ImageView iv_refresh;
|
||||
@BindView(R.id.back)
|
||||
ImageView back;
|
||||
|
||||
@OnClick({R.id.back, R.id.iv_refresh, R.id.iv_delete})
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.back:
|
||||
finish();
|
||||
break;
|
||||
case R.id.iv_refresh:
|
||||
mPresenter.getDBList();
|
||||
break;
|
||||
case R.id.iv_delete:
|
||||
LogDBManager.getInstance().saveToFile();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
private RequestLogPresenter mPresenter;
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_request_log;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
ButterKnife.bind(this);
|
||||
mPresenter = new RequestLogPresenter(this);
|
||||
mPresenter.attachView(this);
|
||||
mPresenter.setProvider(this);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
mAdapter = new RequestLogAdapter();
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mPresenter.getDBList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDBList(List<LogBean> logBeanList) {
|
||||
mAdapter.setLogBeans(logBeanList);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mPresenter.detachView();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.aoleyun.sn.activity.requestlog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.rlog.LogBean;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RequestLogAdapter extends RecyclerView.Adapter<RequestLogAdapter.Holder> {
|
||||
private List<LogBean> mLogBeans;
|
||||
private Context context;
|
||||
|
||||
public void setLogBeans(List<LogBean> logBeanList) {
|
||||
this.mLogBeans = logBeanList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
context = parent.getContext();
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.item_requestlog, parent, false);
|
||||
return new Holder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
LogBean logBean = mLogBeans.get(position);
|
||||
if (logBean == null) return;
|
||||
holder.tv_code.setText(logBean.getCode().toString());
|
||||
holder.tv_timestamp.setText(Utils.transferLongToDate(logBean.getTimestamp()));
|
||||
holder.tv_event.setText(logBean.getEvent());
|
||||
holder.tv_operate.setText(logBean.getOperate());
|
||||
holder.tv_content.setText(logBean.getContent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mLogBeans == null ? 0 : mLogBeans.size();
|
||||
}
|
||||
|
||||
static class Holder extends RecyclerView.ViewHolder {
|
||||
TextView tv_code;
|
||||
TextView tv_timestamp;
|
||||
TextView tv_event;
|
||||
TextView tv_operate;
|
||||
TextView tv_content;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tv_code = itemView.findViewById(R.id.tv_code);
|
||||
tv_timestamp = itemView.findViewById(R.id.tv_timestamp);
|
||||
tv_event = itemView.findViewById(R.id.tv_event);
|
||||
tv_operate = itemView.findViewById(R.id.tv_operate);
|
||||
tv_content = itemView.findViewById(R.id.tv_content);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.aoleyun.sn.activity.requestlog;
|
||||
|
||||
import com.aoleyun.sn.base.BasePresenter;
|
||||
import com.aoleyun.sn.base.BaseView;
|
||||
import com.aoleyun.sn.rlog.LogBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RequestLogContact {
|
||||
public interface Presenter extends BasePresenter<MainView> {
|
||||
void getDBList();
|
||||
}
|
||||
|
||||
public interface MainView extends BaseView {
|
||||
void setDBList(List<LogBean> logBeanList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.aoleyun.sn.activity.requestlog;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.aoleyun.sn.rlog.LogDBManager;
|
||||
import com.trello.rxlifecycle2.LifecycleProvider;
|
||||
import com.trello.rxlifecycle2.android.ActivityEvent;
|
||||
|
||||
public class RequestLogPresenter implements RequestLogContact.Presenter {
|
||||
private static final String TAG = RequestLogPresenter.class.getSimpleName();
|
||||
private RequestLogContact.MainView mView;
|
||||
private Context mContext;
|
||||
|
||||
|
||||
private LifecycleProvider<ActivityEvent> provider;
|
||||
|
||||
public void setProvider(LifecycleProvider<ActivityEvent> provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public LifecycleProvider<ActivityEvent> getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public RequestLogPresenter(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDBList() {
|
||||
mView.setDBList(LogDBManager.getInstance().getLogList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachView(@NonNull RequestLogContact.MainView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
this.mView = null;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import androidx.multidex.MultiDexApplication;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.rlog.LogDBManager;
|
||||
import com.aoleyun.sn.utils.WiFiUtils;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
@@ -94,6 +95,7 @@ public class BaseApplication extends MultiDexApplication {
|
||||
JGYUtils.init(this);
|
||||
WiFiUtils.init(this);
|
||||
XAPKUtils.init(this);
|
||||
LogDBManager.init(this);
|
||||
FileManager.init(this);
|
||||
AmapManager.init(this);
|
||||
AmapManager.getInstance().initAmap();
|
||||
|
||||
37
app/src/main/java/com/aoleyun/sn/comm/CommonConfig.java
Normal file
37
app/src/main/java/com/aoleyun/sn/comm/CommonConfig.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.aoleyun.sn.comm;
|
||||
|
||||
|
||||
public class CommonConfig {
|
||||
//保存的用户信息
|
||||
/*用户id*/
|
||||
public final static String ADMIN_ID = "admin_id";
|
||||
/*批次名*/
|
||||
public final static String BATCH_NAME = "batch";
|
||||
/*班级*/
|
||||
public final static String CLASS_NAME = "classes";
|
||||
/*姓名*/
|
||||
public final static String REALNAME = "realname";
|
||||
/*学号*/
|
||||
public final static String STUDENT_ID = "sno";
|
||||
/*头像*/
|
||||
public final static String HEAD_IMG = "head_img";
|
||||
//保存的用户信息
|
||||
|
||||
/*首次启动app*/
|
||||
public final static String FIRST_STARTUP = "app_first_startup";
|
||||
/*保存的应用版本号*/
|
||||
public final static String SN_VERSIONCODE = "SN_VERSIONCODE";
|
||||
/*重启标识*/
|
||||
public final static String IS_RESET = "IS_RESET";
|
||||
/*最低电量*/
|
||||
public final static int MIN_POWER = 21;
|
||||
/*强制安装列表*/
|
||||
public final static String FORCE_INSTALL = "FORCE_INSTALL";
|
||||
/*firstEnter状态*/
|
||||
public final static String FLAG_FIRST_ENTER = "qch_first_enter";
|
||||
/*首次连接*/
|
||||
public final static String JGY_FIRST_CONNECT = "first_connect";
|
||||
/*定时上传log*/
|
||||
public final static String UPLOAD_LOG_TYPE = "is_log_type";
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.aoleyun.sn.comm;
|
||||
|
||||
|
||||
public class CommonDatas {
|
||||
public final static String IS_RESET = "IS_RESET";
|
||||
public final static int MIN_POWER = 21;
|
||||
public final static String FORCE_INSTALL = "FORCE_INSTALL";
|
||||
public final static String FLAG_FIRST_ENTER = "qch_first_enter";
|
||||
}
|
||||
34
app/src/main/java/com/aoleyun/sn/comm/JGYActions.java
Normal file
34
app/src/main/java/com/aoleyun/sn/comm/JGYActions.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.aoleyun.sn.comm;
|
||||
|
||||
public class JGYActions {
|
||||
/*锁定解锁设备 后台1是锁定,底层0是锁定*/
|
||||
public final static String ACTION_QCH_UNLOCK_IPAD = "qch_unlock_ipad";
|
||||
/*后台锁定*/
|
||||
public final static int NET_CODE_LOCKED = 1;
|
||||
/*后台解锁*/
|
||||
public final static int NET_CODE_UNLOCKED = 0;
|
||||
/*底层锁定*/
|
||||
public final static int FRAME_CODE_LOCKED = 0;
|
||||
/*底层解锁*/
|
||||
public final static int FRAME_CODE_UNLOCKED = 1;
|
||||
|
||||
/*
|
||||
* 需要写到底层的数据
|
||||
* */
|
||||
|
||||
/*应用管理-允许联网*/
|
||||
public final static String ACTION_HRRECEIVER_JGY = "qch_jgy_network_allow";
|
||||
/*应用管理-禁止联网*/
|
||||
public final static String ACTION_HRRECEIVER_JGY_DIS = "qch_jgy_network_disallow";
|
||||
/*状态栏*/
|
||||
public final static String ACTION_STATUSBAR_STATUS = "jgy_statusbar_status";
|
||||
|
||||
|
||||
/*
|
||||
* 应用内部的数据
|
||||
* */
|
||||
|
||||
//后台上传所有应用包名 将添加到桌面
|
||||
// TODO: 2021/10/13
|
||||
public final static String ACTION_JGY_SHORTCUTLIST = "only_jgy_shortcut_list";
|
||||
}
|
||||
@@ -12,29 +12,22 @@ import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
import com.amap.api.location.AMapLocationListener;
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.base.BaseApplication;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.RemoteDebug;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.manager.AmapManager;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.utils.CacheUtils;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.comm.CommonDatas;
|
||||
import com.aoleyun.sn.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.network.HTTPInterface;
|
||||
import com.aoleyun.sn.service.MainService;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.CmdUtil;
|
||||
import com.aoleyun.sn.utils.ForegroundAppUtil;
|
||||
@@ -42,9 +35,7 @@ import com.aoleyun.sn.utils.MySQLData;
|
||||
import com.aoleyun.sn.utils.SPUtils;
|
||||
import com.aoleyun.sn.utils.SaveListUtils;
|
||||
import com.aoleyun.sn.utils.ServiceAliveUtils;
|
||||
import com.aoleyun.sn.utils.ToastUtil;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
@@ -720,10 +711,10 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
Settings.System.putInt(this.mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, i);
|
||||
Log.e("SystemSetting", "qch_unlock_ipad---------" + i);
|
||||
|
||||
if (getBatteryLevel() >= CommonDatas.MIN_POWER) {
|
||||
if (getBatteryLevel() >= CommonConfig.MIN_POWER) {
|
||||
Utils.doMasterClear(mContext);
|
||||
} else {
|
||||
MySQLData.SetBooleanData(mContext, CommonDatas.IS_RESET, true);
|
||||
MySQLData.SetBooleanData(mContext, CommonConfig.IS_RESET, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.bean.PoweroffBean;
|
||||
import com.aoleyun.sn.bean.SnRunLog;
|
||||
import com.aoleyun.sn.bean.WiFiAlias;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.network.api.newapi.GetPublicIPApi;
|
||||
import com.aoleyun.sn.service.LogcatService;
|
||||
import com.aoleyun.sn.utils.WiFiUtils;
|
||||
@@ -39,11 +39,10 @@ import com.aoleyun.sn.utils.URLUtils;
|
||||
import com.aoleyun.sn.bean.Appground;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.NetAndLaunchBean;
|
||||
import com.aoleyun.sn.jpush.TagAliasOperatorHelper;
|
||||
import com.aoleyun.sn.network.api.newapi.SnTimeControlApi;
|
||||
import com.aoleyun.sn.network.api.newapi.TopAppControlApi;
|
||||
import com.aoleyun.sn.network.api.newapi.UpdateDeviceInfoApi;
|
||||
import com.aoleyun.sn.service.MainService;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.ForegroundAppUtil;
|
||||
import com.aoleyun.sn.utils.SPUtils;
|
||||
@@ -55,7 +54,6 @@ import com.tencent.mmkv.MMKV;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -537,58 +535,6 @@ public class HTTPInterface {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
synchronized public static void updateDeviceInfo(Context context) {
|
||||
String address = String.valueOf(SPUtils.get(context, "AmapAddress", "-"));
|
||||
if ("-".equals(address)) {
|
||||
address = (String) SPUtils.get(context, "AmapError", "-");
|
||||
}
|
||||
String longitude = String.valueOf(SPUtils.get(context, "longitude", "0"));
|
||||
String latitude = String.valueOf(SPUtils.get(context, "latitude", "0"));
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("address", address);
|
||||
jsonObject.put("longitude", longitude);
|
||||
jsonObject.put("latitude", latitude);
|
||||
String add = jsonObject.toJSONString();
|
||||
UpdateDeviceInfoApi updateDeviceInfo = NetInterfaceManager.getInstance().getUpdateDeviceInfo();
|
||||
updateDeviceInfo.updateDeviceInfo(
|
||||
Utils.getSerial(),
|
||||
NetInterfaceManager.HTTP_KEY,
|
||||
Utils.getMachine(context),
|
||||
Utils.getHardware(context),
|
||||
add
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(ResponseBody responseBody) {
|
||||
try {
|
||||
Log.e("updateDeviceInfo", "上传的结果" + responseBody.string());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("updateDeviceInfo", e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
ApkUtils.getAppInfo(context);
|
||||
}
|
||||
|
||||
public static void getSnTimeControl(final Context context) {
|
||||
SnTimeControlApi snTimeControl = NetInterfaceManager.getInstance().getSnTimeControlApi();
|
||||
snTimeControl.getSnTimeControl(Utils.getSerial())
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.aoleyun.sn.network;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.bean.Appground;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
@@ -18,6 +20,8 @@ import com.aoleyun.sn.bean.PoweroffBean;
|
||||
import com.aoleyun.sn.bean.SnRunLog;
|
||||
import com.aoleyun.sn.bean.StudentsInfo;
|
||||
import com.aoleyun.sn.bean.WiFiAlias;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
import com.aoleyun.sn.network.api.AppLimitApi;
|
||||
import com.aoleyun.sn.network.api.DeselectIDApi;
|
||||
@@ -44,6 +48,7 @@ import com.aoleyun.sn.network.api.newapi.GetLockStateApi;
|
||||
import com.aoleyun.sn.network.api.newapi.GetJpushTagsApi;
|
||||
import com.aoleyun.sn.network.api.newapi.GetPoweroffApi;
|
||||
import com.aoleyun.sn.network.api.newapi.GetSnRunLogApi;
|
||||
import com.aoleyun.sn.network.api.newapi.GetUploadIsLogApi;
|
||||
import com.aoleyun.sn.network.api.newapi.GetUploadLogApi;
|
||||
import com.aoleyun.sn.network.api.newapi.GetWiFiAliasApi;
|
||||
import com.aoleyun.sn.network.api.newapi.LogoImgApi;
|
||||
@@ -58,27 +63,42 @@ import com.aoleyun.sn.network.api.newapi.SnTimeControlApi;
|
||||
import com.aoleyun.sn.network.api.newapi.StudentsInfosApi;
|
||||
import com.aoleyun.sn.network.api.newapi.TopAppControlApi;
|
||||
import com.aoleyun.sn.network.api.newapi.UpdateDeviceInfoApi;
|
||||
import com.aoleyun.sn.rlog.LogDBManager;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.utils.MD5Util;
|
||||
import com.aoleyun.sn.utils.SPUtils;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.trello.rxlifecycle2.LifecycleProvider;
|
||||
import com.trello.rxlifecycle2.android.ActivityEvent;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Protocol;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Retrofit;
|
||||
@@ -86,6 +106,8 @@ import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class NetInterfaceManager {
|
||||
private static final String TAG = NetInterfaceManager.class.getSimpleName();
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static NetInterfaceManager INSTANCE;
|
||||
private Context mContext;
|
||||
@@ -547,4 +569,207 @@ public class NetInterfaceManager {
|
||||
return mRetrofit.create(GetUploadLogApi.class);
|
||||
}
|
||||
|
||||
public GetUploadIsLogApi getUploadIsLogApi() {
|
||||
return mRetrofit.create(GetUploadIsLogApi.class);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* execution
|
||||
*
|
||||
* */
|
||||
private final int OK = 200;
|
||||
|
||||
private final static int NOTFOUND = -300;
|
||||
|
||||
public interface ObserverCallback {
|
||||
void onSubscribe(Disposable d);
|
||||
|
||||
void onNext(BaseResponse response);
|
||||
|
||||
void onError(Throwable e);
|
||||
|
||||
void onComplete();
|
||||
}
|
||||
|
||||
public void getLockedState(LifecycleProvider<ActivityEvent> provider, ObserverCallback callback) {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getDevicesLockedStateObservable()
|
||||
.compose(provider.bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e(TAG + ":" + "getLockedState", "onSubscribe: ");
|
||||
callback.onSubscribe(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
Log.e(TAG + ":" + "getLockedState", "onNext: " + response);
|
||||
if (response.code == OK) {
|
||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||
int locked = jsonObject.get("lock").getAsInt();
|
||||
Log.e(TAG + ":" + "getLockedState", "locked: " + locked);
|
||||
int oldState = Settings.System.getInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
|
||||
Log.e(TAG + ":" + "getLockedState", "qch_unlock_ipad: " + oldState);
|
||||
//后台1是锁定,底层0是锁定
|
||||
SPUtils.put(mContext, CommonConfig.JGY_FIRST_CONNECT, 1);
|
||||
if (locked == JGYActions.NET_CODE_LOCKED) {
|
||||
if (oldState == JGYActions.FRAME_CODE_UNLOCKED) {
|
||||
Log.e(TAG + ":" + "getLockedState", "onNext: " + "state changed , reset devices");
|
||||
Utils.doMasterClear(mContext);
|
||||
}
|
||||
Settings.System.putInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
|
||||
} else if (locked == JGYActions.NET_CODE_UNLOCKED) {
|
||||
// SysSettingUtils.setEnableSetting(mContext);
|
||||
Settings.System.putInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_UNLOCKED);
|
||||
}
|
||||
} else if (response.code == NOTFOUND) {
|
||||
Settings.System.putInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
|
||||
Log.e(TAG + ":" + "getLockedState", "locked: " + false);
|
||||
}
|
||||
callback.onNext(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e(TAG + ":" + "getLockedState", "onError: " + e.getMessage());
|
||||
callback.onError(e);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e(TAG + ":" + "getLockedState", "onComplete: ");
|
||||
callback.onComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void updateDeviceInfo(ObserverCallback callback) {
|
||||
String address = String.valueOf(SPUtils.get(mContext, "AmapAddress", "-"));
|
||||
if ("-".equals(address)) {
|
||||
address = (String) SPUtils.get(mContext, "AmapError", "-");
|
||||
}
|
||||
String longitude = String.valueOf(SPUtils.get(mContext, "longitude", "0"));
|
||||
String latitude = String.valueOf(SPUtils.get(mContext, "latitude", "0"));
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("address", address);
|
||||
jsonObject.put("longitude", longitude);
|
||||
jsonObject.put("latitude", latitude);
|
||||
String add = jsonObject.toJSONString();
|
||||
getUpdateDeviceInfo().updateDeviceInfo(
|
||||
Utils.getSerial(),
|
||||
NetInterfaceManager.HTTP_KEY,
|
||||
Utils.getMachine(mContext),
|
||||
Utils.getHardware(mContext),
|
||||
add
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
callback.onSubscribe(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
callback.onNext(baseResponse);
|
||||
Log.e("updateDeviceInfo", "上传的结果" + baseResponse.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
callback.onError(e);
|
||||
Log.e("updateDeviceInfo", e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
callback.onComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void sendRunningAppInfo(ObserverCallback callback) {
|
||||
String jsonString = ApkUtils.getRunningAppInfo(mContext);
|
||||
getUploadAppInfoApi().getUploadAppInfoApi(NetInterfaceManager.HTTP_KEY,
|
||||
Utils.getSerial(),
|
||||
jsonString)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("sendRunningAppInfo", "onSubscribe: ");
|
||||
callback.onSubscribe(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("sendRunningAppInfo", "onNext: " + baseResponse.toString());
|
||||
callback.onNext(baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("sendRunningAppInfo", "onError: " + e.getMessage());
|
||||
callback.onError(e);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("sendRunningAppInfo", "onComplete: ");
|
||||
callback.onComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void uploadLogFile() {
|
||||
String logFilePath = LogDBManager.getInstance().saveToFile();
|
||||
File logFile = new File(logFilePath);
|
||||
if (!logFile.exists()) {
|
||||
Log.e(TAG, "senSNLogFile: " + logFilePath + " is not exists");
|
||||
return;
|
||||
}
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("sn", Utils.getSerial());
|
||||
MediaType mediaType = MediaType.Companion.parse("text/plain");
|
||||
RequestBody fileBody = RequestBody.Companion.create(logFile, mediaType);
|
||||
//设置一个file文件
|
||||
MultipartBody.Part body = MultipartBody.Part.createFormData("file", logFile.getName(), fileBody);
|
||||
|
||||
NetInterfaceManager.getInstance().getUploadIsLogApi()
|
||||
.sendSnisLog(params, body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("uploadLogFile", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("uploadLogFile", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("uploadLogFile", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("uploadLogFile", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,86 +8,87 @@ import rxhttp.wrapper.annotation.DefaultDomain;
|
||||
* @author Administrator
|
||||
*/
|
||||
public class UrlAddress {
|
||||
//根网址
|
||||
/*根网址*/
|
||||
@DefaultDomain
|
||||
public static final String HTTP_TAG_HEAD_NEW = BuildConfig.ROOT_URL;
|
||||
|
||||
|
||||
// 下载接口 根据包名匹配 请求后更新下载次数
|
||||
/*下载接口 根据包名匹配 请求后更新下载次数*/
|
||||
public static final String SEND_DOWNLOAD_TIMES = "count/index";
|
||||
//app下载完成发送下载次数
|
||||
/*app下载完成发送下载次数*/
|
||||
public static final String SEND_DOWNLOAD_FILE_INFO = "app/downloadApp";
|
||||
//获取设备锁定状态
|
||||
/*获取设备锁定状态*/
|
||||
public static final String GET_DEVICES_LOCKED = "lock/index";
|
||||
//发送设备信息
|
||||
/*发送设备信息*/
|
||||
public static final String SEND_DEVICES = "Mac/getMac";
|
||||
//发送app使用情况
|
||||
/*发送app使用情况*/
|
||||
public static final String GET_APP_LOG = "Applog/getAppLog";
|
||||
//更新接口
|
||||
/*更新接口*/
|
||||
public static final String CHECK_UPDATE = "Silent/silent";
|
||||
//获取设备标签
|
||||
/*获取设备标签*/
|
||||
public static final String GET_DEVICES_TAGS = "Sn/getSnTag";
|
||||
//删除Aliases
|
||||
/*删除Aliases*/
|
||||
public static final String DELETE_GEDEVICE_ALIAS = "Sn/deleteAliases";
|
||||
//浏览器书签主页设置
|
||||
/*浏览器书签主页设置*/
|
||||
public static final String SET_HOMEPAG_TAG = "Label";
|
||||
//app内部网页管控
|
||||
/*app内部网页管控*/
|
||||
public static final String SET_APPINSIDEWEB = "Appground";
|
||||
//浏览器黑白名单地址
|
||||
/*浏览器黑白名单地址*/
|
||||
public static final String SET_BROWSER_LIST = "browser";
|
||||
//强制安装应用
|
||||
/*强制安装应用*/
|
||||
public static final String GET_FORCE_INSTALL_LIST = "forceinstall/index";
|
||||
//应用白名单
|
||||
/*应用白名单*/
|
||||
public static final String SET_WHITE_PACKAGE_LIST = "firmware/index";
|
||||
//获取隐藏桌面图标
|
||||
/*获取隐藏桌面图标*/
|
||||
public static final String GET_HIDE_DESKTOPICON = "Icon";
|
||||
//获取应用升级自启
|
||||
/*获取应用升级自启*/
|
||||
public static final String NET_AND_LAUNCH_API = "automatic/get";
|
||||
//通过sn获取信息
|
||||
/*通过sn获取信息*/
|
||||
public static final String GET_STUDENTS_INFO = "Sn/getStudent";
|
||||
//上传截图
|
||||
/*上传截图*/
|
||||
public static final String SEND_SCREENSHOT = "Screenshot/addImg";
|
||||
//上传我的设备
|
||||
/*上传我的设备*/
|
||||
public static final String UPDATE_DEVICEINFO = "Mac/getInfo";
|
||||
//获取霸屏状态
|
||||
/*获取霸屏状态*/
|
||||
public static final String GET_LOCK_SCREEN_STATE = "Sn/getSnScreen";
|
||||
//获取默认桌面升级
|
||||
/*获取默认桌面升级*/
|
||||
public static final String GET_DESKTOP = "Sn/getSnDesktop";
|
||||
//获取时间管控
|
||||
/*获取时间管控*/
|
||||
public static final String GET_SN_TIME_CONTROL = "Sn/getSnTimeControl";
|
||||
//获取顶部app管控
|
||||
/*获取顶部app管控*/
|
||||
public static final String GET_TOP_APP_CONTROL = "Sn/getSnAppControl";
|
||||
//获取测试app
|
||||
/*获取测试app*/
|
||||
public static final String GET_SN_APP_TEST = "Sn/getSnAppTest";
|
||||
//开机动画
|
||||
/*开机动画*/
|
||||
public static final String GET_LOGO_IMG = "Sn/getLogoImg";
|
||||
//开发人员选项开关
|
||||
/*开发人员选项开关*/
|
||||
public static final String GET_DEVELOPER = "Sn/getDeveloper";
|
||||
//通过固件名获取内置应用
|
||||
/*通过固件名获取内置应用*/
|
||||
public static final String GET_ROM_APP = "And/getFirmwareApp";
|
||||
//获取全部应用
|
||||
/*获取全部应用*/
|
||||
public static final String GET_ALL_APP = "recommend/index";
|
||||
//获取电子书包激活码
|
||||
/*获取电子书包激活码*/
|
||||
public static final String GET_EBAG_CODE = "And/getEbagCode";
|
||||
//获取系统默认程序
|
||||
/*获取系统默认程序*/
|
||||
public static final String GET_DEFAULT_APP = "app/getDefaultApp";
|
||||
//恢复出厂设置次数
|
||||
/*恢复出厂设置次数*/
|
||||
public static final String SEND_RESTORE_TIMES = "And/restore";
|
||||
//获取远程关机时间
|
||||
/*获取远程关机时间*/
|
||||
public static final String GET_POWEROFF_TIME = "And/getTimedShutdown";
|
||||
//获取WiFi名和密码
|
||||
/*获取WiFi名和密码*/
|
||||
public static final String GET_WIFI_ALIAS_PW = "And/getWifi";
|
||||
//获取log任务
|
||||
/*获取log任务*/
|
||||
public static final String GET_LOG_ORDER = "And/getSnRunLog";
|
||||
//上传log文件
|
||||
/*上传log文件*/
|
||||
public static final String UPLOAD_LOG_FILE = "And/uploadLogFile";
|
||||
/*上传运行日志设置文件*/
|
||||
public static final String UPLOAD_IS_LOG_FILE = "And/sn/uploadIsLogFile";
|
||||
|
||||
|
||||
|
||||
//获取公网IP
|
||||
/*获取公网IP*/
|
||||
public static final String SHOUHU_CITYJSON = "http://pv.sohu.com/cityjson/";
|
||||
//删除alias
|
||||
/*删除alias*/
|
||||
public static final String DELETE_JPUSH_ALIAS = "https://device.jpush.cn/v3/aliases/";
|
||||
//删除tags
|
||||
/*删除tags*/
|
||||
public static final String DELETE_JPUSH_TAG = "https://device.jpush.cn/v3/tags/";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.aoleyun.sn.network.api;
|
||||
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.http.Field;
|
||||
@@ -9,7 +11,7 @@ import retrofit2.http.POST;
|
||||
public interface UploadAppInfoApi {
|
||||
@FormUrlEncoded
|
||||
@POST("log/index")
|
||||
Observable<ResponseBody> getUploadAppInfoApi(
|
||||
Observable<BaseResponse> getUploadAppInfoApi(
|
||||
@Field("key") String key,
|
||||
@Field("sn") String sn,
|
||||
@Field("app_infoes") String json
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.aoleyun.sn.network.api.newapi;
|
||||
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.SnRunLog;
|
||||
import com.aoleyun.sn.network.UrlAddress;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.MultipartBody;
|
||||
import retrofit2.http.Multipart;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Part;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
public interface GetUploadIsLogApi {
|
||||
@Multipart
|
||||
@POST(UrlAddress.UPLOAD_IS_LOG_FILE)
|
||||
Observable<BaseResponse> sendSnisLog(
|
||||
@QueryMap Map<String, String> params,
|
||||
@Part MultipartBody.Part body
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.aoleyun.sn.network.api.newapi;
|
||||
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
@@ -11,7 +11,7 @@ import retrofit2.http.POST;
|
||||
public interface UpdateDeviceInfoApi {
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.UPDATE_DEVICEINFO)
|
||||
Observable<ResponseBody> updateDeviceInfo(
|
||||
Observable<BaseResponse> updateDeviceInfo(
|
||||
@Field("sn") String sn,
|
||||
@Field("key") String key,
|
||||
@Field("machine") String machine,
|
||||
|
||||
@@ -6,10 +6,14 @@ import android.content.Intent;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.sn.activity.CheckNetActivity;
|
||||
import com.aoleyun.sn.service.MainService;
|
||||
import com.aoleyun.sn.activity.checknet.CheckNetActivity;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.rlog.LogDBManager;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.aoleyun.sn.utils.BootManager;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.utils.SPUtils;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -64,7 +68,6 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
|
||||
private static Start start;
|
||||
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.e(TAG, "action:" + intent.getAction());
|
||||
@@ -72,6 +75,12 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
default:
|
||||
break;
|
||||
case Intent.ACTION_BOOT_COMPLETED:
|
||||
if ((int) SPUtils.get(context, CommonConfig.FIRST_STARTUP, 0) == 0) {
|
||||
LogDBManager.getInstance().creatRebootLog("首次启动", Utils.transferLongToDate(System.currentTimeMillis()));
|
||||
SPUtils.put(context, CommonConfig.FIRST_STARTUP, 1);
|
||||
} else {
|
||||
LogDBManager.getInstance().creatRebootLog("设备重启", Utils.transferLongToDate(System.currentTimeMillis()));
|
||||
}
|
||||
Intent intent1 = new Intent(context, CheckNetActivity.class);
|
||||
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent1);
|
||||
@@ -102,7 +111,7 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
// case "android.intent.action.MEDIA_REMOVED":
|
||||
// case "android.intent.action.MEDIA_BAD_REMOVAL":
|
||||
//除了USER_PRESENT应该都收不到
|
||||
// Log.e("fht", "BootReceiver MSG:" + intent.getAction());
|
||||
Log.e("fht", "BootReceiver MSG:" + intent.getAction());
|
||||
JGYUtils.startServices(context);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,10 @@ import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
import com.aoleyun.sn.network.HTTPInterface;
|
||||
import com.aoleyun.sn.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.CacheUtils;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
@@ -106,7 +108,28 @@ public class NewAppReceiver extends BroadcastReceiver {
|
||||
public void onNext(@NonNull String s) {
|
||||
Log.e(TAG, "sendAppInfo: onNext: " + s);
|
||||
SaveListUtils.getDownLoadList().remove(s);
|
||||
ApkUtils.getAppInfo(mContext);
|
||||
NetInterfaceManager.getInstance().sendRunningAppInfo(new NetInterfaceManager.ObserverCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//HTTPInterface.getNetAndLaunchSetting(mContext);
|
||||
HTTPInterface.getAppLimit(mContext);
|
||||
// HTTPInterface.getAppinsideWeb(mContext, () -> Log.e(TAG, "onNext: setAPPinsideWebsite"));
|
||||
|
||||
73
app/src/main/java/com/aoleyun/sn/rlog/LogBean.java
Normal file
73
app/src/main/java/com/aoleyun/sn/rlog/LogBean.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package com.aoleyun.sn.rlog;
|
||||
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class LogBean implements Serializable {
|
||||
private static final long serialVersionUID = -1608434464416521927L;
|
||||
|
||||
Integer id;
|
||||
String code;
|
||||
Long timestamp;
|
||||
String event;
|
||||
String operate;
|
||||
String content;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(Long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public String getEvent() {
|
||||
return event;
|
||||
}
|
||||
|
||||
public void setEvent(String event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
public String getOperate() {
|
||||
return operate;
|
||||
}
|
||||
|
||||
public void setOperate(String operate) {
|
||||
this.operate = operate;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String toLogString() {
|
||||
return "执行代码:" + code
|
||||
+ ",时间: " + Utils.transferLongToDate(timestamp)
|
||||
+ ",事件: " + event
|
||||
+ ",操作: " + operate
|
||||
+ ",内容: " + content
|
||||
;
|
||||
}
|
||||
}
|
||||
36
app/src/main/java/com/aoleyun/sn/rlog/LogDBHelper.java
Normal file
36
app/src/main/java/com/aoleyun/sn/rlog/LogDBHelper.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.aoleyun.sn.rlog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.os.Environment;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class LogDBHelper extends SQLiteOpenHelper {
|
||||
public static final String DATABASE_NAME = "requestlog.db";
|
||||
private static final String DATABASE_FILE_NAME = Environment.getExternalStorageDirectory().getPath() + File.separator + DATABASE_NAME;
|
||||
private static final int DATABASE_VERSION = 1;
|
||||
|
||||
public LogDBHelper(Context context) {
|
||||
super(context, DATABASE_FILE_NAME, null, DATABASE_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase sqLiteDatabase) {
|
||||
sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS logtable (" +
|
||||
"id integer primary key autoincrement," +
|
||||
"code varchar(8)," +
|
||||
"timestamp integer," +
|
||||
"event varchar(64)," +
|
||||
"operate varchar(64)," +
|
||||
"content text" +
|
||||
")"
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
|
||||
|
||||
}
|
||||
}
|
||||
211
app/src/main/java/com/aoleyun/sn/rlog/LogDBManager.java
Normal file
211
app/src/main/java/com/aoleyun/sn/rlog/LogDBManager.java
Normal file
@@ -0,0 +1,211 @@
|
||||
package com.aoleyun.sn.rlog;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.aoleyun.sn.database.DBSqlBuilder;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class 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) {
|
||||
throw new RuntimeException("Context is NULL");
|
||||
}
|
||||
mContext = context;
|
||||
mDBHelper = new LogDBHelper(context);
|
||||
}
|
||||
|
||||
public static void init(Context context) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new LogDBManager(context);
|
||||
}
|
||||
}
|
||||
|
||||
public static LogDBManager getInstance() {
|
||||
if (sInstance == null) {
|
||||
throw new IllegalStateException("You must be init LogDBManager first");
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public LogDBHelper getDBHelper() {
|
||||
if (mDBHelper == null) {
|
||||
mDBHelper = new LogDBHelper(mContext);
|
||||
}
|
||||
return mDBHelper;
|
||||
}
|
||||
|
||||
private static final String LOG_CODE_REBOOT = "1001";
|
||||
private static final String LOG_CODE_NETWORK = "1002";
|
||||
private static final String LOG_CODE_NETCHANGE = "1003";
|
||||
|
||||
private static final String LOG_EVENT_REBOOT = "设备重启";
|
||||
private static final String LOG_EVENT_NETWORK = "首次联网";
|
||||
private static final String LOG_EVENT_NETCHANGE = "网络改变";
|
||||
public static final String LOG_EVENT_BATTERY = "充电改变";
|
||||
|
||||
public void creatRebootLog(String operate, String content) {
|
||||
LogBean logBean = new LogBean();
|
||||
logBean.setCode(LOG_CODE_REBOOT);
|
||||
logBean.setTimestamp(System.currentTimeMillis());
|
||||
logBean.setEvent(LOG_EVENT_REBOOT);
|
||||
logBean.setOperate(operate);
|
||||
logBean.setContent(content);
|
||||
saveLog(logBean);
|
||||
}
|
||||
|
||||
public void creatNetworktLog(String operate, String content) {
|
||||
LogBean logBean = new LogBean();
|
||||
logBean.setCode(LOG_CODE_NETWORK);
|
||||
logBean.setTimestamp(System.currentTimeMillis());
|
||||
logBean.setEvent(LOG_EVENT_NETWORK);
|
||||
logBean.setOperate(operate);
|
||||
logBean.setContent(content);
|
||||
saveLog(logBean);
|
||||
}
|
||||
|
||||
public void creatNetChangeLog(String operate, String content) {
|
||||
LogBean logBean = new LogBean();
|
||||
logBean.setCode(LOG_CODE_NETCHANGE);
|
||||
logBean.setTimestamp(System.currentTimeMillis());
|
||||
logBean.setEvent(LOG_EVENT_NETCHANGE);
|
||||
logBean.setOperate(operate);
|
||||
logBean.setContent(content);
|
||||
saveLog(logBean);
|
||||
}
|
||||
|
||||
public void creatOtherLog(String event, String operate, String content) {
|
||||
LogBean logBean = new LogBean();
|
||||
logBean.setCode("0000");
|
||||
logBean.setTimestamp(System.currentTimeMillis());
|
||||
logBean.setEvent(event);
|
||||
logBean.setOperate(operate);
|
||||
logBean.setContent(content);
|
||||
saveLog(logBean);
|
||||
}
|
||||
|
||||
|
||||
public void saveLog(LogBean logBean) {
|
||||
SQLiteDatabase db = mDBHelper.getWritableDatabase();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("code", logBean.getCode());
|
||||
values.put("timestamp", logBean.getTimestamp());
|
||||
values.put("event", logBean.getEvent());
|
||||
values.put("operate", logBean.getOperate());
|
||||
values.put("content", logBean.getContent());
|
||||
db.insert(TABLE_NAME, null, values);
|
||||
}
|
||||
|
||||
public void delete(Integer id) {
|
||||
SQLiteDatabase db = mDBHelper.getWritableDatabase();
|
||||
db.delete(TABLE_NAME, "id=?", new String[]{id.toString()});
|
||||
}
|
||||
|
||||
public void deleteAll() {
|
||||
SQLiteDatabase db = mDBHelper.getWritableDatabase();
|
||||
db.delete(TABLE_NAME, "", null);
|
||||
}
|
||||
|
||||
public void update(LogBean logBean) {
|
||||
SQLiteDatabase db = mDBHelper.getWritableDatabase();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("code", logBean.getCode());
|
||||
values.put("timestamp", logBean.getTimestamp());
|
||||
values.put("event", logBean.getEvent());
|
||||
values.put("operate", logBean.getOperate());
|
||||
values.put("content", logBean.getContent());
|
||||
db.update(TABLE_NAME, values, "id=?", new String[]{logBean.getId().toString()});
|
||||
}
|
||||
|
||||
private long aWeekDayTime = 1000 * 60 * 60 * 24 * 7;
|
||||
|
||||
public List<LogBean> getLogList() {
|
||||
List<LogBean> logBeanList = new ArrayList<>();
|
||||
SQLiteDatabase db = mDBHelper.getReadableDatabase();
|
||||
long time = System.currentTimeMillis() - aWeekDayTime;
|
||||
String sql = "select * from " + TABLE_NAME + " where" + " timestamp > " + time;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = db.rawQuery(sql, null);
|
||||
while (cursor.moveToNext()) {
|
||||
LogBean logBean = new LogBean();
|
||||
logBean.setId(cursor.getInt(cursor.getColumnIndex("id")));
|
||||
logBean.setCode(cursor.getString(cursor.getColumnIndex("code")));
|
||||
logBean.setTimestamp(cursor.getLong(cursor.getColumnIndex("timestamp")));
|
||||
logBean.setEvent(cursor.getString(cursor.getColumnIndex("event")));
|
||||
logBean.setOperate(cursor.getString(cursor.getColumnIndex("operate")));
|
||||
logBean.setContent(cursor.getString(cursor.getColumnIndex("content")));
|
||||
logBeanList.add(logBean);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
db.close();
|
||||
}
|
||||
return logBeanList;
|
||||
}
|
||||
|
||||
public String saveToFile() {
|
||||
List<LogBean> logBeanList = getLogList();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd-HH_mm_ss");
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
String fileName = sdf.format(date) + " log.txt";
|
||||
String filePath = ContextCompat.getExternalFilesDirs(mContext, Environment.DIRECTORY_DOCUMENTS)[0].getAbsolutePath()
|
||||
+ File.separator + fileName;
|
||||
File logFile = new File(filePath);
|
||||
if (logFile.exists()) {
|
||||
logFile.delete();
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (LogBean logBean : logBeanList) {
|
||||
stringBuilder.append(logBean.toLogString()).append("\n");
|
||||
}
|
||||
byte[] bs = stringBuilder.toString().getBytes();
|
||||
try {
|
||||
OutputStream out = new FileOutputStream(logFile);
|
||||
InputStream is = new ByteArrayInputStream(bs);
|
||||
byte[] buff = new byte[1024];
|
||||
int len = 0;
|
||||
while ((len = is.read(buff)) != -1) {
|
||||
out.write(buff, 0, len);
|
||||
}
|
||||
is.close();
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.e(TAG, "saveToFile: " + logFile.getAbsolutePath());
|
||||
return logFile.getAbsolutePath();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
|
||||
// 下载管理服务
|
||||
public class MyDownloadService extends Service {
|
||||
public class DownloadService extends Service {
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
flags = START_STICKY;
|
||||
@@ -22,8 +22,11 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
import com.aoleyun.sn.network.api.newapi.SendScreenStatusApi;
|
||||
import com.aoleyun.sn.rlog.LogDBManager;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.arialyy.annotations.Download;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
@@ -417,11 +420,25 @@ public class GuardService extends Service {
|
||||
if (elec == 50) {
|
||||
start.onstar(SystemClock.elapsedRealtime());
|
||||
}
|
||||
} else if (Intent.ACTION_POWER_CONNECTED.equals(action)
|
||||
|| Intent.ACTION_POWER_DISCONNECTED.equals(action)
|
||||
|| Intent.ACTION_BATTERY_LOW.equals(action)
|
||||
|| Intent.ACTION_BATTERY_OKAY.equals(action)
|
||||
) {
|
||||
} else {
|
||||
if (Intent.ACTION_POWER_CONNECTED.equals(action)) {
|
||||
LogDBManager.getInstance().creatOtherLog(LogDBManager.LOG_EVENT_BATTERY,
|
||||
"开始充电", "rlectricity: " + JGYUtils.getInstance().getBatteryLevel() + "%");
|
||||
|
||||
}
|
||||
if (Intent.ACTION_POWER_DISCONNECTED.equals(action)) {
|
||||
LogDBManager.getInstance().creatOtherLog(LogDBManager.LOG_EVENT_BATTERY,
|
||||
"停止充电", "rlectricity: " + JGYUtils.getInstance().getBatteryLevel() + "%");
|
||||
}
|
||||
if (Intent.ACTION_BATTERY_LOW.equals(action)) {
|
||||
LogDBManager.getInstance().creatOtherLog(LogDBManager.LOG_EVENT_BATTERY,
|
||||
"电量偏低", "rlectricity: " + JGYUtils.getInstance().getBatteryLevel() + "%");
|
||||
}
|
||||
if (Intent.ACTION_BATTERY_OKAY.equals(action)) {
|
||||
LogDBManager.getInstance().creatOtherLog(LogDBManager.LOG_EVENT_BATTERY,
|
||||
"电量充足", "rlectricity: " + JGYUtils.getInstance().getBatteryLevel() + "%");
|
||||
}
|
||||
|
||||
setDefaultUSBStatus();
|
||||
Log.e(TAG, action);
|
||||
start.onstar(SystemClock.elapsedRealtime());
|
||||
@@ -515,7 +532,7 @@ public class GuardService extends Service {
|
||||
Log.e("SEND_DOWNLOAD_TIMES", "onComplete: ");
|
||||
}
|
||||
});
|
||||
int userId = (int) SPUtils.get(GuardService.this, "admin_id", 0);
|
||||
int userId = (int) SPUtils.get(GuardService.this, CommonConfig.ADMIN_ID, 0);
|
||||
long appSize = task.getFileSize();
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSendInfoApi()
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.aoleyun.sn.activity.main;
|
||||
package com.aoleyun.sn.service.main;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.aoleyun.sn.base.BasePresenter;
|
||||
import com.aoleyun.sn.base.BaseView;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
public class MainContact {
|
||||
public class MainSContact {
|
||||
public interface Presenter extends BasePresenter<MainView> {
|
||||
//设置二维码
|
||||
void getQRImage(String mac);
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.sn.activity.main;
|
||||
package com.aoleyun.sn.service.main;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -12,17 +12,6 @@ import android.view.View;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.bean.PoweroffBean;
|
||||
import com.aoleyun.sn.bean.WiFiAlias;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
import com.aoleyun.sn.utils.WiFiUtils;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.base.BaseApplication;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
@@ -31,12 +20,16 @@ import com.aoleyun.sn.bean.ForceDownloadBean;
|
||||
import com.aoleyun.sn.bean.ForceDownloadData;
|
||||
import com.aoleyun.sn.bean.LogoImg;
|
||||
import com.aoleyun.sn.bean.NetAndLaunchBean;
|
||||
import com.aoleyun.sn.bean.PoweroffBean;
|
||||
import com.aoleyun.sn.bean.StudentsInfo;
|
||||
import com.aoleyun.sn.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.bean.WiFiAlias;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
import com.aoleyun.sn.network.HTTPInterface;
|
||||
import com.aoleyun.sn.service.MainService;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.utils.AES.CXAESUtil;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.ForegroundAppUtil;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.utils.SPUtils;
|
||||
@@ -45,6 +38,13 @@ import com.aoleyun.sn.utils.TimeUtils;
|
||||
import com.aoleyun.sn.utils.ToastUtil;
|
||||
import com.aoleyun.sn.utils.URLUtils;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
import com.aoleyun.sn.utils.WiFiUtils;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.tencent.android.tpush.XGIOperateCallback;
|
||||
import com.tencent.android.tpush.XGPushManager;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
@@ -73,9 +73,9 @@ import okhttp3.ResponseBody;
|
||||
*
|
||||
* @author jgy02
|
||||
*/
|
||||
public class MainPresenter implements MainContact.Presenter {
|
||||
private static final String TAG = MainPresenter.class.getSimpleName();
|
||||
private MainContact.MainView mView;
|
||||
public class MainSPresenter implements MainSContact.Presenter {
|
||||
private static final String TAG = MainSPresenter.class.getSimpleName();
|
||||
private MainSContact.MainView mView;
|
||||
private Context mContext;
|
||||
|
||||
public static final String GET_SETTING_FINISH_TIME = "GET_SETTING_FINISH_TIME";
|
||||
@@ -95,9 +95,9 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public MainPresenter(Context context) {
|
||||
public MainSPresenter(Context context) {
|
||||
this.mContext = context;
|
||||
Log.e(TAG, "MainPresenter: " + context.getClass());
|
||||
Log.e(TAG, "MainSPresenter: " + context.getClass());
|
||||
}
|
||||
|
||||
public boolean isRequestSucceeded() {
|
||||
@@ -105,7 +105,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachView(@androidx.annotation.NonNull MainContact.MainView view) {
|
||||
public void attachView(@androidx.annotation.NonNull MainSContact.MainView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@@ -161,41 +161,41 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
String head_img = studentsInfoBaseResponse.data.getHead_img();
|
||||
if (TextUtils.isEmpty(sno)) {
|
||||
mView.setNumberText("", View.GONE);
|
||||
SPUtils.put(mContext, "sno", DEFAULT_INFO);
|
||||
SPUtils.put(mContext, CommonConfig.STUDENT_ID, DEFAULT_INFO);
|
||||
} else {
|
||||
mView.setNumberText(sno, View.VISIBLE);
|
||||
SPUtils.put(mContext, "sno", sno);
|
||||
SPUtils.put(mContext, CommonConfig.STUDENT_ID, sno);
|
||||
}
|
||||
if (TextUtils.isEmpty(realname)) {
|
||||
mView.setNameText("", View.GONE);
|
||||
SPUtils.put(mContext, "realname", DEFAULT_INFO);
|
||||
SPUtils.put(mContext, CommonConfig.REALNAME, DEFAULT_INFO);
|
||||
} else {
|
||||
mView.setNameText(realname, View.VISIBLE);
|
||||
SPUtils.put(mContext, "realname", realname);
|
||||
SPUtils.put(mContext, CommonConfig.REALNAME, realname);
|
||||
}
|
||||
if (TextUtils.isEmpty(classes)) {
|
||||
mView.setClassText("", View.GONE);
|
||||
SPUtils.put(mContext, "classes", DEFAULT_INFO);
|
||||
SPUtils.put(mContext, CommonConfig.CLASS_NAME, DEFAULT_INFO);
|
||||
} else {
|
||||
mView.setClassText(classes, View.VISIBLE);
|
||||
SPUtils.put(mContext, "classes", classes);
|
||||
SPUtils.put(mContext, CommonConfig.CLASS_NAME, classes);
|
||||
}
|
||||
if (TextUtils.isEmpty(batch)) {
|
||||
mView.setBatchText("", View.GONE);
|
||||
SPUtils.put(mContext, "batch", DEFAULT_INFO);
|
||||
SPUtils.put(mContext, CommonConfig.BATCH_NAME, DEFAULT_INFO);
|
||||
} else {
|
||||
mView.setBatchText(batch, View.VISIBLE);
|
||||
SPUtils.put(mContext, "batch", batch);
|
||||
SPUtils.put(mContext, CommonConfig.BATCH_NAME, batch);
|
||||
}
|
||||
if (TextUtils.isEmpty(head_img)) {
|
||||
mView.setHead("");
|
||||
SPUtils.put(mContext, "head_img", "");
|
||||
SPUtils.put(mContext, CommonConfig.HEAD_IMG, "");
|
||||
} else {
|
||||
mView.setHead(head_img);
|
||||
SPUtils.put(mContext, "head_img", head_img);
|
||||
SPUtils.put(mContext, CommonConfig.HEAD_IMG, head_img);
|
||||
}
|
||||
|
||||
SPUtils.put(mContext, "admin_id", studentsInfoBaseResponse.data.getAdmin_id());
|
||||
SPUtils.put(mContext, CommonConfig.ADMIN_ID, studentsInfoBaseResponse.data.getAdmin_id());
|
||||
} else {
|
||||
/*
|
||||
* 没有获取到的时候显示缓存
|
||||
@@ -226,33 +226,33 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
}
|
||||
|
||||
private void setState() {
|
||||
String batch = (String) SPUtils.get(mContext, "batch", DEFAULT_INFO);
|
||||
String batch = (String) SPUtils.get(mContext, CommonConfig.BATCH_NAME, DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(batch) || batch.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setBatchText("", View.GONE);
|
||||
} else {
|
||||
mView.setBatchText(batch, View.VISIBLE);
|
||||
}
|
||||
|
||||
String classes = (String) SPUtils.get(mContext, "classes", DEFAULT_INFO);
|
||||
String classes = (String) SPUtils.get(mContext, CommonConfig.CLASS_NAME, DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(classes) || classes.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setClassText("", View.GONE);
|
||||
} else {
|
||||
mView.setClassText(classes, View.VISIBLE);
|
||||
}
|
||||
|
||||
String sno = (String) SPUtils.get(mContext, "sno", DEFAULT_INFO);
|
||||
String sno = (String) SPUtils.get(mContext, CommonConfig.STUDENT_ID, DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(sno) || sno.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setNumberText("", View.GONE);
|
||||
} else {
|
||||
mView.setNumberText(sno, View.VISIBLE);
|
||||
}
|
||||
String realname = (String) SPUtils.get(mContext, "realname", DEFAULT_INFO);
|
||||
String realname = (String) SPUtils.get(mContext, CommonConfig.REALNAME, DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(realname) || realname.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setNameText("", View.GONE);
|
||||
} else {
|
||||
mView.setNameText(realname, View.VISIBLE);
|
||||
}
|
||||
String head_img = (String) SPUtils.get(mContext, "head_img", DEFAULT_INFO);
|
||||
String head_img = (String) SPUtils.get(mContext, CommonConfig.HEAD_IMG, DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(head_img) || head_img.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setHead("");
|
||||
} else {
|
||||
@@ -266,7 +266,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
@Override
|
||||
public void getLockedState() {
|
||||
MMKV mmkv = MMKV.defaultMMKV();
|
||||
lastgetLockedTime = mmkv.decodeLong(MainPresenter.GET_SETTING_FINISH_TIME);
|
||||
lastgetLockedTime = mmkv.decodeLong(MainSPresenter.GET_SETTING_FINISH_TIME);
|
||||
Log.e(TAG, "getLockedState: " + lastgetLockedTime);
|
||||
if (System.currentTimeMillis() - lastgetLockedTime < one_minute) {
|
||||
Log.e(TAG, "getLockedState: lastgetLockedTime = " + lastgetLockedTime);
|
||||
@@ -294,7 +294,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
int oldState = Settings.System.getInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, 0);
|
||||
Log.e(TAG + ":" + "getLockedState", "qch_unlock_ipad: " + oldState);
|
||||
//后台1是锁定,底层0是锁定
|
||||
SPUtils.put(mContext, "first_connect", 1);
|
||||
SPUtils.put(mContext, CommonConfig.JGY_FIRST_CONNECT, 1);
|
||||
if (locked == 1) {
|
||||
if (oldState == 1) {
|
||||
Log.e(TAG + ":" + "getLockedState", "onNext: " + "state changed , reset devices");
|
||||
@@ -334,7 +334,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
*/
|
||||
@Override
|
||||
public void getFirstConnect() {
|
||||
int first = (int) SPUtils.get(mContext, "first_connect", 0);
|
||||
int first = (int) SPUtils.get(mContext, CommonConfig.JGY_FIRST_CONNECT, 0);
|
||||
Log.e(TAG, "getFirstConnect: " + "first_connect = " + first);
|
||||
mView.setFirstConnect(first == 0);
|
||||
}
|
||||
@@ -434,21 +434,16 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(getProvider().bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e(TAG + ":" + "updateDevicesInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull ResponseBody responseBody) {
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
requestSucceeded = true;
|
||||
try {
|
||||
Log.e(TAG + ":" + "updateDevicesInfo", "onNext: " + responseBody.string());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e(TAG + ":" + "updateDevicesInfo", "onNext: IOException: " + e.getMessage());
|
||||
}
|
||||
Log.e(TAG + ":" + "updateDevicesInfo", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1671,7 +1666,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
@Override
|
||||
public void onNext(@NonNull ResponseBody responseBody) {
|
||||
requestSucceeded = true;
|
||||
SPUtils.put(mContext, "first_connect", 1);
|
||||
SPUtils.put(mContext, CommonConfig.JGY_FIRST_CONNECT, 1);
|
||||
try {
|
||||
String bodyString = responseBody.string();
|
||||
Log.e(TAG + ":" + "setSystemSetting", "onNext: " + bodyString);
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.sn.service;
|
||||
package com.aoleyun.sn.service.main;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.NotificationChannel;
|
||||
@@ -12,6 +12,10 @@ import android.content.IntentFilter;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.os.SystemClock;
|
||||
@@ -30,14 +34,19 @@ import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.activity.main.MainActivity;
|
||||
import com.aoleyun.sn.activity.main.MainContact;
|
||||
import com.aoleyun.sn.activity.main.MainPresenter;
|
||||
import com.aoleyun.sn.activity.main.MainAContact;
|
||||
import com.aoleyun.sn.activity.main.MainAPresenter;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.PoweroffBean;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
import com.aoleyun.sn.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.receiver.BootReceiver;
|
||||
import com.aoleyun.sn.rlog.LogDBManager;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.ForegroundAppUtil;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
@@ -59,7 +68,9 @@ import com.trello.rxlifecycle2.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle2.android.RxLifecycleAndroid;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -71,11 +82,12 @@ import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.subjects.BehaviorSubject;
|
||||
|
||||
public class MainService extends Service implements MainContact.MainView, NetworkUtils.OnNetworkStatusChangedListener, LifecycleProvider<ActivityEvent> {
|
||||
public class MainService extends Service implements MainSContact.MainView, NetworkUtils.OnNetworkStatusChangedListener, LifecycleProvider<ActivityEvent> {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public static MainPresenter mPresenter;
|
||||
public static MainSPresenter mPresenter;
|
||||
private static final String TAG = MainService.class.getSimpleName();
|
||||
public static boolean netWorkIsRunning = false;
|
||||
private MMKV mMMKV = MMKV.defaultMMKV();
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
@@ -85,13 +97,79 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
Log.e("OnNetworkStatusChanged", "onConnected: ");
|
||||
ToastUtil.betaShow("网络已连接");
|
||||
Log.e("OnNetworkStatusChanged", "onConnected: " + Utils.getWifiAlias(this));
|
||||
start.onstar(SystemClock.elapsedRealtime());
|
||||
Utils.getPublicIP(this);
|
||||
}
|
||||
|
||||
private WifiReceiver mWifiReceiver;
|
||||
|
||||
private void registerWiFiReceiver() {
|
||||
if (mWifiReceiver == null) {
|
||||
mWifiReceiver = new WifiReceiver();
|
||||
}
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
|
||||
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
|
||||
filter.addAction(WifiManager.RSSI_CHANGED_ACTION);
|
||||
filter.addAction(WifiManager.NETWORK_IDS_CHANGED_ACTION);
|
||||
filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
|
||||
filter.addAction(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION);
|
||||
filter.addAction(WifiManager.LINK_CONFIGURATION_CHANGED_ACTION);
|
||||
filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);
|
||||
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
|
||||
registerReceiver(mWifiReceiver, filter);
|
||||
}
|
||||
|
||||
public class WifiReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "wifiReceiver";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
switch (intent.getAction()) {
|
||||
case WifiManager.RSSI_CHANGED_ACTION:
|
||||
Log.e(TAG, "wifi信号强度变化");
|
||||
break;
|
||||
//wifi连接上与否
|
||||
case WifiManager.NETWORK_STATE_CHANGED_ACTION:
|
||||
NetworkInfo info = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
|
||||
if (info.getState().equals(NetworkInfo.State.DISCONNECTED)) {
|
||||
Log.e(TAG, "wifi断开");
|
||||
LogDBManager.getInstance().creatNetChangeLog("wifi断开", Utils.transferLongToDate(System.currentTimeMillis()));
|
||||
} else if (info.getState().equals(NetworkInfo.State.CONNECTED)) {
|
||||
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
|
||||
//获取当前wifi名称
|
||||
String oldSSID = mMMKV.decodeString("WiFiSSID", "");
|
||||
Log.e(TAG, "oldSSID " + oldSSID);
|
||||
String newSSID = wifiInfo.getSSID();
|
||||
Log.e(TAG, "连接到网络 " + newSSID);
|
||||
if (!oldSSID.equals(newSSID)) {
|
||||
LogDBManager.getInstance().creatNetChangeLog("", oldSSID + " change to: " + newSSID);
|
||||
runningTime = SystemClock.elapsedRealtime();
|
||||
//直接获取数据
|
||||
ToastUtil.betaShow("网络已连接");
|
||||
Utils.getPublicIP(this);
|
||||
mPresenter.getLockedState();
|
||||
start.onstar(SystemClock.elapsedRealtime());
|
||||
} else {
|
||||
LogDBManager.getInstance().creatNetChangeLog("接入WiFi",
|
||||
"connect to: " + newSSID + " time: "
|
||||
+ Utils.transferLongToDate(System.currentTimeMillis()));
|
||||
}
|
||||
mMMKV.encode("WiFiSSID", Utils.getWifiAlias(context));
|
||||
}
|
||||
break;
|
||||
//wifi打开与否
|
||||
case WifiManager.WIFI_STATE_CHANGED_ACTION:
|
||||
int wifistate = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_DISABLED);
|
||||
if (wifistate == WifiManager.WIFI_STATE_DISABLED) {
|
||||
Log.e(TAG, "系统关闭wifi");
|
||||
} else if (wifistate == WifiManager.WIFI_STATE_ENABLED) {
|
||||
Log.e(TAG, "系统开启wifi");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final BehaviorSubject<ActivityEvent> lifecycleSubject = BehaviorSubject.create();
|
||||
@@ -162,14 +240,22 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
lifecycleSubject.onNext(ActivityEvent.CREATE);
|
||||
mPresenter = new MainPresenter(this);
|
||||
mPresenter = new MainSPresenter(this);
|
||||
mPresenter.attachView(this);
|
||||
mPresenter.setProvider(this);
|
||||
if ((int) SPUtils.get(this, "first_connect", 0) == 0) {
|
||||
if ((int) SPUtils.get(this, CommonConfig.JGY_FIRST_CONNECT, 0) == 0) {
|
||||
// TODO: 2021/5/26 待底层修改,临时解决办法
|
||||
Log.e(TAG, "onCreate: " + "Disable All Settings");
|
||||
mPresenter.setDisableSetting();
|
||||
}
|
||||
int oldVersionCode = (int) SPUtils.get(this, CommonConfig.SN_VERSIONCODE, 0);
|
||||
if (oldVersionCode < BuildConfig.VERSION_CODE) {
|
||||
Log.e(TAG, "onCreate: " + "upgrade successful");
|
||||
} else {
|
||||
mPresenter.getFirstConnect();
|
||||
mPresenter.getLockedState();
|
||||
}
|
||||
SPUtils.put(this, CommonConfig.SN_VERSIONCODE, BuildConfig.VERSION_CODE);
|
||||
registerReceivers();
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
addShortcut();
|
||||
@@ -209,23 +295,10 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
||||
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
|
||||
bootIntent.setComponent(new ComponentName(PackageNames.APPSTORE, PackageNames.APP_STORE_BOOTRECEIVER));
|
||||
sendBroadcast(bootIntent);
|
||||
// JPushInterface.init(this);
|
||||
if (MainActivity.isForeground) {
|
||||
Log.e(TAG, "onStartCommand: MainService: isForeground: " + MainActivity.isForeground);
|
||||
} else {
|
||||
// if (((SystemClock.elapsedRealtime() - startCommandTime) < 60000) && startCommandTime != 0) {
|
||||
// Log.e(TAG, "onStartCommand: " + "启动时间过短");
|
||||
// //一分钟内防止多次调用
|
||||
// } else {
|
||||
// mPresenter.getFirstConnect();
|
||||
// mPresenter.getLockedState();
|
||||
// startCommandTime = runningTime = SystemClock.elapsedRealtime();
|
||||
// Log.e(TAG, "onStartCommand: isForeground: " + MainActivity.isForeground);
|
||||
// Log.e(TAG, "onStartCommand: " + (SystemClock.elapsedRealtime() - startCommandTime));
|
||||
// }
|
||||
start.onstar(SystemClock.elapsedRealtime());
|
||||
Log.e(TAG, "onStartCommand: " + (SystemClock.elapsedRealtime() - startCommandTime) + "ms");
|
||||
}
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
@@ -269,7 +342,7 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
||||
}
|
||||
|
||||
private void setStatusbar() {
|
||||
String status = (String) SPUtils.get(this, JGYActions.ACTION_STATUS_BAR_STATUS, "");
|
||||
String status = (String) SPUtils.get(this, JGYActions.ACTION_STATUSBAR_STATUS, "");
|
||||
Log.e(TAG, "setStatusbar: String: " + status);
|
||||
if (TextUtils.isEmpty(status)) {
|
||||
Log.e(TAG, "setStatusbar: " + "status is NULL");
|
||||
@@ -280,6 +353,7 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
||||
}
|
||||
|
||||
private void registerReceivers() {
|
||||
registerWiFiReceiver();
|
||||
registerLockScreenReceiver();
|
||||
registerTimeReceiver();
|
||||
registerInstallReceiver();
|
||||
@@ -295,6 +369,9 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
||||
if (null != mInstallReceiver) {
|
||||
unregisterReceiver(mInstallReceiver);
|
||||
}
|
||||
if (null != mWifiReceiver) {
|
||||
unregisterReceiver(mWifiReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
private static WindowManager windowManager;
|
||||
@@ -483,6 +560,7 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
||||
} else if (Intent.ACTION_TIME_TICK.equals(intent.getAction())) {
|
||||
Log.e("TimeChangedReceiver", "onReceive:" + "time tick");
|
||||
checkShutdownTime();
|
||||
checkUploadLogTime();
|
||||
setFloatingWindow(MainService.this);
|
||||
} else if (ACTION_UPDATE.equals(intent.getAction())) {
|
||||
setFloatingWindow(MainService.this);
|
||||
@@ -517,6 +595,23 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
||||
}
|
||||
}
|
||||
|
||||
private static final String UPLOAD_LOG_TIME = "23:00:00";
|
||||
|
||||
private void checkUploadLogTime() {
|
||||
int is_log_type = (int) SPUtils.get(MainService.this, CommonConfig.UPLOAD_LOG_TYPE, 0);
|
||||
if (is_log_type == 0) {
|
||||
Log.e(TAG, "checkUploadLogTime: " + "is_log_type = " + is_log_type);
|
||||
} else {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
String nowTime = sdf.format(date);
|
||||
Log.e(TAG, "checkUploadLogTime: " + nowTime);
|
||||
if (UPLOAD_LOG_TIME.equals(nowTime)) {
|
||||
NetInterfaceManager.getInstance().uploadLogFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
synchronized private void setFloatingWindow(Context context) {
|
||||
ForegroundAppUtil.openTopApp(context);
|
||||
long nowTime = System.currentTimeMillis();
|
||||
@@ -652,7 +747,28 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
||||
if (loocked) {
|
||||
ToastUtil.betaShow("设备已上锁");
|
||||
//上传APP信息
|
||||
ApkUtils.getAppInfo(this);
|
||||
NetInterfaceManager.getInstance().sendRunningAppInfo(new NetInterfaceManager.ObserverCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
SaveListUtils.getList();
|
||||
if (netWorkIsRunning) {
|
||||
//如果正在执行,不执行
|
||||
@@ -851,7 +967,7 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
||||
|
||||
@Override
|
||||
public void setWiFiPasswd() {
|
||||
MMKV.defaultMMKV().encode(MainPresenter.GET_SETTING_FINISH_TIME, System.currentTimeMillis());
|
||||
MMKV.defaultMMKV().encode(MainAPresenter.GET_SETTING_FINISH_TIME, System.currentTimeMillis());
|
||||
netWorkIsRunning = false;
|
||||
Log.e(TAG, "SettingFinished: " + (SystemClock.elapsedRealtime() - runningTime) + " ms");
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
@@ -25,15 +24,17 @@ import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
import com.amap.api.location.AMapLocationListener;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.base.BaseApplication;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.RemoteDebug;
|
||||
import com.aoleyun.sn.comm.CommonDatas;
|
||||
import com.aoleyun.sn.bean.SnRunLog;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.manager.AmapManager;
|
||||
import com.aoleyun.sn.network.HTTPInterface;
|
||||
import com.aoleyun.sn.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.service.MainService;
|
||||
import com.aoleyun.sn.rlog.LogDBManager;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.aoleyun.sn.tpush.common.NotificationService;
|
||||
import com.aoleyun.sn.tpush.po.XGNotification;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
@@ -87,86 +88,90 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
|
||||
private static final String TAG = MessageReceiver.class.getSimpleName();
|
||||
|
||||
//删除应用
|
||||
/*删除应用*/
|
||||
private final String MSG_DELETE = "1";
|
||||
//系统设置管控
|
||||
/*系统设置管控*/
|
||||
private final String MSG_SETTING = "2";
|
||||
//浏览器网址管控
|
||||
/*浏览器网址管控*/
|
||||
private final String MSG_BROWSER = "4";
|
||||
//app id管控
|
||||
/*app id管控*/
|
||||
private final String MSG_APPID = "5";
|
||||
//应用联网管控
|
||||
/*应用联网管控*/
|
||||
private final String MSG_NET_CONTROL = "6";
|
||||
//APP自启联网滑动管控
|
||||
/*APP自启联网滑动管控*/
|
||||
private final String MSG_POWER_ON = "7";
|
||||
//重置
|
||||
/*重置*/
|
||||
private final String MSG_RESET = "8";
|
||||
//强制安装
|
||||
/*强制安装*/
|
||||
private final String MSG_INSTALL = "9";
|
||||
//解锁
|
||||
/*解锁*/
|
||||
private final String MSG_LOCK = "10";
|
||||
//旧版相机管控
|
||||
/*旧版相机管控*/
|
||||
private final String MSG_CAMERA = "11";
|
||||
|
||||
private final String MSG_ONEPACKAGES = "12";
|
||||
//app使用时间
|
||||
/*app使用时间*/
|
||||
private final String GET_APP_USEDTIME = "13";
|
||||
//强制下载
|
||||
/*强制下载*/
|
||||
private final String GET_FORCEDOWNLOADURL = "14";
|
||||
//主页和书签管控
|
||||
/*主页和书签管控*/
|
||||
private final String SET_HOMEPAG_TAG = "15";
|
||||
//app内网页管控
|
||||
/*app内网页管控*/
|
||||
private final String APP_WEBSITE = "16";
|
||||
//禁止app升级
|
||||
/*禁止app升级*/
|
||||
private final String DISABLE_APPUPDATE = "17";
|
||||
//隐藏桌面图标
|
||||
/*隐藏桌面图标*/
|
||||
private final String HIDE_DESKTOP_ICON = "18";
|
||||
//禁止滑动
|
||||
/*禁止滑动*/
|
||||
private final String DISABLE_APP_SLIDE = "19";
|
||||
//更新引用白名单
|
||||
/*更新引用白名单*/
|
||||
private final String UPDATE_INFO = "20";
|
||||
//截图
|
||||
/*截图*/
|
||||
private final String SN_SCREENSHOT = "21";
|
||||
//重启
|
||||
/*重启*/
|
||||
private final String DEVICES_REBOOT = "22";
|
||||
//获取设备详细信息
|
||||
/*获取设备详细信息*/
|
||||
private final String GET_DEVICES_INFO = "23";
|
||||
//霸屏
|
||||
/*霸屏*/
|
||||
private final String LOCK_SCREEN = "24";
|
||||
//取消霸屏
|
||||
/*取消霸屏*/
|
||||
private final String UNLOCK_SCREEN = "25";
|
||||
//结束进程
|
||||
/*结束进程*/
|
||||
private final String KILL_SERVER = "26";
|
||||
//时间管控
|
||||
/*时间管控*/
|
||||
private final String TIME_CONTROL = "27";
|
||||
//app霸屏
|
||||
/*app霸屏*/
|
||||
private final String TOP_APP = "28";
|
||||
//开机动画
|
||||
/*开机动画*/
|
||||
private final String LOGO_IMG = "29";
|
||||
//默认应用
|
||||
/*默认应用*/
|
||||
private final String DEFAULTP_APP = "30";
|
||||
//发出声音
|
||||
/*发出声音*/
|
||||
private final String PLAY_SOUND = "31";
|
||||
//清除app数据
|
||||
/*清除app数据*/
|
||||
private final String CLEAN_APP_CACHE = "32";
|
||||
//开发人员选项
|
||||
/*开发人员选项*/
|
||||
private final String DEVELOPER_OPTIONS = "33";
|
||||
//全局更新
|
||||
/*全局更新*/
|
||||
private final String GLOBAL_UPDATE = "34";
|
||||
//电子书包激活码
|
||||
/*电子书包激活码*/
|
||||
private final String EBAG_CODE = "35";
|
||||
//更新白名单
|
||||
/*更新白名单*/
|
||||
private final String UPDATE_WHITELIST = "36";
|
||||
//更换批次不恢复出厂
|
||||
/*更换批次不恢复出厂*/
|
||||
private final String UPDATE_BATCH = "37";
|
||||
//添加wifi
|
||||
/*添加wifi*/
|
||||
private final String UPDATE_WIFI_PW = "38";
|
||||
//远程关机
|
||||
/*远程关机*/
|
||||
private final String DEVICES_POWEROFF = "41";
|
||||
//远程log
|
||||
/*远程log*/
|
||||
private final String SN_RUN_LOG = "43";
|
||||
//自定义指令
|
||||
/*自定义指令*/
|
||||
private final String CUSTOM_ORDER = "44";
|
||||
/*优化内存*/
|
||||
private final String CLEAN_MEMORY = "47";
|
||||
/*运行日志设置*/
|
||||
private final String SN_LOG_SETTING = "48";
|
||||
|
||||
private Context mContext;
|
||||
private ContentResolver mResolver;
|
||||
@@ -612,7 +617,28 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
Log.e(TAG, (String) SPUtils.get(mContext, "AmapAddress", "-"));
|
||||
Log.e(TAG, (String) SPUtils.get(mContext, "AmapError", "-"));
|
||||
Log.e(TAG, "amap: " + sb.toString());
|
||||
HTTPInterface.updateDeviceInfo(mContext);
|
||||
NetInterfaceManager.getInstance().updateDeviceInfo(new NetInterfaceManager.ObserverCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
break;
|
||||
@@ -630,7 +656,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
ToastUtil.betaShow("收到管控:停止应用");
|
||||
JSONObject killJSONObject = JSON.parseObject(extras);
|
||||
String packages = killJSONObject.getString("package_name");
|
||||
JGYUtils.getInstance().killBackgroundProcesses(mContext, packages);
|
||||
JGYUtils.getInstance().killBackgroundProcesses(packages);
|
||||
break;
|
||||
case TIME_CONTROL:
|
||||
ToastUtil.betaShow("收到管控:使用时间管控");
|
||||
@@ -668,7 +694,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
case EBAG_CODE:
|
||||
ToastUtil.betaShow("收到管控:电子书包激活码");
|
||||
setEbagCode(extras);
|
||||
JGYUtils.getInstance().killBackgroundProcesses(mContext, "com.jxw.launcher");
|
||||
JGYUtils.getInstance().killBackgroundProcesses("com.jxw.launcher");
|
||||
break;
|
||||
case UPDATE_WHITELIST:
|
||||
ToastUtil.betaShow("收到管控:更新白名单");
|
||||
@@ -702,6 +728,12 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
case CUSTOM_ORDER:
|
||||
customOrder(extras);
|
||||
break;
|
||||
case CLEAN_MEMORY:
|
||||
JGYUtils.getInstance().cleanBackgroundMemory();
|
||||
break;
|
||||
case SN_LOG_SETTING:
|
||||
senSNLogFile(extras);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -960,10 +992,10 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
Settings.System.putInt(mResolver, JGYActions.ACTION_QCH_UNLOCK_IPAD, i);
|
||||
Log.e("SystemSetting", "qch_unlock_ipad---------" + i);
|
||||
|
||||
if (getBatteryLevel() >= CommonDatas.MIN_POWER) {
|
||||
if (getBatteryLevel() >= CommonConfig.MIN_POWER) {
|
||||
Utils.doMasterClear(mContext);
|
||||
} else {
|
||||
MySQLData.SetBooleanData(mContext, CommonDatas.IS_RESET, true);
|
||||
MySQLData.SetBooleanData(mContext, CommonConfig.IS_RESET, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1279,4 +1311,23 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jsonString
|
||||
* "is_log": 1,//是否开启运行日志 0关闭 1开启
|
||||
* "is_log_type": 1 //获取运行日志类型 0即时 1定时
|
||||
*/
|
||||
private void senSNLogFile(String jsonString) {
|
||||
JSONObject jsonObject = JSON.parseObject(jsonString);
|
||||
int is_log = jsonObject.getInteger("is_log");
|
||||
int is_log_type = jsonObject.getInteger("is_log_type");
|
||||
if (is_log == 0) {
|
||||
return;
|
||||
}
|
||||
if (is_log_type == 0) {
|
||||
NetInterfaceManager.getInstance().uploadLogFile();
|
||||
} else {
|
||||
SPUtils.put(mContext, CommonConfig.UPLOAD_LOG_TYPE, 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import android.widget.Toast;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
@@ -1037,7 +1037,7 @@ public class ApkUtils {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
pi = pm.getPackageInfo(pkgName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e("isSystemApp: NameNotFoundException:", e.getMessage());
|
||||
Log.e("isSystemApp: ", "NameNotFoundException:" + e.getMessage());
|
||||
}
|
||||
// 是系统中已安装的应用
|
||||
if (pi != null) {
|
||||
@@ -1152,23 +1152,15 @@ public class ApkUtils {
|
||||
Log.e("addShortcut", "putstring:" + qch_force_app);
|
||||
}
|
||||
|
||||
public static void getAppInfo(Context context) {
|
||||
public static String getRunningAppInfo(Context context) {
|
||||
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
List<ActivityManager.RunningServiceInfo> infoList = activityManager.getRunningServices(Integer.MAX_VALUE);
|
||||
for (ActivityManager.RunningServiceInfo info : infoList) {
|
||||
// Log.e("fht", "getAppInfo1: "+info.process);
|
||||
// Log.e("fht", "getAppInfo2: "+info.service.getPackageName());
|
||||
// Log.e("fht", "getAppInfo3: "+info.service.getClassName());
|
||||
}
|
||||
ArrayList<UploadAppInfo> appList = new ArrayList<UploadAppInfo>(); //用来存储获取的应用信息数据
|
||||
List<PackageInfo> packages = context.getPackageManager().getInstalledPackages(0);
|
||||
for (PackageInfo packageInfo : packages) {
|
||||
String packageName = packageInfo.packageName;
|
||||
//排除桌面app和出厂自带app
|
||||
if (desktopAPP.contains(packageName)
|
||||
|| factoryapp.contains(packageName)
|
||||
// || aoleyunAPP.contains(packageName)
|
||||
) {
|
||||
if (desktopAPP.contains(packageName) || factoryapp.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
//排除所有系统应用,不显示
|
||||
@@ -1180,79 +1172,27 @@ public class ApkUtils {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (ApkUtils.systemapp.contains(packageInfo.packageName)
|
||||
// || ApkUtils.show_canremove_systemapp.contains(packageInfo.packageName)
|
||||
// || ApkUtils.canremove_systemapp.contains(packageInfo.packageName)) {continue;}
|
||||
// //如果是系统应用且包名属于出厂app 跳过
|
||||
// if (((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) && factoryapp.contains(packageInfo.packageName)) {continue;}
|
||||
// if (desktopAPP.contains(packageInfo.packageName)) {continue;}
|
||||
// if (JGYUtils.getInstance().checkAppPlatform() == 2) {
|
||||
// if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
|
||||
UploadAppInfo uploadAppInfo = new UploadAppInfo();
|
||||
|
||||
uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(context.getPackageManager()).toString());
|
||||
uploadAppInfo.setPackage_name(packageInfo.packageName);
|
||||
Log.e("getAppInfo", "getAppInfo:" + packageInfo.packageName);
|
||||
// uploadAppInfo.setId(i);
|
||||
// String firstInstallTime = Utils.transferLongToDate(packageInfo.firstInstallTime);
|
||||
// String lastUpdateTime = Utils.transferLongToDate(packageInfo.lastUpdateTime);
|
||||
Log.e("getRunningAppInfo", "getRunningAppInfo:" + packageInfo.packageName);
|
||||
String firstInstallTime = Utils.transferLongToDate(packageInfo.lastUpdateTime);
|
||||
uploadAppInfo.setInstall_time(firstInstallTime);
|
||||
uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));
|
||||
uploadAppInfo.setState(0);
|
||||
uploadAppInfo.setVersionName(packageInfo.versionName);
|
||||
String appInstallDir = packageInfo.applicationInfo.publicSourceDir;
|
||||
int size = Integer.valueOf((int) new File(appInstallDir).length());
|
||||
uploadAppInfo.setApp_size(Formatter.formatFileSize(context, size));
|
||||
for (ActivityManager.RunningServiceInfo info : infoList) {
|
||||
if (info.process.contains(packageInfo.packageName)) {
|
||||
uploadAppInfo.setState(1);
|
||||
Log.e("getAppInfo", "getAppInfo running: " + packageInfo.packageName);
|
||||
Log.e("getRunningAppInfo", "getRunningAppInfo running: " + packageInfo.packageName);
|
||||
}
|
||||
}
|
||||
appList.add(uploadAppInfo);
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
String jsonString = gson.toJson(appList);
|
||||
Log.e(TAG, "getAppInfo: " + jsonString);
|
||||
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUploadAppInfoApi()
|
||||
.getUploadAppInfoApi(NetInterfaceManager.HTTP_KEY,
|
||||
Utils.getSerial(), jsonString)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(ResponseBody responseBody) {
|
||||
try {
|
||||
Log.e("getAppInfo", "上传的结果" + responseBody.string());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getAppInfo", "UploadAppInfoApi onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
Log.e(TAG, "getRunningAppInfo: " + jsonString);
|
||||
return jsonString;
|
||||
}
|
||||
|
||||
public static void RemoveTask(final Context context, final String packageName) {
|
||||
|
||||
@@ -5,8 +5,8 @@ import android.content.Intent;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.service.MainService;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
|
||||
public class BootManager {
|
||||
private Context mContext;
|
||||
|
||||
@@ -18,7 +18,6 @@ import android.graphics.Bitmap;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
@@ -28,13 +27,15 @@ import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
import com.blankj.utilcode.util.FileUtils;
|
||||
import com.blankj.utilcode.util.PathUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
@@ -45,7 +46,6 @@ import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.base.BaseApplication;
|
||||
import com.aoleyun.sn.bean.AppListInfo;
|
||||
import com.aoleyun.sn.bean.Appground;
|
||||
@@ -54,10 +54,9 @@ import com.aoleyun.sn.bean.ForceDownloadData;
|
||||
import com.aoleyun.sn.bean.NetAndLaunchBean;
|
||||
import com.aoleyun.sn.bean.NetAndLaunchData;
|
||||
import com.aoleyun.sn.bean.TTAppground;
|
||||
import com.aoleyun.sn.comm.CommonDatas;
|
||||
import com.aoleyun.sn.service.GuardService;
|
||||
import com.aoleyun.sn.service.LogcatService;
|
||||
import com.aoleyun.sn.service.MainService;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.aoleyun.sn.service.StepService;
|
||||
|
||||
import java.io.File;
|
||||
@@ -160,10 +159,10 @@ public class JGYUtils {
|
||||
}
|
||||
|
||||
public void resetDevice() {
|
||||
boolean isReset = MySQLData.GetBooleanData(mContext, CommonDatas.IS_RESET);
|
||||
boolean isReset = MySQLData.GetBooleanData(mContext, CommonConfig.IS_RESET);
|
||||
int batteryLevel = getBatteryLevel();
|
||||
Log.e(TAG, "batteryLevel:" + batteryLevel + " isReset" + isReset);
|
||||
if (isReset && batteryLevel >= CommonDatas.MIN_POWER) {
|
||||
if (isReset && batteryLevel >= CommonConfig.MIN_POWER) {
|
||||
Utils.doMasterClear(mContext);
|
||||
}
|
||||
}
|
||||
@@ -173,7 +172,7 @@ public class JGYUtils {
|
||||
return path + File.separator;
|
||||
}
|
||||
|
||||
private int getBatteryLevel() {
|
||||
public int getBatteryLevel() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
BatteryManager batteryManager = (BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE);
|
||||
return batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
|
||||
@@ -398,19 +397,19 @@ public class JGYUtils {
|
||||
@SuppressLint("NewApi")
|
||||
synchronized public static void setAppNetwork(Context context, HashSet<String> blackList) {
|
||||
Log.e(TAG, "setAppNetwork: " + "设置应用联网管控" + blackList);
|
||||
String dis = Settings.System.getString(context.getContentResolver(), JGYActions.ACTION_HR_RECEIVER_JGY_DIS);
|
||||
String not = Settings.System.getString(context.getContentResolver(), JGYActions.ACTION_HR_RECEIVER_JGY);
|
||||
String dis = Settings.System.getString(context.getContentResolver(), JGYActions.ACTION_HRRECEIVER_JGY_DIS);
|
||||
String not = Settings.System.getString(context.getContentResolver(), JGYActions.ACTION_HRRECEIVER_JGY);
|
||||
//清除旧数据
|
||||
if (!TextUtils.isEmpty(dis)) {
|
||||
Log.e(TAG, "setAppNetwork: dis = " + dis);
|
||||
Settings.System.putString(context.getContentResolver(), JGYActions.ACTION_HR_RECEIVER_JGY_DIS, "Invalid");
|
||||
Settings.System.putString(context.getContentResolver(), JGYActions.ACTION_HRRECEIVER_JGY_DIS, "Invalid");
|
||||
}
|
||||
if (!TextUtils.isEmpty(not)) {
|
||||
Log.e(TAG, "setAppNetwork: not = " + not);
|
||||
Settings.System.putString(context.getContentResolver(), JGYActions.ACTION_HR_RECEIVER_JGY, "Invalid");
|
||||
Settings.System.putString(context.getContentResolver(), JGYActions.ACTION_HRRECEIVER_JGY, "Invalid");
|
||||
}
|
||||
|
||||
String oldBlackList = (String) SPUtils.get(context, JGYActions.ACTION_HR_RECEIVER_JGY_DIS, "");
|
||||
String oldBlackList = (String) SPUtils.get(context, JGYActions.ACTION_HRRECEIVER_JGY_DIS, "");
|
||||
HashSet<String> oldBlackListSet = new HashSet<>(Arrays.asList(oldBlackList.split(",")));
|
||||
oldBlackListSet.removeIf(s -> TextUtils.isEmpty(s.trim()));
|
||||
//之前禁止上网得列表
|
||||
@@ -427,7 +426,7 @@ public class JGYUtils {
|
||||
} else {
|
||||
Log.e(TAG, "setAppNetwork: " + pkg + " 已安装");
|
||||
}
|
||||
Intent netControlNotIntent = new Intent(JGYActions.ACTION_HR_RECEIVER_JGY_DIS);
|
||||
Intent netControlNotIntent = new Intent(JGYActions.ACTION_HRRECEIVER_JGY_DIS);
|
||||
netControlNotIntent.putExtra("package_name", pkg);
|
||||
netControlNotIntent.setPackage("com.android.settings");
|
||||
context.sendBroadcast(netControlNotIntent);
|
||||
@@ -450,7 +449,7 @@ public class JGYUtils {
|
||||
Log.e(TAG, "setAppNetwork: addedNet: " + addedNet);
|
||||
for (String pkg : removedNet) {
|
||||
if (TextUtils.isEmpty(pkg)) continue;
|
||||
Intent netControlNotIntent = new Intent(JGYActions.ACTION_HR_RECEIVER_JGY);
|
||||
Intent netControlNotIntent = new Intent(JGYActions.ACTION_HRRECEIVER_JGY);
|
||||
netControlNotIntent.putExtra("package_name", pkg);
|
||||
netControlNotIntent.setPackage("com.android.settings");
|
||||
context.sendBroadcast(netControlNotIntent);
|
||||
@@ -464,7 +463,7 @@ public class JGYUtils {
|
||||
} else {
|
||||
Log.e(TAG, "setAppNetwork: " + pkg + " 已安装");
|
||||
}
|
||||
Intent netControlNotIntent = new Intent(JGYActions.ACTION_HR_RECEIVER_JGY_DIS);
|
||||
Intent netControlNotIntent = new Intent(JGYActions.ACTION_HRRECEIVER_JGY_DIS);
|
||||
netControlNotIntent.putExtra("package_name", pkg);
|
||||
netControlNotIntent.setPackage("com.android.settings");
|
||||
context.sendBroadcast(netControlNotIntent);
|
||||
@@ -472,7 +471,7 @@ public class JGYUtils {
|
||||
}
|
||||
|
||||
String net_not = String.join(",", blackList);
|
||||
SPUtils.put(context, JGYActions.ACTION_HR_RECEIVER_JGY_DIS, net_not);
|
||||
SPUtils.put(context, JGYActions.ACTION_HRRECEIVER_JGY_DIS, net_not);
|
||||
//Settings.System.putString(mContext.getContentResolver(), JGYActions.ACTION_HrReceiver_JGY_DIS, net_not);
|
||||
Log.e("fht", "not::" + net_not);
|
||||
|
||||
@@ -487,7 +486,7 @@ public class JGYUtils {
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
synchronized public void onBootSendNetwork() {
|
||||
String oldBlackListString = (String) SPUtils.get(mContext, JGYActions.ACTION_HR_RECEIVER_JGY_DIS, "");
|
||||
String oldBlackListString = (String) SPUtils.get(mContext, JGYActions.ACTION_HRRECEIVER_JGY_DIS, "");
|
||||
HashSet<String> oldBlackListSet = new HashSet<>(Arrays.asList(oldBlackListString.split(",")));
|
||||
Log.e(TAG, "setAppNetwork: oldBlackListSet: " + oldBlackListSet);
|
||||
oldBlackListSet.removeIf(new Predicate<String>() {
|
||||
@@ -502,7 +501,7 @@ public class JGYUtils {
|
||||
Log.e(TAG, "setAppNetwork: skip: " + pkg);
|
||||
continue;
|
||||
}
|
||||
Intent netControlNotIntent = new Intent(JGYActions.ACTION_HR_RECEIVER_JGY_DIS);
|
||||
Intent netControlNotIntent = new Intent(JGYActions.ACTION_HRRECEIVER_JGY_DIS);
|
||||
netControlNotIntent.putExtra("package_name", pkg);
|
||||
netControlNotIntent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(netControlNotIntent);
|
||||
@@ -1556,11 +1555,26 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public void killBackgroundProcesses(Context context, String processName) {
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
public void cleanBackgroundMemory() {
|
||||
ActivityManager manager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
|
||||
String pkg = service.service.getPackageName();
|
||||
Log.i("cleanBackgroundMemory", pkg);
|
||||
if (ApkUtils.isSystemApp(mContext, pkg)) continue;
|
||||
if (ApkUtils.desktopAPP.contains(pkg) || ApkUtils.aoleyunAPP.contains(pkg)) {
|
||||
continue;
|
||||
}
|
||||
manager.forceStopPackage(service.service.getPackageName());
|
||||
Log.e("cleanBackgroundMemory", "kill :" + pkg);
|
||||
}
|
||||
}
|
||||
|
||||
public void killBackgroundProcesses(String processName) {
|
||||
gotoLauncher();
|
||||
// mIsScanning = true;
|
||||
removeTask(processName);
|
||||
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
ActivityManager activityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
String packageName = null;
|
||||
try {
|
||||
if (processName.indexOf(":") == -1) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
|
||||
|
||||
import com.aoleyun.sn.comm.CommonDatas;
|
||||
import com.aoleyun.sn.database.DBHelper;
|
||||
import com.aoleyun.sn.database.DBSqlBuilder;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import android.graphics.drawable.BitmapDrawable;
|
||||
import android.util.Base64;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.aoleyun.sn.comm.CommonDatas;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -94,8 +94,8 @@ public class SPUtils {
|
||||
}
|
||||
|
||||
//还原状态firstEnter信息
|
||||
private static void reductFirstEnter(Context context){
|
||||
put(context, CommonDatas.FLAG_FIRST_ENTER,CommonDatas.FLAG_FIRST_ENTER);
|
||||
private static void reductFirstEnter(Context context) {
|
||||
put(context, CommonConfig.FLAG_FIRST_ENTER, CommonConfig.FLAG_FIRST_ENTER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.blankj.utilcode.util.SPStaticUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.aoleyun.sn.comm.CommonDatas;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
@@ -18,7 +18,7 @@ public class SaveListUtils {
|
||||
private static List<String> forceList = new ArrayList<>();
|
||||
|
||||
public static List<String> getList() {
|
||||
String data = SPStaticUtils.getString(CommonDatas.FORCE_INSTALL);
|
||||
String data = SPStaticUtils.getString(CommonConfig.FORCE_INSTALL);
|
||||
Log.e("SaveListUtils", data);
|
||||
Gson gson = new Gson();
|
||||
Type listType = new TypeToken<List<String>>() {
|
||||
@@ -41,7 +41,7 @@ public class SaveListUtils {
|
||||
list.add(data);
|
||||
Gson gson = new Gson();
|
||||
String gsonData = gson.toJson(list);
|
||||
SPStaticUtils.put(CommonDatas.FORCE_INSTALL, gsonData);
|
||||
SPStaticUtils.put(CommonConfig.FORCE_INSTALL, gsonData);
|
||||
}
|
||||
Log.e("fht", "addToList:" + list.toString());
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class SaveListUtils {
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
String gsonData = gson.toJson(forceList);
|
||||
SPStaticUtils.put(CommonDatas.FORCE_INSTALL, gsonData);
|
||||
SPStaticUtils.put(CommonConfig.FORCE_INSTALL, gsonData);
|
||||
Log.e("fht", "setList:" + forceList.toString());
|
||||
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class SaveListUtils {
|
||||
public static void setList() {
|
||||
Gson gson = new Gson();
|
||||
String gsonData = gson.toJson(forceList);
|
||||
SPStaticUtils.put(CommonDatas.FORCE_INSTALL, gsonData);
|
||||
SPStaticUtils.put(CommonConfig.FORCE_INSTALL, gsonData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -51,7 +51,7 @@ public class SysSettingUtils {
|
||||
setCanReset(context, jsonObject);
|
||||
setAutoTime(context, jsonObject);
|
||||
JSONObject navJson = jsonObject.getJSONObject("setting_nav");
|
||||
SPUtils.put(context, JGYActions.ACTION_STATUS_BAR_STATUS, jsonObject.getJSONObject("setting_nav").toJSONString());
|
||||
SPUtils.put(context, JGYActions.ACTION_STATUSBAR_STATUS, jsonObject.getJSONObject("setting_nav").toJSONString());
|
||||
setStatusBar(context, navJson);
|
||||
setBrowserInput(context, jsonObject);
|
||||
//otg开关
|
||||
|
||||
@@ -10,7 +10,7 @@ import android.util.Log;
|
||||
|
||||
|
||||
import com.aoleyun.sn.bean.PoweroffBean;
|
||||
import com.aoleyun.sn.service.MainService;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
|
||||
@@ -50,10 +50,10 @@ import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.network.HTTPInterface;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.blankj.utilcode.util.FileUtils;
|
||||
import com.blankj.utilcode.util.PathUtils;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.WriterException;
|
||||
@@ -63,7 +63,6 @@ import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.base.BaseApplication;
|
||||
import com.aoleyun.sn.comm.CommonDatas;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -931,12 +930,12 @@ public class Utils {
|
||||
context.sendBroadcast(intent);
|
||||
} else {
|
||||
//10.0的不需要最小电量
|
||||
if (getBatteryLevel(context) >= CommonDatas.MIN_POWER) {
|
||||
if (getBatteryLevel(context) >= CommonConfig.MIN_POWER) {
|
||||
Intent intent = new Intent("android.intent.action.MASTER_CLEAR");
|
||||
// intent.setPackage("com.android.settings");
|
||||
context.sendBroadcast(intent);
|
||||
} else {
|
||||
MySQLData.SetBooleanData(context, CommonDatas.IS_RESET, true);
|
||||
MySQLData.SetBooleanData(context, CommonConfig.IS_RESET, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,3 +42,9 @@ Java_com_aoleyun_sn_utils_JGYUtils_getAuthorization(JNIEnv *env, jclass clazz) {
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_aoleyun_sn_activity_main_MainAPresenter_getAeskey(JNIEnv *env, jobject thiz) {
|
||||
std::string key = "0123456789ABCDEF";
|
||||
return env->NewStringUTF(key.c_str());
|
||||
}
|
||||
BIN
app/src/main/res/drawable-hdpi/delete.png
Normal file
BIN
app/src/main/res/drawable-hdpi/delete.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-hdpi/refresh.png
Normal file
BIN
app/src/main/res/drawable-hdpi/refresh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.CheckNetActivity">
|
||||
tools:context=".activity.checknet.CheckNetActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl"
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/bt_log" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
android:id="@+id/back"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginLeft="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/back"
|
||||
@@ -28,16 +28,8 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
@@ -46,10 +38,10 @@
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locked"
|
||||
android:layout_width="@dimen/dp_12"
|
||||
@@ -60,16 +52,10 @@
|
||||
android:src="@drawable/locked"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/textView3"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_title"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
@@ -97,10 +83,8 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.357" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -398,14 +382,10 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_customversion"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -415,5 +395,4 @@
|
||||
android:textColor="@color/background_top"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
8
app/src/main/res/layout-land/activity_request_log.xml
Normal file
8
app/src/main/res/layout-land/activity_request_log.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.CheckNetActivity">
|
||||
tools:context=".activity.checknet.CheckNetActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl"
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/bt_log" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="40dp"
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".activity.main.MainActivity">
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/bannerLayout"
|
||||
android:layout_width="match_parent"
|
||||
@@ -22,7 +21,7 @@
|
||||
android:id="@+id/back"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginLeft="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/back"
|
||||
@@ -30,16 +29,8 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
@@ -48,10 +39,10 @@
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locked"
|
||||
android:layout_width="@dimen/dp_12"
|
||||
@@ -62,12 +53,8 @@
|
||||
android:src="@drawable/locked"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/textView3"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_title"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ImageView
|
||||
@@ -81,9 +68,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.096">
|
||||
|
||||
</ImageView>
|
||||
app:layout_constraintVertical_bias="0.096" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_batch"
|
||||
@@ -353,8 +338,6 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
|
||||
131
app/src/main/res/layout-port/activity_request_log.xml
Normal file
131
app/src/main/res/layout-port/activity_request_log.xml
Normal file
@@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/bannerLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/back"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="运行日志"
|
||||
android:textColor="@color/title_textcolor"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_refresh"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/refresh"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bannerLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_code"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="代码" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_timestamp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="时间" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_event"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="事件" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_operate"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="操作" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center"
|
||||
android:text="内容" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/constraintLayout4"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_title" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_delete"
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/delete"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
51
app/src/main/res/layout/item_requestlog.xml
Normal file
51
app/src/main/res/layout/item_requestlog.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_code"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_timestamp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_event"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_operate"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user