version:4.2
fix:修复不能自动下载强制应用,锁定状态显示问题,增加打开主页判断是否在请求 update:
This commit is contained in:
@@ -491,11 +491,6 @@ public class GuardService extends Service {
|
||||
Log.e(TAG, "taskComplete: " + filepath);
|
||||
} else if (filepath.endsWith(".apk")) {
|
||||
new Thread(() -> ApkUtils.installApp(GuardService.this, filepath)).start();
|
||||
List<DownloadEntity> list = Aria.download(this).getDRunningTask();
|
||||
if (list == null || list.size() == 0) {
|
||||
BaseApplication.getInstance().setDownloadState(false);
|
||||
Log.e("taskComplete", "isDownloading=" + BaseApplication.getInstance().isDownloading());
|
||||
}
|
||||
}
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSendTimesApi()
|
||||
@@ -525,32 +520,32 @@ public class GuardService extends Service {
|
||||
});
|
||||
int userId = (int) SPUtils.get(GuardService.this, CommonConfig.ADMIN_ID, 0);
|
||||
long appSize = task.getFileSize();
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSendInfoApi()
|
||||
.sendDownloadTimes(NetInterfaceManager.HTTP_KEY, Utils.getSerial(), userId, app_package, appSize)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("SEND_DOWNLOAD_FILE_INFO", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("SEND_DOWNLOAD_FILE_INFO", "onNext: " + baseResponse.msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("SEND_DOWNLOAD_FILE_INFO", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("SEND_DOWNLOAD_FILE_INFO", "onComplete: ");
|
||||
}
|
||||
});
|
||||
// NetInterfaceManager.getInstance()
|
||||
// .getSendInfoApi()
|
||||
// .sendDownloadTimes(NetInterfaceManager.HTTP_KEY, Utils.getSerial(), userId, app_package, appSize)
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(new Observer<BaseResponse>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// Log.e("SEND_DOWNLOAD_FILE_INFO", "onSubscribe: ");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(BaseResponse baseResponse) {
|
||||
// Log.e("SEND_DOWNLOAD_FILE_INFO", "onNext: " + baseResponse.msg);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Throwable e) {
|
||||
// Log.e("SEND_DOWNLOAD_FILE_INFO", "onError: " + e.getMessage());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// Log.e("SEND_DOWNLOAD_FILE_INFO", "onComplete: ");
|
||||
// }
|
||||
// });
|
||||
} else if (filepath.endsWith(".zip")) {
|
||||
Log.e("taskComplete", "下载完成:" + task.getPercent() + ":" + task.getExtendField());
|
||||
JGYUtils.getInstance().setBootanimation(task.getFilePath());
|
||||
|
||||
@@ -62,12 +62,26 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
private boolean requesting = false;
|
||||
|
||||
public boolean isRequesting() {
|
||||
return requesting;
|
||||
}
|
||||
|
||||
public void setRequesting(boolean requesting) {
|
||||
this.requesting = requesting;
|
||||
}
|
||||
|
||||
public long responseTime;
|
||||
|
||||
/**
|
||||
* 1
|
||||
*/
|
||||
@Override
|
||||
public void getLockedState(String key) {
|
||||
Log.e(TAG, "getLockedState: " + key);
|
||||
requesting = true;
|
||||
responseTime = System.currentTimeMillis();
|
||||
NetInterfaceManager.getInstance()
|
||||
.getLockedState(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
@@ -154,7 +168,6 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
public void updateDeviceInfo() {
|
||||
if (JGYUtils.isOfficialVersion()) {
|
||||
mView.updateDeviceInfoFinish();
|
||||
return;
|
||||
}
|
||||
NetInterfaceManager.getInstance().updateDeviceInfo(new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
@@ -229,32 +242,32 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getDefaultDesktop() {
|
||||
if (JGYUtils.isOfficialVersion()) {
|
||||
if (JGYUtils.isOfficialVersion() || JGYUtils.getInstance().getDeviceIsLocked()) {
|
||||
mView.getDefaultDesktopFinish();
|
||||
return;
|
||||
} else {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getDefaultDesktop(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.getDefaultDesktopFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
NetInterfaceManager.getInstance()
|
||||
.getDefaultDesktop(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.getDefaultDesktopFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogoImg() {
|
||||
if (JGYUtils.isOfficialVersion()) {
|
||||
mView.setLogoImgFinish();
|
||||
return;
|
||||
} else {
|
||||
NetInterfaceManager.getInstance()
|
||||
.setLogoImg(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.setLogoImgFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
NetInterfaceManager.getInstance()
|
||||
.setLogoImg(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.setLogoImgFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -308,11 +321,11 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
public void getBrowserBookmarks() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getBookMarkBlackWhiteList(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.getBrowserBookmarksFinish();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.getBrowserBookmarksFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,10 +17,12 @@ import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.Debug;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
@@ -54,7 +56,6 @@ import com.aoleyun.sn.utils.CacheUtils;
|
||||
import com.aoleyun.sn.utils.ForegroundAppUtil;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.utils.SPUtils;
|
||||
import com.aoleyun.sn.utils.SaveListUtils;
|
||||
import com.aoleyun.sn.utils.SysSettingUtils;
|
||||
import com.aoleyun.sn.utils.TimeUtils;
|
||||
import com.aoleyun.sn.utils.ToastUtil;
|
||||
@@ -317,7 +318,24 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
return mMainBinder;
|
||||
}
|
||||
|
||||
public MainBinder mMainBinder = new MainBinder();
|
||||
|
||||
public class MainBinder extends Binder {
|
||||
public MainService getService() {
|
||||
return MainService.this;
|
||||
}
|
||||
}
|
||||
|
||||
public void getLockedState() {
|
||||
Log.e(TAG, "getLockedState: MainBinder");
|
||||
if (!mPresenter.isRequesting()) {
|
||||
mPresenter.getLockedState("MainBinder");
|
||||
} else {
|
||||
Log.e(TAG, "getLockedState: MainSPresenter is requesting now");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -333,8 +351,10 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
task.execute("ntp.aliyun.com");
|
||||
|
||||
//根据要求卸载这两个应用
|
||||
ApkUtils.UninstallAPP(this, "com.joytv.live");
|
||||
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
||||
if (!JGYUtils.getInstance().getDeviceIsLocked()) {
|
||||
ApkUtils.UninstallAPP(this, "com.joytv.live");
|
||||
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
||||
}
|
||||
|
||||
try {
|
||||
getPackageManager().setApplicationEnabledSetting("com.android.email", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
@@ -375,8 +395,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
timeChangedStart.onstar(System.currentTimeMillis());
|
||||
setStatusbar();
|
||||
setFloatingWindow(this);
|
||||
notificationManager = NotificationManagerCompat.from(this);
|
||||
createNotificationChannel();
|
||||
sendSimpleNotification();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -430,6 +450,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
}
|
||||
}
|
||||
|
||||
private NotificationManagerCompat notificationManager;
|
||||
private int NotificationID = 1;
|
||||
|
||||
private void sendSimpleNotification() {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "CHANNEL_ID")
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
@@ -439,10 +462,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
.setShowWhen(false)
|
||||
.setOngoing(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_MAX);
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
|
||||
// notificationId is a unique int for each notification that you must define
|
||||
notificationManager.notify(1, builder.build());
|
||||
|
||||
notificationManager.notify(NotificationID, builder.build());
|
||||
}
|
||||
|
||||
private void addShortcut() {
|
||||
@@ -814,13 +835,17 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void setLockedState(boolean loocked) {
|
||||
Log.e(TAG, "setLockedState: " + loocked);
|
||||
if (loocked) {
|
||||
ToastUtil.betaShow("设备已上锁");
|
||||
sendSimpleNotification();
|
||||
mPresenter.setPushTags();
|
||||
mPresenter.getDeveloper();
|
||||
SaveListUtils.getList();
|
||||
ApkUtils.UninstallAPP(this, "com.joytv.live");
|
||||
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
||||
} else {
|
||||
ToastUtil.betaShow("设备已解锁");
|
||||
notificationManager.cancel(NotificationID);
|
||||
SysSettingUtils.setEnableSetting(this);
|
||||
mPresenter.checkAoleyunUpdate();
|
||||
}
|
||||
@@ -911,7 +936,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void setLogoImgFinish() {
|
||||
mPresenter.setRequesting(false);
|
||||
Log.e(TAG, "setLogoImgFinish: ");
|
||||
Log.e(TAG, "SettingFinish: " + (System.currentTimeMillis() - mPresenter.responseTime) + " ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -996,7 +1023,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void setWiFiPasswd() {
|
||||
mPresenter.setRequesting(false);
|
||||
Log.e(TAG, "setWiFiPasswd: ");
|
||||
Log.e(TAG, "SettingFinish: " + (System.currentTimeMillis() - mPresenter.responseTime) + " ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user