version:2.0.2.1
update:2020.08.17 fix:后台隐藏桌面图标的应用未安装时,管控失效 add:抓取log,静默截图
This commit is contained in:
@@ -73,8 +73,8 @@ android {
|
|||||||
//中优
|
//中优
|
||||||
zhongyou {
|
zhongyou {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 1100
|
versionCode 1
|
||||||
versionName "1.0.0.0"//测试jiaoguanyi.cn
|
versionName "1.0"//测试jiaoguanyi.cn
|
||||||
/*********************************极光推送************************************/
|
/*********************************极光推送************************************/
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||||
<uses-permission android:name="android.permission.MASTER_CLEAR" />
|
<uses-permission android:name="android.permission.MASTER_CLEAR" />
|
||||||
<uses-permission android:name="android.permission.REBOOT" />
|
<uses-permission android:name="android.permission.REBOOT" />
|
||||||
|
<uses-permission android:name="android.permission.DUMP" />
|
||||||
|
<uses-permission android:name="android.permission.READ_LOGS" />
|
||||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
|
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
@@ -132,6 +134,18 @@
|
|||||||
<action android:name="com.jiaoguanyi.appstore.intent.action.BOOT_COMPLETED" />
|
<action android:name="com.jiaoguanyi.appstore.intent.action.BOOT_COMPLETED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
<!-- <receiver android:name=".log.LogReceiver"-->
|
||||||
|
<!-- android:permission="android.permission.DUMP" >-->
|
||||||
|
<!-- <intent-filter>-->
|
||||||
|
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" />-->
|
||||||
|
<!-- <action android:name="com.debug.loggerui.ADB_CMD" />-->
|
||||||
|
<!-- <action android:name="com.mediatek.mdlogger.AUTOSTART_COMPLETE" />-->
|
||||||
|
<!-- <action android:name="com.mediatek.log2server.EXCEPTION_HAPPEND" />-->
|
||||||
|
<!-- <action android:name="com.debug.loggerui.bypass" />-->
|
||||||
|
|
||||||
|
<!-- <category android:name="android.intent.category.DEFAULT" />-->
|
||||||
|
<!-- </intent-filter>-->
|
||||||
|
<!-- </receiver>-->
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".receiver.MyJPushReceiver"
|
android:name=".receiver.MyJPushReceiver"
|
||||||
android:enabled="true">
|
android:enabled="true">
|
||||||
|
|||||||
@@ -58,7 +58,10 @@ import org.lzh.framework.updatepluginlib.UpdateConfig;
|
|||||||
import org.lzh.framework.updatepluginlib.base.UpdateParser;
|
import org.lzh.framework.updatepluginlib.base.UpdateParser;
|
||||||
import org.lzh.framework.updatepluginlib.model.CheckEntity;
|
import org.lzh.framework.updatepluginlib.model.CheckEntity;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@@ -173,7 +176,63 @@ public class MyApplication extends MultiDexApplication {
|
|||||||
}
|
}
|
||||||
registerTimeReceiver();
|
registerTimeReceiver();
|
||||||
// ignoreBatteryOptimization(this);
|
// ignoreBatteryOptimization(this);
|
||||||
|
// try {
|
||||||
|
// Process exec = Runtime.getRuntime().exec(running);
|
||||||
|
// final InputStream is = exec.getInputStream();
|
||||||
|
// new LogThread(is).start();
|
||||||
|
// } catch (IOException e) {
|
||||||
|
//// e.printStackTrace();
|
||||||
|
// Log.e("第一个是Logcat", e.getMessage());
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
//第一个是Logcat ,也就是我们想要获取的log日志
|
||||||
|
//第二个是 -s 也就是表示过滤的意思
|
||||||
|
//第三个就是 我们要过滤的类型 W表示warm ,我们也可以换成 D :debug, I:info,E:error等等
|
||||||
|
// String[] running = new String[]{"logcat", "-s", "adb logcat *: W"};
|
||||||
|
String[] running = new String[]{"logcat"};
|
||||||
|
String filePath = "/sdcard/Log/Log.txt";
|
||||||
|
|
||||||
|
class LogThread extends Thread {
|
||||||
|
InputStream is;
|
||||||
|
|
||||||
|
LogThread(InputStream inputStream) {
|
||||||
|
super();
|
||||||
|
this.is = inputStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
FileOutputStream os = null;
|
||||||
|
try {
|
||||||
|
//新建一个路径信息
|
||||||
|
File file = new File(filePath);
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
file.createNewFile();
|
||||||
|
}
|
||||||
|
os = new FileOutputStream(filePath);
|
||||||
|
int len = 0;
|
||||||
|
byte[] buf = new byte[1024];
|
||||||
|
while (-1 != (len = is.read(buf))) {
|
||||||
|
os.write(buf, 0, len);
|
||||||
|
os.flush();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("writelog", "read logcat process failed. message: "
|
||||||
|
+ e.getMessage());
|
||||||
|
} finally {
|
||||||
|
if (null != os) {
|
||||||
|
try {
|
||||||
|
os.close();
|
||||||
|
os = null;
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
Intent allIntent = new Intent();
|
Intent allIntent = new Intent();
|
||||||
allIntent.setAction(Utils.DOWNLOAD_ALLTASK_ACTION);
|
allIntent.setAction(Utils.DOWNLOAD_ALLTASK_ACTION);
|
||||||
sendBroadcast(allIntent);
|
sendBroadcast(allIntent);
|
||||||
|
// CmdUtil.execute(" screencap -p /sdcard/" + "screen" + System.currentTimeMillis() + ".png");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.mjsheng.myappstore.log;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author MTK81255
|
||||||
|
*/
|
||||||
|
public class LogReceiver extends BroadcastReceiver {
|
||||||
|
private static final String TAG = "/LogReceiver";
|
||||||
|
public static final String ACTION_ADB_CMD = "com.debug.loggerui.ADB_CMD";
|
||||||
|
public static final String ACTION_MDLOGGER_RESTART_DONE = "com.mediatek.mdlogger.AUTOSTART_COMPLETE";
|
||||||
|
public static final String ACTION_EXP_HAPPENED = "com.mediatek.log2server.EXCEPTION_HAPPEND";
|
||||||
|
public static final String ACTION_FROM_BYPASS = "com.debug.loggerui.bypass";
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
Log.e(TAG, " -->onReceive(), action=" + action);
|
||||||
|
// if (Utils.isServiceOnDestroying()) {
|
||||||
|
// Utils.logw(TAG, "Service is On Destroying, juet do nothing for " + action);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
ReceiverHandler receiverHandler = ReceiverHandler.getDefaultInstance();
|
||||||
|
if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
|
||||||
|
receiverHandler.obtainMessage(ReceiverHandler.MSG_RECEIVER_BOOT_COMPLETED,
|
||||||
|
intent).sendToTarget();
|
||||||
|
} else if (ACTION_ADB_CMD.equals(action)) {
|
||||||
|
receiverHandler.obtainMessage(ReceiverHandler.MSG_RECEIVER_ADB_CMD,
|
||||||
|
intent).sendToTarget();
|
||||||
|
} else if (ACTION_MDLOGGER_RESTART_DONE.equals(action)) {
|
||||||
|
receiverHandler.obtainMessage(
|
||||||
|
ReceiverHandler.MSG_RECEIVER_MDLOGGER_RESTART_DONE,
|
||||||
|
intent).sendToTarget();
|
||||||
|
} else if (ACTION_EXP_HAPPENED.equals(action)) {
|
||||||
|
receiverHandler.obtainMessage(ReceiverHandler.MSG_RECEIVER_EXP_HAPPENED,
|
||||||
|
intent).sendToTarget();
|
||||||
|
} else if (ACTION_FROM_BYPASS.equals(action)) {
|
||||||
|
receiverHandler.obtainMessage(ReceiverHandler.MSG_RECEIVER_FROM_BYPASS,
|
||||||
|
intent).sendToTarget();
|
||||||
|
}
|
||||||
|
Log.e(TAG, " OnReceive function exit.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
package com.mjsheng.myappstore.log;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.HandlerThread;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.os.Process;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author MTK81255
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ReceiverHandler extends Handler {
|
||||||
|
private static final String TAG ="/ReceiverHandler";
|
||||||
|
|
||||||
|
public static final int MSG_KILL_SELF = 1;
|
||||||
|
public static final int MSG_RECEIVER_BOOT_COMPLETED = 2;
|
||||||
|
public static final int MSG_RECEIVER_ADB_CMD = 3;
|
||||||
|
public static final int MSG_RECEIVER_MDLOGGER_RESTART_DONE = 4;
|
||||||
|
public static final int MSG_RECEIVER_EXP_HAPPENED = 5;
|
||||||
|
public static final int MSG_RECEIVER_FROM_BYPASS = 6;
|
||||||
|
// After receiver a kill self command, wait this time(ms) to avoid
|
||||||
|
// duplicated kill in short time
|
||||||
|
public static final int DELAY_KILL_SELF = 2000;
|
||||||
|
public static final int DELAY_WAITING_BOOT_COMPLETE_DONE = 5000;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If true, the service will always start.
|
||||||
|
*/
|
||||||
|
private static final boolean ALWAYS_START_SERVICE = false;
|
||||||
|
private static ReceiverHandler sDefaultInstance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param looper Looper
|
||||||
|
*/
|
||||||
|
public ReceiverHandler(Looper looper) {
|
||||||
|
super(looper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ReceiverHandler
|
||||||
|
*/
|
||||||
|
public static ReceiverHandler getDefaultInstance() {
|
||||||
|
if (sDefaultInstance == null) {
|
||||||
|
synchronized (ReceiverHandler.class) {
|
||||||
|
if (sDefaultInstance == null) {
|
||||||
|
HandlerThread handlerThread = new HandlerThread("ReceiverHandlerThread");
|
||||||
|
handlerThread.start();
|
||||||
|
sDefaultInstance = new ReceiverHandler(handlerThread.getLooper());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sDefaultInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// private SharedPreferences mDefaultSharedPreferences =
|
||||||
|
// MyApplication.getInstance().getDefaultSharedPreferences();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
int what = msg.what;
|
||||||
|
// if (what == MSG_KILL_SELF) {
|
||||||
|
// Utils.logi(TAG, "Get a self-kill command. Need to kill me now");
|
||||||
|
// if (!DebugLoggerUIServiceManager.getInstance().isServiceUsed()) {
|
||||||
|
// Process.killProcess(Process.myPid());
|
||||||
|
// } else {
|
||||||
|
// Utils.logi(TAG, "But Log service was started already, maybe user enter UI."
|
||||||
|
// + "Do not kill self any more.");
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
try {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
if (msg.obj instanceof Intent) {
|
||||||
|
intent = (Intent) msg.obj;
|
||||||
|
}
|
||||||
|
if (what == MSG_RECEIVER_BOOT_COMPLETED) {
|
||||||
|
// dealWithBootcomplete(intent);
|
||||||
|
} else if (what == MSG_RECEIVER_ADB_CMD) {
|
||||||
|
// if (!Utils.isDeviceOwner()) {
|
||||||
|
// Utils.logi(TAG, "It is not device owner, ignore dealWithADBCommand()");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
dealWithADBCommand(intent);
|
||||||
|
} else if (what == MSG_RECEIVER_MDLOGGER_RESTART_DONE) {
|
||||||
|
dealWithMDLoggerRestart(intent);
|
||||||
|
} else if (what == MSG_RECEIVER_EXP_HAPPENED) {
|
||||||
|
dealWithExcptionHappend(intent);
|
||||||
|
} else if (what == MSG_RECEIVER_FROM_BYPASS) {
|
||||||
|
dealWithBypassAction(intent);
|
||||||
|
}
|
||||||
|
} catch (ServiceNullException e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// private void dealWithBootcomplete(Intent intent) throws ServiceNullException {
|
||||||
|
// LogConfig.getInstance().checkConfig();
|
||||||
|
// // Now start log service or just remove log process manually
|
||||||
|
// if (Utils.isTaglogEnable() || needStartLogAtBootTime() || ALWAYS_START_SERVICE) {
|
||||||
|
// if (SecurityWarning.isNeedAlert()) {
|
||||||
|
// SecurityWarning.DialogExcute dialogExcute = new SecurityWarning.DialogExcute() {
|
||||||
|
// @Override
|
||||||
|
// public void okButtonClicked() {
|
||||||
|
// DebugLoggerUIServiceManager.getInstance().initService();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void cancelButtonClicked() {
|
||||||
|
// getDefaultInstance().removeMessages(MSG_KILL_SELF);
|
||||||
|
// getDefaultInstance().sendMessageDelayed(
|
||||||
|
// getDefaultInstance().obtainMessage(MSG_KILL_SELF), DELAY_KILL_SELF);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// };
|
||||||
|
// SecurityWarning.getInstance().getAlertHander()
|
||||||
|
// .obtainMessage(SecurityWarning.MSG_BOOT_COMPLETE, dialogExcute)
|
||||||
|
// .sendToTarget();
|
||||||
|
// } else {
|
||||||
|
// DebugLoggerUIServiceManager.getInstance().initService();
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// getDefaultInstance().removeMessages(MSG_KILL_SELF);
|
||||||
|
// getDefaultInstance().sendMessageDelayed(
|
||||||
|
// getDefaultInstance().obtainMessage(MSG_KILL_SELF), DELAY_KILL_SELF);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
private void dealWithADBCommand(Intent intent) throws ServiceNullException {
|
||||||
|
// DebugLoggerUIServiceManager.getInstance().getService().daelWithADBCommand(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dealWithMDLoggerRestart(Intent intent) throws ServiceNullException {
|
||||||
|
// DebugLoggerUIServiceManager.getInstance().getService().dealWithMDLoggerRestart(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dealWithExcptionHappend(Intent intent) throws ServiceNullException {
|
||||||
|
// DebugLoggerUIServiceManager.getInstance().getService().doTagLogForManually(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dealWithBypassAction(Intent intent) throws ServiceNullException {
|
||||||
|
// DebugLoggerUIServiceManager.getInstance().getService().dealWithBypassAction(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Judge whether need to start up DebugLoggerUI service at boot time. If none log instance was
|
||||||
|
* set to start automatically when boot up, just remove this process to avoid confuse user
|
||||||
|
*/
|
||||||
|
// private boolean needStartLogAtBootTime() {
|
||||||
|
// boolean needStart = false;
|
||||||
|
// for (Integer logType : Utils.LOG_TYPE_SET) {
|
||||||
|
// if (logType == Utils.LOG_TYPE_MET) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if (Utils.VALUE_START_AUTOMATIC_ON == mDefaultSharedPreferences.getBoolean(
|
||||||
|
// Utils.KEY_START_AUTOMATIC_MAP.get(logType),
|
||||||
|
// Utils.DEFAULT_CONFIG_LOG_AUTO_START_MAP.get(logType))) {
|
||||||
|
// needStart = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Utils.logd(TAG, "-->needStartLogAtBootTime(), needStart=" + needStart);
|
||||||
|
// return needStart;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
public class ServiceNullException extends Exception {
|
||||||
|
private static final long serialVersionUID = -430298482097527072L;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -570,8 +570,12 @@ public class HTTPInterface {
|
|||||||
List<String> newList = Arrays.asList(data.split(","));//新的list
|
List<String> newList = Arrays.asList(data.split(","));//新的list
|
||||||
PackageManager pm = context.getPackageManager();
|
PackageManager pm = context.getPackageManager();
|
||||||
for (String pack : newList) {
|
for (String pack : newList) {
|
||||||
pm.setApplicationEnabledSetting(pack, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
try {
|
||||||
Log.e("setHideDesktopIcon", pack);
|
pm.setApplicationEnabledSetting(pack, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||||
|
Log.e("setHideDesktopIcon", pack);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("setHideDesktopIcon", "Exception:" + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -616,6 +616,7 @@ public class ApkUtils {
|
|||||||
this.add("com.android.music");//音乐
|
this.add("com.android.music");//音乐
|
||||||
this.add("com.mediatek.camera");//相机
|
this.add("com.mediatek.camera");//相机
|
||||||
this.add("com.android.documentsui");//文件
|
this.add("com.android.documentsui");//文件
|
||||||
|
this.add("com.mediatek.filemanager");//文件
|
||||||
this.add("com.android.soundrecorder");//录音机
|
this.add("com.android.soundrecorder");//录音机
|
||||||
this.add("com.android.browser");//浏览器
|
this.add("com.android.browser");//浏览器
|
||||||
this.add("com.android.mms");//信息
|
this.add("com.android.mms");//信息
|
||||||
|
|||||||
Reference in New Issue
Block a user