version:1.8
fix:应用使用记录 add:
This commit is contained in:
@@ -51,6 +51,7 @@ import android.os.Process;
|
||||
import android.os.StrictMode;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateUtils;
|
||||
import android.text.method.TextKeyListener;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
@@ -70,6 +71,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.aoleyun.os.DropTarget.DragObject;
|
||||
import com.aoleyun.os.Statistics.AppInformation;
|
||||
import com.aoleyun.os.TTUtils.APKUtils;
|
||||
import com.aoleyun.os.TTUtils.Utils;
|
||||
import com.aoleyun.os.accessibility.LauncherAccessibilityDelegate;
|
||||
@@ -104,7 +106,7 @@ import com.aoleyun.os.model.ModelWriter;
|
||||
import com.aoleyun.os.network.AppPasswdBean;
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.HTTPInterface;
|
||||
import com.aoleyun.os.network.NetWorkManager;
|
||||
import com.aoleyun.os.network.NetworkManager;
|
||||
import com.aoleyun.os.network.NewestAppUpdateResult;
|
||||
import com.aoleyun.os.network.api.AddAppLog;
|
||||
import com.aoleyun.os.notification.NotificationListener;
|
||||
@@ -119,6 +121,7 @@ import com.aoleyun.os.testing.TestProtocol;
|
||||
import com.aoleyun.os.touch.ItemClickHandler;
|
||||
import com.aoleyun.os.uioverrides.UiFactory;
|
||||
import com.aoleyun.os.uiuiutils.JGYUtils;
|
||||
import com.aoleyun.os.uiuiutils.TimeUtils;
|
||||
import com.aoleyun.os.userevent.nano.LauncherLogProto;
|
||||
import com.aoleyun.os.userevent.nano.LauncherLogProto.Action;
|
||||
import com.aoleyun.os.userevent.nano.LauncherLogProto.ContainerType;
|
||||
@@ -194,6 +197,7 @@ import static com.aoleyun.os.logging.LoggerUtils.newTarget;
|
||||
import static com.aoleyun.os.states.RotationHelper.REQUEST_NONE;
|
||||
import static com.aoleyun.os.util.RaceConditionTracker.ENTER;
|
||||
import static com.aoleyun.os.util.RaceConditionTracker.EXIT;
|
||||
import static com.aoleyun.os.touch.ItemClickHandler.getInfoFromPackageName;
|
||||
|
||||
/**
|
||||
* Default launcher application.
|
||||
@@ -588,17 +592,18 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (Intent.ACTION_DATE_CHANGED.equals(intent.getAction())) {
|
||||
Log.e("fht", "TimeChangedReceiver:" + "data changed");
|
||||
// Log.e("fht", "TimeChangedReceiver:" + "data changed");
|
||||
} else if (Intent.ACTION_TIME_CHANGED.equals(intent.getAction())) {
|
||||
Log.e("fht", "TimeChangedReceiver:" + "time changed");
|
||||
// Log.e("fht", "TimeChangedReceiver:" + "time changed");
|
||||
} else if (Intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) {
|
||||
Log.e("fht", "TimeChangedReceiver:" + "timezone changed");
|
||||
// Log.e("fht", "TimeChangedReceiver:" + "timezone changed");
|
||||
} else if (Intent.ACTION_TIME_TICK.equals(intent.getAction())) {
|
||||
Log.e("fht", "TimeChangedReceiver:" + "time tick");
|
||||
// Log.e("fht", "TimeChangedReceiver:" + "time tick");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnterAnimationComplete() {
|
||||
super.onEnterAnimationComplete();
|
||||
@@ -1085,38 +1090,69 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
Log.e(TAG, "onStart: " + TimeUtils.getInstance().isNormalTime());
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.NO_OVERVIEW_EVENT_TAG, "Launcher.onStart");
|
||||
}
|
||||
RaceConditionTracker.onEvent(ON_START_EVT, ENTER);
|
||||
super.onStart();
|
||||
removeRecentTask();
|
||||
String packagename = MyApplication.getInstance().getAppPackageName();
|
||||
String packagename = TimeUtils.getInstance().getAppPackageName();
|
||||
Log.e("SendcloseApp", "packagename=" + packagename);
|
||||
TimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
||||
if (packagename != null && packagename.length() > 0) {
|
||||
SendcloseApp(packagename);
|
||||
// if (!APKUtils.isSystemApp(this, packagename) && !Arrays.asList(ItemClickHandler.packages).contains(packagename)) {
|
||||
// try {
|
||||
// AppInformation app = getInfoFromPackageName(packagename);
|
||||
// if (app != null) {
|
||||
// long time = app.getUsedTimebyDay() / 1000;
|
||||
// Log.e("fht", "返回运行时间: " + DateUtils.formatElapsedTime(time));
|
||||
// Log.e("fht", "返回运行时间: " + time);
|
||||
//
|
||||
//// if (userInfo != null) {
|
||||
//// HTTPInterface.sendTimeLog(handler, userInfo, app.getLabel(), 2, time - MyApplication.getInstance().getRunTime());
|
||||
//// } else {
|
||||
//// Log.e("fht", "userInfo = null");
|
||||
//// }
|
||||
// } else {
|
||||
// Log.e("fht", "app = null" + packagename);
|
||||
// }
|
||||
AppInformation app = getInfoFromPackageName(packagename);
|
||||
if (app != null) {
|
||||
long time = app.getUsedTimebyDay() / 1000;
|
||||
Log.e("fht", "返回运行时间: " + DateUtils.formatElapsedTime(time));
|
||||
Log.e("fht", "返回运行时间: " + time);
|
||||
NetworkManager.getInstance().getAppUsageRecordControl()
|
||||
.sendAppUsageRecord(Utils.getSerial(),
|
||||
app.getLabel(), app.getPackageName(),
|
||||
TimeUtils.getInstance().getStartTime()/1000,
|
||||
TimeUtils.getInstance().getEndTime()/1000)
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("onStart", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("onStart", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("onStart", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("onStart", "onComplete: ");
|
||||
}
|
||||
});
|
||||
// if (userInfo != null) {
|
||||
// HTTPInterface.sendTimeLog(handler, userInfo, app.getLabel(), 2, time - MyApplication.getInstance().getRunTime());
|
||||
// } else {
|
||||
// Log.e("fht", "userInfo = null");
|
||||
// }
|
||||
//设为空值
|
||||
TimeUtils.getInstance().setAppPackageName("");
|
||||
} else {
|
||||
Log.e("fht", "app = null" + packagename);
|
||||
}
|
||||
// } catch (Exception e) {
|
||||
// Log.e("fht", e.getMessage());
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// Log.e("packagename", "packagename is null");
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (mLauncherCallbacks != null) {
|
||||
@@ -1126,7 +1162,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
RaceConditionTracker.onEvent(ON_START_EVT, EXIT);
|
||||
}
|
||||
|
||||
private static void SendcloseApp(String packageName) {
|
||||
private void SendcloseApp(String packageName) {
|
||||
PackageManager pm = MyApplication.getInstance().getPackageManager();
|
||||
PackageInfo appInfo = null;
|
||||
try {
|
||||
@@ -1141,7 +1177,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
} else {
|
||||
appVersionCode = appInfo.versionCode;
|
||||
}
|
||||
AddAppLog appLog = NetWorkManager.getInstance().getapplogControl();
|
||||
AddAppLog appLog = NetworkManager.getInstance().getapplogControl();
|
||||
String sn = Utils.getSerial();
|
||||
appLog.addLog(sn, packageName, appVersionCode, System.currentTimeMillis() / 1000, 2)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -1246,8 +1282,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
TraceHelper.endSection("ON_RESUME");
|
||||
RaceConditionTracker.onEvent(ON_RESUME_EVT, EXIT);
|
||||
isForeground = true;
|
||||
MyApplication.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||
MyApplication.getInstance().setOnClickTime(System.currentTimeMillis());
|
||||
// TimeUtils.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||
// TimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
||||
HTTPInterface.getAppPasswd();
|
||||
start.onstar(System.currentTimeMillis());
|
||||
String always_top_packagename = Settings.System.getString(getContentResolver(), "always_top_packagename");
|
||||
@@ -1316,7 +1352,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
};
|
||||
|
||||
private void checkUpdate() {
|
||||
NetWorkManager.getInstance().getCheckUpdateObservable()
|
||||
NetworkManager.getInstance().getCheckUpdateObservable()
|
||||
.getCheckUpdate(BuildConfig.APPLICATION_ID,
|
||||
BuildConfig.VERSION_CODE,
|
||||
JGYUtils.getInstance().checkAppPlatform())
|
||||
|
||||
Reference in New Issue
Block a user