update:2020.08.31
fix:增加设备锁图标,增加结束进程和打开OTA,增加重启功能
add:
This commit is contained in:
2020-08-31 14:06:57 +08:00
parent ec61380fcc
commit 2340af523e
9 changed files with 100 additions and 24 deletions

View File

@@ -86,9 +86,26 @@ android {
buildConfigField "String", "ROOT_URL", '"https://jgy.jundunxueyuan.com/api/"'
buildConfigField "String", "WebsocketURL", '"ws://39.98.59.202:2345"'
}
newl {
flavorDimensions "default"
versionCode 150
versionName "1.0.5"
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
JPUSH_APPKEY : "52d81643665bb2cadacf0e9e", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
]
signingConfig signingConfigs.debug
/*********************************极光推送end************************************/
buildConfigField "String", "ROOT_URL", '"http://name.uiuios.com/api/"'
buildConfigField "String", "WebsocketURL", '"ws://39.98.59.202:2345"'
}
}
sourceSets {
beta.res.srcDirs = ['src/beta/res']
newl.res.srcDirs = ['src/beta/res']
}
//签名
@@ -199,8 +216,8 @@ dependencies {
implementation 'com.google.code.gson:gson:2.8.0'
// implementation 'cn.jiguang:jpush:2.2.0'
implementation 'cn.jiguang.sdk:jpush:3.5.6' // 此处以JPush 3.5.6 版本为例。
implementation 'cn.jiguang.sdk:jcore:2.2.8' // 此处以JCore 2.2.8 版本为例。
implementation 'cn.jiguang.sdk:jpush:3.7.0' // 此处以JPush 3.5.6 版本为例。
implementation 'cn.jiguang.sdk:jcore:2.4.2' // 此处以JCore 2.2.8 版本为例。
implementation "com.github.yjfnypeu:UpdatePlugin:3.0.1"

View File

@@ -1,7 +1,9 @@
package com.mjsheng.myappstore.activity;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface;
@@ -113,7 +115,7 @@ import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.TagAliasBean;
import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.sequence;
import static com.mjsheng.myappstore.utils.Utils.shotScreen;
public class MainActivity extends AppCompatActivity {
public class MainActivity extends AppCompatActivity {
private ToastCallback callback;
private long mPreClickTime;
@@ -127,7 +129,7 @@ public class MainActivity extends AppCompatActivity {
private Button bt_checkupdate;
private int DeviceInfo;
private RelativeLayout checkupdate;
private ImageView back;
private ImageView back, iv_locked;
private RelativeLayout layout_class, layout_number, layout_name;
//jiguang
public static boolean isForeground = false;
@@ -228,7 +230,6 @@ public class MainActivity extends AppCompatActivity {
allIntent.setAction(Utils.DOWNLOAD_ALLTASK_ACTION);
sendBroadcast(allIntent);
// CmdUtil.execute(" screencap -p /sdcard/" + "screen" + System.currentTimeMillis() + ".png");
}
//获取教管易版本号
@@ -309,7 +310,7 @@ public class MainActivity extends AppCompatActivity {
lazyExit();
}
});
iv_locked = findViewById(R.id.locked);
layout_class = findViewById(R.id.layout_class);
layout_number = findViewById(R.id.layout_number);
layout_name = findViewById(R.id.layout_name);
@@ -343,7 +344,7 @@ public class MainActivity extends AppCompatActivity {
private void initData() {
Log.e("mjhsneg", "gagagag--------------------------" + Utils.getSerial());
getLockedState();
getLockedState(mHandler);
// MyApplication.getInstance().getWhitePackageList();
// update();//接口更新app
@@ -475,7 +476,7 @@ public class MainActivity extends AppCompatActivity {
private boolean locked = false;
public void getLockedState() {
public void getLockedState(final Handler handler) {
OkGo.post(Configure.HTTP_TAG_FIRST)
.params("sn", Utils.getSerial())
.execute(new StringCallback() {
@@ -495,6 +496,7 @@ public class MainActivity extends AppCompatActivity {
boolean se = Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_unlock_ipad", 1);
Log.e("ttlocked1", "getLockedState---------" + Settings.System.getString(MainActivity.this.getContentResolver(), "qch_unlock_ipad"));
Log.e("ttlocked1", "qch_unlock_ipad---------" + locked + se);
handler.sendEmptyMessage(-3);
} else {
locked = true;
Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_unlock_ipad", 0);
@@ -504,6 +506,7 @@ public class MainActivity extends AppCompatActivity {
Log.e("ttlocked2", "DeselectBrowserArray---------" + a);
String b = Settings.System.getString(MainActivity.this.getContentResolver(), "qch_webblack_url");
Log.e("ttlocked2", "qch_webblack_url---------" + b);
handler.sendEmptyMessage(3);
HTTPInterface.setJpushTags(MainActivity.this);
sendMACaddress();
timerImitate();
@@ -511,6 +514,7 @@ public class MainActivity extends AppCompatActivity {
}
} else if (code == -300) {
// ApkUtils.uninstallAllApp(MainActivity.this);
handler.sendEmptyMessage(-3);
}
}
@@ -627,7 +631,14 @@ public class MainActivity extends AppCompatActivity {
layout_number.setVisibility(View.GONE);
layout_name.setVisibility(View.GONE);
break;
case 3:
iv_locked.setVisibility(View.VISIBLE);
break;
case -3:
iv_locked.setVisibility(View.GONE);
break;
default:
break;
}
}
@@ -734,7 +745,7 @@ public class MainActivity extends AppCompatActivity {
allIntent.setAction(Utils.DOWNLOAD_ALLTASK_ACTION);
sendBroadcast(allIntent);
loadHeadImg(Configure.HTTP_TAG_HOME_PAGE_URL);
getLockedState();
getLockedState(mHandler);
// MyApplication.getInstance().getWhitePackageList();
getInfo(mHandler);
// CmdUtil.execute(" screencap -p /sdcard/" + "screen" + System.currentTimeMillis() + ".png");

View File

@@ -292,7 +292,7 @@ public class HTTPInterface {
});
}
public static void setJpushTags(final Context context) {
synchronized public static void setJpushTags(final Context context) {
OkGo.get(Configure.GET_DEVICES_TAGS)
.params("sn", Utils.getSerial())
.execute(new StringCallback() {

View File

@@ -59,11 +59,11 @@ public class MyJPushReceiver extends BroadcastReceiver {
private final String ACTION_HrReceiver_JGY = "qch_jgy_network_allow";
private final String ACTION_HrReceiver_JGY_DIS = "qch_jgy_network_disallow";
private final String MSG_DELETE = "1";
private final String MSG_DELETE = "1";//删除应用
private final String MSG_SETTING = "2";
private final String MSG_SETTING = "2";//系统设置管控
private final String MSG_BROWSER = "4";
private final String MSG_BROWSER = "4";//浏览器网址管控
private final String MSG_APPID = "5";
@@ -95,7 +95,11 @@ public class MyJPushReceiver extends BroadcastReceiver {
private final String DISABLE_APP_SLIDE = "19";//禁止滑动
private final String UPDATE_INFO = "20";//禁止滑动
private final String UPDATE_INFO = "20";//
private final String SN_SCREENSHOT = "21";//截图
private final String DEVICES_REBOOT = "22";//重启
private Context mContext;
@@ -380,7 +384,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
//摄像头开关
int setting_camera = changeNum(data.optInt("setting_camera"));
Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_camera", setting_camera);
ApkUtils.hideSystemSettingAPP(this.mContext,"com.mediatek.camera");
ApkUtils.hideSystemSettingAPP(this.mContext, "com.mediatek.camera");
Log.e("SystemSetting", "setting_camera---------" + setting_camera);
String cameraStatus = "";
switch (setting_camera) {
@@ -429,22 +433,22 @@ public class MyJPushReceiver extends BroadcastReceiver {
//时钟
int deskclock = changeNum(data.optInt("setting_clock"));
Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_deskclock", deskclock);
ApkUtils.hideSystemSettingAPP(this.mContext,"com.android.deskclock");
ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.deskclock");
Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
//录音机
int soundrecorder = changeNum(data.optInt("setting_recording"));
Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
ApkUtils.hideSystemSettingAPP(this.mContext,"com.android.soundrecorder");
ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.soundrecorder");
Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
//音乐
int music = changeNum(data.optInt("setting_music"));
Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_music", music);
ApkUtils.hideSystemSettingAPP(this.mContext,"com.android.music");
ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.music");
Log.e("SystemSetting", "qch_app_music" + music);
//图库
int gallery = changeNum(data.optInt("setting_picture"));
Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_gallery", gallery);
ApkUtils.hideSystemSettingAPP(this.mContext,"com.android.gallery3d");
ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.gallery3d");
Log.e("SystemSetting", "qch_app_gallery" + gallery);
//壁纸
int wallpaper = changeNum(data.optInt("setting_wallpaper"));
@@ -453,10 +457,10 @@ public class MyJPushReceiver extends BroadcastReceiver {
//文件管理器
int filemanager = changeNum(data.optInt("setting_file"));
Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_filemanager", filemanager);
if (Build.VERSION.SDK_INT<Build.VERSION_CODES.O){
ApkUtils.hideSystemSettingAPP(this.mContext,"com.mediatek.filemanager");
}else {
ApkUtils.hideSystemSettingAPP(this.mContext,"com.android.documentsui");
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
ApkUtils.hideSystemSettingAPP(this.mContext, "com.mediatek.filemanager");
} else {
ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.documentsui");
}
Log.e("SystemSetting", "qch_app_filemanager" + filemanager);
} catch (Exception e) {

View File

@@ -34,6 +34,8 @@ import org.java_websocket.handshake.ServerHandshake;
import java.net.URI;
import java.nio.file.Path;
import okhttp3.internal.Util;
/**
* 主进程 双进程通讯
*
@@ -81,6 +83,8 @@ public class StepService extends Service {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// Utils.KillOTA(StepService.this);
// Utils.openOTA(StepService.this);
// startForeground(1, new Notification());
// 绑定建立链接
// try {

View File

@@ -1,6 +1,7 @@
package com.mjsheng.myappstore.utils;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.admin.DevicePolicyManager;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
@@ -1080,5 +1081,19 @@ public class Utils {
}
public static void KillOTA(Context context) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
manager.killBackgroundProcesses("com.adups.fota");
CmdUtil.execute("am force-stop " + "com.adups.fota");
}
public static void openOTA(Context context) {
Intent intent = new Intent(Intent.ACTION_MAIN);
/**知道要跳转应用的包命与目标Activity*/
ComponentName componentName = new ComponentName("com.adups.fota", "com.adups.fota.GoogleOtaClient");
intent.setComponent(componentName);
context.startActivity(intent);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -40,6 +40,19 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/textView3"
app:layout_constraintTop_toTopOf="@+id/textView3" />
<ImageView
android:id="@+id/locked"
android:layout_width="@dimen/dp_16"
android:layout_height="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_8"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/locked"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/textView3"
app:layout_constraintTop_toTopOf="@+id/textView3" />
</android.support.constraint.ConstraintLayout>
<ImageView

View File

@@ -41,6 +41,18 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/textView3"
app:layout_constraintTop_toTopOf="@+id/textView3" />
<ImageView
android:id="@+id/locked"
android:layout_width="@dimen/dp_16"
android:layout_height="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_8"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/locked"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/textView3"
app:layout_constraintTop_toTopOf="@+id/textView3" />
</android.support.constraint.ConstraintLayout>
<ImageView