version:1.0.8

fix:
update:优化管控
This commit is contained in:
tt committed 2023-10-31 10:27:03 +08:00
1 parent 4daf5ab92f
commit 62fa007695
42 files changed
+2733 -171

No files matched your search

+83 -17
View File
@@ -34,8 +34,8 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
@@ -45,8 +45,8 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.IBinder;
import android.os.Parcelable;
import android.os.Process;
import android.os.StrictMode;
@@ -69,13 +69,14 @@ import android.view.animation.OvershootInterpolator;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.alibaba.sdk.android.push.CloudPushService;
import com.alibaba.sdk.android.push.CommonCallback;
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
import com.uiuipad.os.DropTarget.DragObject;
import com.uiuipad.os.uiuiutils.APKUtils;
import com.uiuipad.os.network.bean.TimeManageApp;
import com.uiuipad.os.network.bean.TimeManageSn;
import com.uiuipad.os.uiuiutils.ApkUtils;
import com.uiuipad.os.uiuiutils.Utils;
import com.uiuipad.os.accessibility.LauncherAccessibilityDelegate;
import com.uiuipad.os.allapps.AllAppsContainerView;
@@ -106,7 +107,6 @@ import com.uiuipad.os.model.ModelWriter;
import com.uiuipad.os.network.bean.AppPasswdBean;
import com.uiuipad.os.network.bean.BaseResponse;
import com.uiuipad.os.network.NetInterfaceManager;
import com.uiuipad.os.network.bean.NewestAppUpdateResult;
import com.uiuipad.os.notification.NotificationListener;
import com.uiuipad.os.pageindicators.PageIndicatorDots;
import com.uiuipad.os.popup.PopupContainerWithArrow;
@@ -152,12 +152,10 @@ import com.uiuipad.os.widget.WidgetHostViewLoader;
import com.uiuipad.os.widget.WidgetListRowEntry;
import com.uiuipad.os.widget.WidgetsFullSheet;
import com.uiuipad.os.widget.custom.CustomWidgetParser;
import com.arialyy.aria.core.Aria;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.tencent.mmkv.MMKV;
import java.io.File;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
@@ -167,18 +165,18 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Predicate;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.ObservableEmitter;
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
import okhttp3.RequestBody;
import static android.content.pm.ActivityInfo.CONFIG_LOCALE;
import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
@@ -344,7 +342,11 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
Observable.create(updateSubscribe)
.throttleFirst(6, TimeUnit.HOURS)
.subscribe(updateObserver);
startService(new Intent(Launcher.this, MainService.class));
Intent intent = new Intent(Launcher.this, MainService.class);
bindService(intent, serviceConnect, BIND_AUTO_CREATE);
startService(intent);
if (DEBUG_STRICT_MODE) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
@@ -426,7 +428,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
if (!isDefaultHome()) {
// setDefaultL();
// setRoleHolderAsUser(this, BuildConfig.APPLICATION_ID);
setRoleHolderAsUser(this, BuildConfig.APPLICATION_ID);
}
SharedPreferences sharedPref = getPreferences(MODE_PRIVATE);
int i = sharedPref.getInt("SetWallPaper", 0);
@@ -521,6 +523,23 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
});
}
MainService.MainBinder mMainBinder;
private ServiceConnect serviceConnect = new ServiceConnect();
private class ServiceConnect implements ServiceConnection {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.e(TAG, "onServiceConnected: ");
mMainBinder = (MainService.MainBinder) service;
}
@Override
public void onServiceDisconnected(ComponentName name) {
Log.e(TAG, "onServiceDisconnected: ");
mMainBinder = null;
}
}
private void SetWallPaper() {
//利用WallpaparManager,添加权限set_wallpaper
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
@@ -1150,8 +1169,47 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
Log.e("onStart", "app = null" + packageName);
return;
}
sendAppUsageRecord(packageName);
}
private void sendAppUsageRecord(String packageName) {
Log.e("sendAppUsageRecord", "packageName: " + packageName);
String app_name = ApkUtils.getAppNameByPackage(Launcher.this, packageName);
long openTime = TimeUtils.getInstance().getStartTime() / 1000;
long closeTime = TimeUtils.getInstance().getEndTime() / 1000;
Map<String, RequestBody> params = new HashMap<>();
params.put("sn", NetInterfaceManager.convertToRequestBody(Utils.getSerial(this)));
params.put("app_name", NetInterfaceManager.convertToRequestBody(app_name));
params.put("app_package", NetInterfaceManager.convertToRequestBody(packageName));
params.put("open_time", NetInterfaceManager.convertToRequestBody(openTime));
params.put("close_time", NetInterfaceManager.convertToRequestBody(closeTime));
NetInterfaceManager.getInstance()
.getUploadAppUseLogObservable(params)
.subscribe(new Observer<BaseResponse>() {
@Override
public void onSubscribe(Disposable d) {
Log.e("sendAppUsageRecord", "onSubscribe: ");
}
@Override
public void onNext(BaseResponse baseResponse) {
Log.e("sendAppUsageRecord", "onNext: " + baseResponse);
}
@Override
public void onError(Throwable e) {
Log.e("sendAppUsageRecord", "onError: " + e.getMessage());
}
@Override
public void onComplete() {
Log.e("sendAppUsageRecord", "onComplete: ");
}
});
}
private void handleDeferredResume() {
if (hasBeenResumed() && !mStateManager.getState().disableInteraction) {
getUserEventDispatcher().logActionCommand(Action.Command.RESUME,
@@ -1223,7 +1281,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
/*打开霸屏应用*/
String always_top_packagename = Settings.System.getString(getContentResolver(), "always_top_packagename");
if (!TextUtils.isEmpty(always_top_packagename)) {
APKUtils.openPackage(Launcher.this, always_top_packagename);
ApkUtils.openPackage(Launcher.this, always_top_packagename);
}
mUpdate.checkUpdate(System.currentTimeMillis());
mPasswd.getPassword(System.currentTimeMillis());
@@ -1231,6 +1289,14 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
JGYUtils.getInstance().wakeUpAppstore();
JGYUtils.getInstance().wakeUpDeviceInfo();
checkIsRest();
if (mMainBinder != null) {
mMainBinder.getService().mPresenter.getTimeManageSn();
}else {
Log.e(TAG, "onResume: mMainBinder is null" );
Intent intent = new Intent(Launcher.this, MainService.class);
bindService(intent, serviceConnect, BIND_AUTO_CREATE);
}
}
private void checkIsRest() {