diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml
index e61e138..a0608b2 100644
--- a/AndroidManifest-common.xml
+++ b/AndroidManifest-common.xml
@@ -55,6 +55,7 @@
+
+
+
+
+
+
+
-
\ No newline at end of file
diff --git a/res/xml/device_profiles.xml b/res/xml/device_profiles.xml
index 29790f4..73b1e28 100644
--- a/res/xml/device_profiles.xml
+++ b/res/xml/device_profiles.xml
@@ -135,8 +135,8 @@
launcher:name="Large Phone"
launcher:minWidthDps="406"
launcher:minHeightDps="694"
- launcher:iconImageSize="90"
- launcher:iconTextSize="16"
+ launcher:iconImageSize="80"
+ launcher:iconTextSize="14.4"
launcher:canBeDefault="true" />
diff --git a/src/com/uiuipad/os/Launcher.java b/src/com/uiuipad/os/Launcher.java
index 6f5b54e..e182a8f 100644
--- a/src/com/uiuipad/os/Launcher.java
+++ b/src/com/uiuipad/os/Launcher.java
@@ -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 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() {
+ @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() {
diff --git a/src/com/uiuipad/os/LauncherModel.java b/src/com/uiuipad/os/LauncherModel.java
index 5ee2adc..b078359 100644
--- a/src/com/uiuipad/os/LauncherModel.java
+++ b/src/com/uiuipad/os/LauncherModel.java
@@ -303,14 +303,13 @@ public class LauncherModel extends BroadcastReceiver
} else if (IS_DOGFOOD_BUILD && LauncherAppState.ACTION_FORCE_ROLOAD.equals(action)) {
Launcher l = (Launcher) getCallback();
l.reload();
- }else if (Intent.ACTION_DATE_CHANGED.equals(action) //日历更新
+ } else if (Intent.ACTION_DATE_CHANGED.equals(action) //日历更新
|| Intent.ACTION_TIMEZONE_CHANGED.equals(action)
|| Intent.ACTION_TIME_CHANGED.equals(action)) {
UserHandle myUser = Process.myUserHandle();
changedData(myUser);
changedTime(myUser);
- } else if (Intent.ACTION_TIME_TICK.equals(action)//时钟更新
- ) {
+ } else if (Intent.ACTION_TIME_TICK.equals(action)) {//时钟更新
UserHandle myUser = Process.myUserHandle();
changedTime(myUser);
}
@@ -336,6 +335,8 @@ public class LauncherModel extends BroadcastReceiver
new PackageUpdatedTask(PackageUpdatedTask.OP_UPDATE, user, deskclock));
}
+
+
public void forceReload() {
forceReload(-1);
}
diff --git a/src/com/uiuipad/os/base/BaseApplication.java b/src/com/uiuipad/os/base/BaseApplication.java
index 50df785..798f102 100644
--- a/src/com/uiuipad/os/base/BaseApplication.java
+++ b/src/com/uiuipad/os/base/BaseApplication.java
@@ -3,7 +3,11 @@ package com.uiuipad.os.base;
import android.app.Application;
import android.util.Log;
+import com.tencent.bugly.crashreport.CrashReport;
+import com.uiuipad.os.manager.AppUsedTimeUtils;
import com.uiuipad.os.manager.ConnectManager;
+import com.uiuipad.os.manager.RunningAppManager;
+import com.uiuipad.os.manager.TimeControlManager;
import com.uiuipad.os.network.NetInterfaceManager;
import com.uiuipad.os.push.PushManager;
import com.uiuipad.os.uiuiutils.JGYUtils;
@@ -11,6 +15,7 @@ import com.uiuipad.os.uiuiutils.TimeUtils;
import com.uiuipad.os.uiuiutils.ToastUtil;
import com.arialyy.aria.core.Aria;
import com.tencent.mmkv.MMKV;
+import com.uiuipad.os.uiuiutils.Utils;
public class BaseApplication extends Application {
private static final String TAG = BaseApplication.class.getSimpleName();
@@ -28,5 +33,13 @@ public class BaseApplication extends Application {
NetInterfaceManager.init(this);
ToastUtil.init(this);
ConnectManager.init(this);
+
+ AppUsedTimeUtils.init(this);
+ RunningAppManager.init(this);
+ TimeControlManager.init(this);
+
+ CrashReport.initCrashReport(getApplicationContext(), "55d55ba689", false);
+ CrashReport.setDeviceId(this, Utils.getSerial(this));
+ xcrash.XCrash.init(this);
}
}
diff --git a/src/com/uiuipad/os/base/BasePresenter.java b/src/com/uiuipad/os/base/BasePresenter.java
new file mode 100644
index 0000000..be05cc1
--- /dev/null
+++ b/src/com/uiuipad/os/base/BasePresenter.java
@@ -0,0 +1,7 @@
+package com.uiuipad.os.base;
+
+public interface BasePresenter {
+ void attachView(V view);
+
+ void detachView();
+}
diff --git a/src/com/uiuipad/os/base/BaseView.java b/src/com/uiuipad/os/base/BaseView.java
new file mode 100644
index 0000000..dbe502e
--- /dev/null
+++ b/src/com/uiuipad/os/base/BaseView.java
@@ -0,0 +1,4 @@
+package com.uiuipad.os.base;
+
+public interface BaseView {
+}
diff --git a/src/com/uiuipad/os/folder/ClippedFolderIconLayoutRule.java b/src/com/uiuipad/os/folder/ClippedFolderIconLayoutRule.java
index 018f661..b52084b 100644
--- a/src/com/uiuipad/os/folder/ClippedFolderIconLayoutRule.java
+++ b/src/com/uiuipad/os/folder/ClippedFolderIconLayoutRule.java
@@ -6,7 +6,7 @@ public class ClippedFolderIconLayoutRule {
static final int MAX_NUM_ITEMS_IN_PREVIEW = Integer.MAX_VALUE;
private static final int MIN_NUM_ITEMS_IN_PREVIEW = 2;
- private static final float MIN_SCALE = 0.22f;
+ private static final float MIN_SCALE = 0.20f;
private static final float MAX_SCALE = 0.58f;
private static final float MAX_RADIUS_DILATION = 0.15f;
private static final float ITEM_RADIUS_SCALE_FACTOR = 1.33f;
diff --git a/src/com/uiuipad/os/gson/GsonUtils.java b/src/com/uiuipad/os/gson/GsonUtils.java
new file mode 100644
index 0000000..a2270f4
--- /dev/null
+++ b/src/com/uiuipad/os/gson/GsonUtils.java
@@ -0,0 +1,144 @@
+package com.uiuipad.os.gson;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.google.gson.reflect.TypeToken;
+
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+
+public class GsonUtils {
+ //https://blog.csdn.net/zte1055889498/article/details/122400299
+
+ public static JsonObject getJsonObject(String jsonString) {
+ JsonObject jsonObject = JsonParser.parseString(jsonString).getAsJsonObject();
+ return jsonObject;
+ }
+
+ private static final Gson gson;
+
+ static {
+ GsonBuilder builder = new GsonBuilder();
+ builder.registerTypeAdapterFactory(new NullStringToEmptyAdapterFactory());
+ builder.registerTypeAdapter(Integer.class, new IntegerDefault0Adapter());
+ builder.registerTypeAdapter(int.class, new IntegerDefault0Adapter());
+ builder.disableHtmlEscaping();
+ builder.enableComplexMapKeySerialization();
+ // builder.excludeFieldsWithoutExposeAnnotation();
+ builder.setDateFormat("yyyy-MM-dd HH:mm:ss");
+ gson = builder.create();
+ }
+
+ public static Type makeJavaType(Type rawType, Type... typeArguments) {
+ return TypeToken.getParameterized(rawType, typeArguments).getType();
+ }
+
+ public static String toString(Object value) {
+ if (Objects.isNull(value)) {
+ return null;
+ }
+ if (value instanceof String) {
+ return (String) value;
+ }
+ return toJSONString(value);
+ }
+
+ public static String toJSONString(Object value) {
+ return gson.toJson(value);
+ }
+
+ public static String toPrettyString(Object value) {
+ return gson.newBuilder().setPrettyPrinting().create().toJson(value);
+ }
+
+ public static JsonElement fromJavaObject(Object value) {
+ JsonElement result = null;
+ if (Objects.nonNull(value) && (value instanceof String)) {
+ result = parseObject((String) value);
+ } else {
+ result = gson.toJsonTree(value);
+ }
+ return result;
+ }
+
+ public static JsonElement parseObject(String content) {
+ return JsonParser.parseString(content);
+ }
+
+ public static JsonElement getJsonElement(JsonObject node, String name) {
+ return node.get(name);
+ }
+
+ public static JsonElement getJsonElement(JsonArray node, int index) {
+ return node.get(index);
+ }
+
+ public static T toJavaObject(JsonElement node, Class clazz) {
+ return gson.fromJson(node, clazz);
+ }
+
+ public static T toJavaObject(JsonElement node, Type type) {
+ return gson.fromJson(node, type);
+ }
+
+ public static T toJavaObject(JsonElement node, TypeToken> typeToken) {
+ return toJavaObject(node, typeToken.getType());
+ }
+
+ public static List toJavaList(JsonElement node, Class clazz) {
+ return toJavaObject(node, makeJavaType(List.class, clazz));
+ }
+
+ public static List