version:2.2
fix:修复应用从第一屏开始排列 add:
@@ -69,7 +69,7 @@
|
||||
<uses-permission android:name="${packageName}.permission.WRITE_SETTINGS" />
|
||||
|
||||
<application
|
||||
android:name="com.aoleyun.os.base.MyApplication"
|
||||
android:name="com.aoleyun.os.base.BaseApplication"
|
||||
android:backupAgent="com.aoleyun.os.LauncherBackupAgent"
|
||||
android:fullBackupContent="@xml/backupscheme"
|
||||
android:fullBackupOnly="true"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
android:targetSdkVersion="29" />
|
||||
|
||||
<application
|
||||
android:name="com.aoleyun.os.base.MyApplication"
|
||||
android:name="com.aoleyun.os.base.BaseApplication"
|
||||
android:backupAgent="com.aoleyun.os.LauncherBackupAgent"
|
||||
android:extractNativeLibs="false"
|
||||
android:fullBackupContent="@xml/backupscheme"
|
||||
|
||||
26
build.gradle
@@ -57,8 +57,8 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 28
|
||||
versionCode 10
|
||||
versionName "1.9"
|
||||
versionCode 13
|
||||
versionName "2.2"
|
||||
ndk {
|
||||
//选择要添加的对应 cpu 类型的 .so 库。
|
||||
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
@@ -175,11 +175,12 @@ android {
|
||||
testApplicationId 'com.aoleyun.os.tests'
|
||||
}
|
||||
|
||||
l3go {
|
||||
dimension "app"
|
||||
applicationId 'com.aoleyun.os'
|
||||
testApplicationId 'com.aoleyun.os.tests'
|
||||
}
|
||||
/*hide l3go*/
|
||||
// l3go {
|
||||
// dimension "app"
|
||||
// applicationId 'com.aoleyun.os'
|
||||
// testApplicationId 'com.aoleyun.os.tests'
|
||||
// }
|
||||
|
||||
/*withQuickstep {
|
||||
dimension "recents"
|
||||
@@ -240,11 +241,12 @@ android {
|
||||
manifest.srcFile "AndroidManifest.xml"
|
||||
}
|
||||
|
||||
l3go {
|
||||
res.srcDirs = ['go/res']
|
||||
java.srcDirs = ['go/src']
|
||||
manifest.srcFile "go/AndroidManifest.xml"
|
||||
}
|
||||
/*hide l3go*/
|
||||
// l3go {
|
||||
// res.srcDirs = ['go/res']
|
||||
// java.srcDirs = ['go/src']
|
||||
// manifest.srcFile "go/AndroidManifest.xml"
|
||||
// }
|
||||
|
||||
withoutQuickstep {
|
||||
java.srcDirs = ['src_ui_overrides']
|
||||
|
||||
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 484 KiB |
@@ -23,6 +23,7 @@ import android.animation.FloatArrayEvaluator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.ColorMatrix;
|
||||
@@ -31,6 +32,7 @@ import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Property;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -45,6 +47,7 @@ import com.aoleyun.os.dragndrop.DragController;
|
||||
import com.aoleyun.os.dragndrop.DragLayer;
|
||||
import com.aoleyun.os.dragndrop.DragOptions;
|
||||
import com.aoleyun.os.dragndrop.DragView;
|
||||
import com.aoleyun.os.uiuiutils.JGYUtils;
|
||||
import com.aoleyun.os.userevent.nano.LauncherLogProto.Target;
|
||||
import com.aoleyun.os.util.Themes;
|
||||
import com.aoleyun.os.util.Thunk;
|
||||
@@ -241,12 +244,22 @@ public abstract class ButtonDropTarget extends TextView
|
||||
@Override
|
||||
public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
|
||||
mActive = supportsDrop(dragObject.dragInfo);
|
||||
/*add 2022-01-06 15:28:19 通过info获取包名判断是否为强制应用*/
|
||||
Intent intent = dragObject.dragInfo.getIntent();
|
||||
if (intent != null) {
|
||||
String pkg = intent.getComponent().getPackageName();
|
||||
Log.e("beginDrag", "beginDrag: " + pkg);
|
||||
if (JGYUtils.getInstance().isEnforceApp(pkg)) {
|
||||
mActive = false;
|
||||
}
|
||||
}
|
||||
mDrawable.setColorFilter(null);
|
||||
if (mCurrentColorAnim != null) {
|
||||
mCurrentColorAnim.cancel();
|
||||
mCurrentColorAnim = null;
|
||||
}
|
||||
setTextColor(mOriginalTextColor);
|
||||
Log.e("ButtonDropTarget", "onDragStart: " + mActive);
|
||||
setVisibility(mActive ? View.VISIBLE : View.GONE);
|
||||
|
||||
mAccessibleDrag = options.isAccessibleDrag;
|
||||
|
||||
@@ -22,6 +22,7 @@ import static com.aoleyun.os.userevent.nano.LauncherLogProto.ControlType.UNDO;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.aoleyun.os.R;
|
||||
@@ -29,6 +30,7 @@ import com.aoleyun.os.accessibility.LauncherAccessibilityDelegate;
|
||||
import com.aoleyun.os.dragndrop.DragOptions;
|
||||
import com.aoleyun.os.logging.LoggerUtils;
|
||||
import com.aoleyun.os.model.ModelWriter;
|
||||
import com.aoleyun.os.uiuiutils.JGYUtils;
|
||||
import com.aoleyun.os.userevent.nano.LauncherLogProto.ControlType;
|
||||
import com.aoleyun.os.userevent.nano.LauncherLogProto.Target;
|
||||
|
||||
@@ -102,7 +104,6 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
setContentDescription(mText);
|
||||
requestLayout();
|
||||
setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +121,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
if (LauncherAppState.isDisableAllApps()) {
|
||||
mControlType = isCanDrop(item) ? ControlType.REMOVE_TARGET
|
||||
: ControlType.CANCEL_TARGET;
|
||||
// Log.e("setControlTypeBasedOnDragSource", "mControlType: " + mControlType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -213,6 +213,7 @@ public class DropTargetBar extends FrameLayout
|
||||
|
||||
float finalAlpha = mVisible ? 1 : 0;
|
||||
if (Float.compare(getAlpha(), finalAlpha) != 0) {
|
||||
/*控制顶部卸载按钮显示的*/
|
||||
setVisibility(View.VISIBLE);
|
||||
mCurrentAnimation = animate().alpha(finalAlpha)
|
||||
.setInterpolator(DEFAULT_INTERPOLATOR)
|
||||
|
||||
@@ -51,7 +51,6 @@ 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;
|
||||
@@ -71,16 +70,14 @@ 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.uiuiutils.APKUtils;
|
||||
import com.aoleyun.os.uiuiutils.Utils;
|
||||
import com.aoleyun.os.accessibility.LauncherAccessibilityDelegate;
|
||||
import com.aoleyun.os.allapps.AllAppsContainerView;
|
||||
import com.aoleyun.os.allapps.AllAppsStore;
|
||||
import com.aoleyun.os.allapps.AllAppsTransitionController;
|
||||
import com.aoleyun.os.allapps.DiscoveryBounce;
|
||||
import com.aoleyun.os.anim.PropertyListBuilder;
|
||||
import com.aoleyun.os.base.MyApplication;
|
||||
import com.aoleyun.os.compat.AppWidgetManagerCompat;
|
||||
import com.aoleyun.os.compat.LauncherAppsCompatVO;
|
||||
import com.aoleyun.os.config.FeatureFlags;
|
||||
@@ -103,12 +100,11 @@ import com.aoleyun.os.logging.UserEventDispatcher;
|
||||
import com.aoleyun.os.logging.UserEventDispatcher.UserEventDelegate;
|
||||
import com.aoleyun.os.model.AppLaunchTracker;
|
||||
import com.aoleyun.os.model.ModelWriter;
|
||||
import com.aoleyun.os.network.AppPasswdBean;
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.bean.AppPasswdBean;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.HTTPInterface;
|
||||
import com.aoleyun.os.network.NetworkManager;
|
||||
import com.aoleyun.os.network.NewestAppUpdateResult;
|
||||
import com.aoleyun.os.network.api.AddAppLog;
|
||||
import com.aoleyun.os.network.bean.NewestAppUpdateResult;
|
||||
import com.aoleyun.os.notification.NotificationListener;
|
||||
import com.aoleyun.os.pageindicators.PageIndicatorDots;
|
||||
import com.aoleyun.os.popup.PopupContainerWithArrow;
|
||||
@@ -197,7 +193,6 @@ 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.
|
||||
@@ -341,8 +336,11 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
RaceConditionTracker.onEvent(ON_CREATE_EVT, ENTER);
|
||||
Observable.create(subscribe)
|
||||
.throttleFirst(1, TimeUnit.MINUTES)
|
||||
Observable.create(passwdSubscribe)
|
||||
.throttleFirst(1, TimeUnit.HOURS)
|
||||
.subscribe(passwdObserver);
|
||||
Observable.create(updateSubscribe)
|
||||
.throttleFirst(6, TimeUnit.HOURS)
|
||||
.subscribe(updateObserver);
|
||||
startService(new Intent(Launcher.this, MainService.class));
|
||||
if (DEBUG_STRICT_MODE) {
|
||||
@@ -1090,128 +1088,58 @@ 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 = 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);
|
||||
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) {
|
||||
mLauncherCallbacks.onStart();
|
||||
}
|
||||
mAppWidgetHost.setListenIfResumed(true);
|
||||
RaceConditionTracker.onEvent(ON_START_EVT, EXIT);
|
||||
|
||||
/*移除最近任务列表*/
|
||||
TimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
||||
removeRecentTask();
|
||||
String packageName = TimeUtils.getInstance().getAppPackageName();
|
||||
if (TextUtils.isEmpty(packageName)) {
|
||||
Log.e("onStart", "app = null" + packageName);
|
||||
return;
|
||||
}
|
||||
sendAppUsageRecord(packageName);
|
||||
}
|
||||
|
||||
private void SendcloseApp(String packageName) {
|
||||
PackageManager pm = MyApplication.getInstance().getPackageManager();
|
||||
PackageInfo appInfo = null;
|
||||
try {
|
||||
appInfo = pm.getPackageInfo(packageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (null != appInfo) {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = appInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = appInfo.versionCode;
|
||||
}
|
||||
AddAppLog appLog = NetworkManager.getInstance().getapplogControl();
|
||||
String sn = Utils.getSerial();
|
||||
appLog.addLog(sn, packageName, appVersionCode, System.currentTimeMillis() / 1000, 2)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
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;
|
||||
NetworkManager.getInstance().getAppUsageRecordControl()
|
||||
.sendAppUsageRecord(Utils.getSerial(), packageName, app_name, openTime, closeTime)
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
Log.e("sendAppUsageRecord", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
int code = baseResponse.code;
|
||||
if (code == 200) {
|
||||
Log.e("SendcloseApp", "onNext: " + code + baseResponse.data);
|
||||
} else {
|
||||
Log.e("SendcloseApp", "onNext: " + code + baseResponse.msg);
|
||||
}
|
||||
Log.e("sendAppUsageRecord", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("SendcloseApp", "onError: " + e.getMessage());
|
||||
Log.e("sendAppUsageRecord", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
Log.e("sendAppUsageRecord", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void handleDeferredResume() {
|
||||
if (hasBeenResumed() && !mStateManager.getState().disableInteraction) {
|
||||
@@ -1255,12 +1183,9 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
Log.e(TAG, "onResume: ");
|
||||
RaceConditionTracker.onEvent(ON_RESUME_EVT, ENTER);
|
||||
TraceHelper.beginSection("ON_RESUME");
|
||||
super.onResume();
|
||||
removeRecentTask();
|
||||
start.onstar(System.currentTimeMillis());
|
||||
TraceHelper.partitionSection("ON_RESUME", "superCall");
|
||||
|
||||
mHandler.removeCallbacks(mHandleDeferredResume);
|
||||
@@ -1281,19 +1206,20 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
|
||||
TraceHelper.endSection("ON_RESUME");
|
||||
RaceConditionTracker.onEvent(ON_RESUME_EVT, EXIT);
|
||||
|
||||
Log.e(TAG, "onResume: ");
|
||||
isForeground = true;
|
||||
// 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");
|
||||
if (!TextUtils.isEmpty(always_top_packagename)) {
|
||||
APKUtils.openPackage(Launcher.this, always_top_packagename);
|
||||
}
|
||||
|
||||
mUpdate.checkUpdate(System.currentTimeMillis());
|
||||
mPasswd.getPassword(System.currentTimeMillis());
|
||||
TimeUtils.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||
HTTPInterface.sendRunningApp(Launcher.this);
|
||||
}
|
||||
|
||||
|
||||
private void removeRecentTask() {
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
@Override
|
||||
@@ -1313,22 +1239,56 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
private Passwd mPasswd;
|
||||
|
||||
private Start start;
|
||||
|
||||
private interface Start {
|
||||
void onstar(long time);
|
||||
private interface Passwd {
|
||||
void getPassword(long time);
|
||||
}
|
||||
|
||||
private ObservableOnSubscribe<Long> subscribe = new ObservableOnSubscribe<Long>() {
|
||||
private ObservableOnSubscribe<Long> passwdSubscribe = new ObservableOnSubscribe<Long>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter emitter) throws Exception {
|
||||
start = emitter::onNext;
|
||||
mPasswd = emitter::onNext;
|
||||
}
|
||||
};
|
||||
|
||||
private Observer<Long> passwdObserver = new Observer<Long>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("passwdObserver", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Long aLong) {
|
||||
Log.e("passwdObserver", "onNext: " + aLong);
|
||||
HTTPInterface.getAppPasswd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("passwdObserver", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("passwdObserver", "onComplete: ");
|
||||
}
|
||||
};
|
||||
|
||||
private Update mUpdate;
|
||||
|
||||
private interface Update {
|
||||
void checkUpdate(long time);
|
||||
}
|
||||
|
||||
private ObservableOnSubscribe<Long> updateSubscribe = new ObservableOnSubscribe<Long>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter emitter) throws Exception {
|
||||
mUpdate = emitter::onNext;
|
||||
}
|
||||
};
|
||||
|
||||
private Observer<Long> updateObserver = new Observer<Long>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("updateObserver", "onSubscribe: ");
|
||||
@@ -1352,7 +1312,8 @@ 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())
|
||||
@@ -1428,7 +1389,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
mLauncherCallbacks.onPause();
|
||||
}
|
||||
isForeground = false;
|
||||
// removeRecentTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,8 +6,8 @@ import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.os.BuildConfig;
|
||||
import com.aoleyun.os.TTUtils.ToastUtil;
|
||||
import com.aoleyun.os.TTUtils.Utils;
|
||||
import com.aoleyun.os.uiuiutils.ToastUtil;
|
||||
import com.aoleyun.os.uiuiutils.Utils;
|
||||
import com.aoleyun.os.jpush.TagAliasOperatorHelper;
|
||||
import com.aoleyun.os.network.HTTPInterface;
|
||||
import com.aoleyun.os.network.NetworkManager;
|
||||
@@ -35,17 +35,21 @@ import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class MyApplication extends Application {
|
||||
private static final String TAG = MyApplication.class.getSimpleName();
|
||||
public class BaseApplication extends Application {
|
||||
private static final String TAG = BaseApplication.class.getSimpleName();
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static MyApplication app;
|
||||
private static BaseApplication app;
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static Context context;
|
||||
|
||||
public static MyApplication getInstance() {
|
||||
public static BaseApplication getInstance() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public static Context getContext(){
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
@@ -37,7 +37,7 @@ import com.aoleyun.os.LauncherFiles;
|
||||
import com.aoleyun.os.LauncherModel;
|
||||
import com.aoleyun.os.MainThreadExecutor;
|
||||
import com.aoleyun.os.R;
|
||||
import com.aoleyun.os.TTUtils.BitmapUtils;
|
||||
import com.aoleyun.os.uiuiutils.BitmapUtils;
|
||||
import com.aoleyun.os.WorkspaceItemInfo;
|
||||
import com.aoleyun.os.Utilities;
|
||||
import com.aoleyun.os.compat.LauncherAppsCompat;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.aoleyun.os.jpush;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.aoleyun.os.base.MyApplication;
|
||||
import com.aoleyun.os.base.BaseApplication;
|
||||
|
||||
import cn.jpush.android.api.CustomMessage;
|
||||
import cn.jpush.android.api.JPushMessage;
|
||||
@@ -17,7 +17,7 @@ public class MyJPushMessageReceiver extends JPushMessageReceiver {
|
||||
public void onTagOperatorResult(Context context, JPushMessage jPushMessage) {
|
||||
TagAliasOperatorHelper.getInstance().onTagOperatorResult(context,jPushMessage);
|
||||
super.onTagOperatorResult(context, jPushMessage);
|
||||
MyApplication.getInstance().onTagOperatorResult(jPushMessage);
|
||||
BaseApplication.getInstance().onTagOperatorResult(jPushMessage);
|
||||
}
|
||||
@Override
|
||||
public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage){
|
||||
@@ -28,7 +28,7 @@ public class MyJPushMessageReceiver extends JPushMessageReceiver {
|
||||
public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
|
||||
TagAliasOperatorHelper.getInstance().onAliasOperatorResult(context,jPushMessage);
|
||||
super.onAliasOperatorResult(context, jPushMessage);
|
||||
MyApplication.getInstance().onAliasOperatorResult(jPushMessage);
|
||||
BaseApplication.getInstance().onAliasOperatorResult(jPushMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,8 @@ import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.aoleyun.os.network.HTTPInterface;
|
||||
import com.aoleyun.os.service.MainService;
|
||||
import com.aoleyun.os.uiuiutils.ForegroundAppUtil;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -134,7 +136,7 @@ public class MyReceiver extends BroadcastReceiver {
|
||||
|
||||
switch (message) {
|
||||
case SEND_RUNNING_APP:
|
||||
HTTPInterface.SendRunningApp(context);
|
||||
getRunningApp(context);
|
||||
break;
|
||||
case UPDATE_APP_LOCK:
|
||||
HTTPInterface.getAppPasswd();
|
||||
@@ -146,4 +148,8 @@ public class MyReceiver extends BroadcastReceiver {
|
||||
|
||||
}
|
||||
|
||||
private void getRunningApp(Context context) {
|
||||
HTTPInterface.sendRunningApp(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import com.aoleyun.os.TTUtils.ToastUtil;
|
||||
import com.aoleyun.os.uiuiutils.ToastUtil;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -220,7 +220,9 @@ public class AddWorkspaceItemsTask extends BaseModelUpdateTask {
|
||||
|
||||
int screenCount = workspaceScreens.size();
|
||||
// First check the preferred screen.
|
||||
int preferredScreenIndex = workspaceScreens.isEmpty() ? 0 : 1;
|
||||
// int preferredScreenIndex = workspaceScreens.isEmpty() ? 0 : 1;
|
||||
/*从第一页开始显示*/
|
||||
int preferredScreenIndex = 0;
|
||||
if (preferredScreenIndex < screenCount) {
|
||||
screenId = workspaceScreens.get(preferredScreenIndex);
|
||||
found = findNextAvailableIconSpaceInScreen(
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.LauncherActivityInfo;
|
||||
import android.content.pm.PackageInstaller;
|
||||
import android.content.pm.PackageInstaller.SessionInfo;
|
||||
@@ -250,7 +251,7 @@ public class LoaderTask implements Runnable {
|
||||
/**
|
||||
* 需要隐藏的图标
|
||||
*/
|
||||
private List<String> hideApp = new ArrayList<String>() {{
|
||||
private HashSet<String> hideApp = new HashSet<String>() {{
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
this.add("com.android.quicksearchbox");
|
||||
this.add("com.st.nfc.dta.mobile");
|
||||
@@ -260,6 +261,36 @@ public class LoaderTask implements Runnable {
|
||||
this.add("com.android.email");
|
||||
}};
|
||||
|
||||
public static HashSet<String> showApp = new HashSet<String>() {{
|
||||
// this.add(BuildConfig.APPLICATION_ID);
|
||||
//aoleyun
|
||||
this.add("com.aoleyun.sn");
|
||||
this.add("com.aoleyun.appstore");
|
||||
this.add("com.aoleyun.postern");
|
||||
this.add("com.aoleyun.browser");
|
||||
this.add("com.aoleyun.info");
|
||||
this.add("com.aoleyun.file");
|
||||
this.add("com.aoleyun.reos");
|
||||
this.add("com.aoleyunos.dop1");
|
||||
this.add("com.aoleyunos.dop2");
|
||||
//system
|
||||
this.add("com.android.documentsui");
|
||||
this.add("com.android.messaging");
|
||||
this.add("com.android.music");
|
||||
this.add("com.android.camera");
|
||||
this.add("com.android.camera2");
|
||||
this.add("com.android.settings");
|
||||
this.add("com.android.stk");
|
||||
this.add("com.mediatek.camera");
|
||||
this.add("com.mediatek.filemanager");
|
||||
//uiui
|
||||
this.add("com.calculator.uiui");
|
||||
this.add("com.notepad.uiui");
|
||||
this.add("com.calendar.uiui");
|
||||
this.add("com.alarmclock.uiui");
|
||||
this.add("com.uiui.videoplayer");
|
||||
}};
|
||||
|
||||
//add for load all app on workspace
|
||||
private void verifyApplications() {
|
||||
final Context context = mApp.getContext();
|
||||
@@ -270,9 +301,12 @@ public class LoaderTask implements Runnable {
|
||||
ArrayList<InstallShortcutReceiver.PendingInstallShortcutInfo> added = new ArrayList<InstallShortcutReceiver.PendingInstallShortcutInfo>();
|
||||
synchronized (this) {
|
||||
for (LauncherActivityInfo app : apps) {
|
||||
if (hideApp.contains(app.getApplicationInfo().packageName)) {
|
||||
/*系统应用*/
|
||||
if ((app.getApplicationFlags() & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||
if (!showApp.contains(app.getApplicationInfo().packageName)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
InstallShortcutReceiver.PendingInstallShortcutInfo pendingInstallShortcutInfo = new InstallShortcutReceiver.PendingInstallShortcutInfo(app, context);
|
||||
added.add(pendingInstallShortcutInfo);
|
||||
installQueue.add(pendingInstallShortcutInfo.getItemInfo());
|
||||
|
||||
@@ -4,7 +4,9 @@ import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.os.TTUtils.APKUtils;
|
||||
import com.aoleyun.os.network.bean.AppPasswdBean;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.uiuiutils.APKUtils;
|
||||
import com.aoleyun.os.jpush.TagAliasOperatorHelper;
|
||||
import com.aoleyun.os.uiuiutils.JGYUtils;
|
||||
import com.aoleyun.os.uiuiutils.TimeUtils;
|
||||
@@ -117,8 +119,14 @@ public class HTTPInterface {
|
||||
});
|
||||
}
|
||||
|
||||
public static void SendRunningApp(Context context) {
|
||||
/**
|
||||
* 发送正在运行的app信息
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void sendRunningApp(Context context) {
|
||||
String packageName = TimeUtils.getInstance().getAppPackageName();
|
||||
Log.e("SendRunningApp", "packageName: " + packageName);
|
||||
long time = TimeUtils.getInstance().getStartTime();
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("app_package", packageName);
|
||||
@@ -136,7 +144,7 @@ public class HTTPInterface {
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("SendRunningApp", "onSubscribe: " + baseResponse);
|
||||
Log.e("SendRunningApp", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.aoleyun.os.network;
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
|
||||
import com.aoleyun.os.TTUtils.Utils;
|
||||
import com.aoleyun.os.network.bean.AppPasswdBean;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.uiuiutils.Utils;
|
||||
import com.aoleyun.os.network.api.AddAppLog;
|
||||
import com.aoleyun.os.network.api.AppUsageRecordApi;
|
||||
import com.aoleyun.os.network.api.CheckUpdate;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.aoleyun.os.network.api;
|
||||
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.URLPath;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.aoleyun.os.network.api;
|
||||
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.URLPath;
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ import retrofit2.http.POST;
|
||||
|
||||
public interface AppUsageRecordApi {
|
||||
@FormUrlEncoded
|
||||
@POST(value = URLPath.SEND_APP_RECORD)
|
||||
@POST(URLPath.SEND_APP_RECORD)
|
||||
Observable<BaseResponse> sendAppUsageRecord(
|
||||
@Field("sn") String sn,
|
||||
@Field("app_name") String app_name,
|
||||
@Field("app_package") String app_package,
|
||||
@Field("app_name") String app_name,
|
||||
@Field("open_time") long open_time,
|
||||
@Field("close_time") long close_time
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.aoleyun.os.network.api;
|
||||
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.NewestAppUpdateResult;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.bean.NewestAppUpdateResult;
|
||||
import com.aoleyun.os.network.URLPath;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.aoleyun.os.network.api;
|
||||
|
||||
import com.aoleyun.os.network.AppPasswdBean;
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.bean.AppPasswdBean;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.URLPath;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.aoleyun.os.network.api;
|
||||
|
||||
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.URLPath;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.aoleyun.os.network.api;
|
||||
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.URLPath;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.aoleyun.os.network.api;
|
||||
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.URLPath;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.os.network;
|
||||
package com.aoleyun.os.network.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.os.network;
|
||||
package com.aoleyun.os.network.bean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.os.network;
|
||||
package com.aoleyun.os.network.bean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -10,11 +10,11 @@ import android.os.PowerManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.os.Launcher;
|
||||
import com.aoleyun.os.TTUtils.APKUtils;
|
||||
import com.aoleyun.os.TTUtils.CmdUtil;
|
||||
import com.aoleyun.os.TTUtils.Utils;
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.BuildConfig;
|
||||
import com.aoleyun.os.uiuiutils.APKUtils;
|
||||
import com.aoleyun.os.uiuiutils.CmdUtil;
|
||||
import com.aoleyun.os.uiuiutils.Utils;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.NetworkManager;
|
||||
import com.aoleyun.os.uiuiutils.ForegroundAppUtil;
|
||||
import com.aoleyun.os.uiuiutils.TimeUtils;
|
||||
@@ -92,9 +92,8 @@ public class MainService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
private final static long ONE_HOURS_TIME = 60 * 60;
|
||||
private final static long TEN_MINUTES_TIME = 60 * 10;
|
||||
|
||||
private final static long ONE_HOURS_TIME = 60 * 60 * 1000;
|
||||
private final static long TEN_MINUTES_TIME = 60 * 10 * 1000;
|
||||
|
||||
private void isScreenshot() {
|
||||
//1、检测应用使用情况,如果设备长时间运行一个应用,超过1小时,启动截屏一次。
|
||||
@@ -104,7 +103,7 @@ public class MainService extends Service {
|
||||
String topPackageName = ForegroundAppUtil.getForegroundPackageName(MainService.this);
|
||||
Log.e(TAG, "isScreenshot: " + topPackageName);
|
||||
String pkg = TimeUtils.getInstance().getAppPackageName();
|
||||
if (TextUtils.isEmpty(pkg)) {
|
||||
if (TextUtils.isEmpty(pkg) || BuildConfig.APPLICATION_ID.equals(pkg)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.os.Statistics;
|
||||
package com.aoleyun.os.statistics;
|
||||
|
||||
import android.app.usage.UsageStats;
|
||||
import android.content.Context;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.os.Statistics;
|
||||
package com.aoleyun.os.statistics;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.usage.UsageEvents;
|
||||
@@ -14,7 +14,7 @@ import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static com.aoleyun.os.Statistics.AppInformation.bootTime;
|
||||
import static com.aoleyun.os.statistics.AppInformation.bootTime;
|
||||
|
||||
|
||||
public class StatisticsInfo {
|
||||
@@ -47,20 +47,20 @@ import com.aoleyun.os.ItemInfo;
|
||||
import com.aoleyun.os.Launcher;
|
||||
import com.aoleyun.os.LauncherAppWidgetInfo;
|
||||
import com.aoleyun.os.LauncherAppWidgetProviderInfo;
|
||||
import com.aoleyun.os.TTUtils.CustomDialog;
|
||||
import com.aoleyun.os.TTUtils.ToastUtil;
|
||||
import com.aoleyun.os.base.MyApplication;
|
||||
import com.aoleyun.os.uiuiutils.CustomDialog;
|
||||
import com.aoleyun.os.uiuiutils.ToastUtil;
|
||||
import com.aoleyun.os.base.BaseApplication;
|
||||
import com.aoleyun.os.PromiseAppInfo;
|
||||
import com.aoleyun.os.R;
|
||||
import com.aoleyun.os.Statistics.AppInformation;
|
||||
import com.aoleyun.os.Statistics.StatisticsInfo;
|
||||
import com.aoleyun.os.TTUtils.Utils;
|
||||
import com.aoleyun.os.statistics.AppInformation;
|
||||
import com.aoleyun.os.statistics.StatisticsInfo;
|
||||
import com.aoleyun.os.uiuiutils.Utils;
|
||||
import com.aoleyun.os.WorkspaceItemInfo;
|
||||
import com.aoleyun.os.compat.AppWidgetManagerCompat;
|
||||
import com.aoleyun.os.folder.Folder;
|
||||
import com.aoleyun.os.folder.FolderIcon;
|
||||
import com.aoleyun.os.network.AppPasswdBean;
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.bean.AppPasswdBean;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.HTTPInterface;
|
||||
import com.aoleyun.os.network.NetworkManager;
|
||||
import com.aoleyun.os.network.api.AddAppLog;
|
||||
@@ -128,8 +128,7 @@ public class ItemClickHandler {
|
||||
Log.e("onClick", "onClick: " + ApplicationLock);
|
||||
Type type = new TypeToken<List<AppPasswdBean>>() {
|
||||
}.getType();
|
||||
Gson gson = new Gson();
|
||||
List<AppPasswdBean> appPasswdBeans = gson.fromJson(ApplicationLock, type);
|
||||
List<AppPasswdBean> appPasswdBeans = new Gson().fromJson(ApplicationLock, type);
|
||||
String packageName = ((WorkspaceItemInfo) tag).getTargetComponent().getPackageName();
|
||||
Log.e("ItemClickHandler", "onClick: " + packageName);
|
||||
if (appPasswdBeans == null) {
|
||||
@@ -139,7 +138,6 @@ public class ItemClickHandler {
|
||||
for (AppPasswdBean bean : appPasswdBeans) {
|
||||
hashMap.put(bean.getApp_package(), bean.getPassword());
|
||||
}
|
||||
|
||||
if (hashMap.get(packageName) != null) {
|
||||
CustomDialog dialog = new CustomDialog(v.getContext());
|
||||
dialog.setTitle("请输入密码");
|
||||
@@ -168,35 +166,12 @@ public class ItemClickHandler {
|
||||
onClickAppShortcut(v, (WorkspaceItemInfo) tag, launcher, sourceContainer);
|
||||
}
|
||||
}
|
||||
|
||||
// Log.e("ItemClickHandler", "onClick: " + packageName);
|
||||
// if (cameraClosed(v.getContext(), packageName)) {
|
||||
// return;
|
||||
// }
|
||||
// onClickAppShortcut(v, (WorkspaceItemInfo) tag, launcher, sourceContainer);
|
||||
AppInformation app = null;
|
||||
try {
|
||||
app = getInfoFromPackageName(packageName);
|
||||
} catch (Exception e) {
|
||||
Log.e("onClick", e.getMessage());
|
||||
}
|
||||
// if (app != null) {
|
||||
// Log.e("fht", "运行时间: " + DateUtils.formatElapsedTime(app.getUsedTimebyDay() / 1000));
|
||||
// Log.e("fht", "运行时间: " + app.getUsedTimebyDay() / 1000);
|
||||
// TimeUtils.getInstance().setTime(app.getUsedTimebyDay() / 1000);
|
||||
//
|
||||
// } else {
|
||||
// Log.e("fht", "首次运行:" + "包名:" + packageName);
|
||||
// TimeUtils.getInstance().setTime(0);
|
||||
// }
|
||||
// if (!APKUtils.isSystemApp(v.getContext(), packageName) && !Arrays.asList(packages).contains(packageName)) {
|
||||
// HTTPInterface.sendTimeLog(handler, userInfo, ((ShortcutInfo) tag).title.toString(), 1, 0);
|
||||
// SendOpenApp(packageName);
|
||||
// }
|
||||
|
||||
//写入正在运行的app的包名和时间
|
||||
TimeUtils.getInstance().setAppPackageName(packageName);
|
||||
TimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
||||
HTTPInterface.SendRunningApp(MyApplication.getInstance().getApplicationContext());
|
||||
HTTPInterface.sendRunningApp(BaseApplication.getContext());
|
||||
} else if (tag instanceof FolderInfo) {
|
||||
if (v instanceof FolderIcon) {
|
||||
onClickFolderIcon(v);
|
||||
@@ -235,13 +210,12 @@ public class ItemClickHandler {
|
||||
"com.android.uiuios",
|
||||
"com.easyold.uiuios",
|
||||
"com.jiaoguanyi.store"
|
||||
|
||||
};
|
||||
|
||||
public static AppInformation getInfoFromPackageName(String packageName) {
|
||||
List<AppInformation> list;
|
||||
AppInformation app = null;
|
||||
StatisticsInfo statisticsInfo = new StatisticsInfo(MyApplication.getInstance().getApplicationContext());
|
||||
StatisticsInfo statisticsInfo = new StatisticsInfo(BaseApplication.getInstance().getApplicationContext());
|
||||
list = statisticsInfo.getShowList();
|
||||
for (AppInformation appInformation : list) {
|
||||
String name = appInformation.getPackageName();
|
||||
@@ -252,57 +226,6 @@ public class ItemClickHandler {
|
||||
return app;
|
||||
}
|
||||
|
||||
private static void SendOpenApp(String packageName) {
|
||||
PackageManager pm = MyApplication.getInstance().getPackageManager();
|
||||
PackageInfo appInfo = null;
|
||||
try {
|
||||
appInfo = pm.getPackageInfo(packageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (null != appInfo) {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = appInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = appInfo.versionCode;
|
||||
}
|
||||
AddAppLog appLog = NetworkManager.getInstance().getapplogControl();
|
||||
String sn = Utils.getSerial();
|
||||
appLog.addLog(sn, packageName, appVersionCode, System.currentTimeMillis() / 1000, 1)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("SendOpenApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
int code = baseResponse.code;
|
||||
if (code == 200) {
|
||||
Log.e("SendOpenApp", "onNext: " + code + baseResponse.data);
|
||||
} else {
|
||||
Log.e("SendOpenApp", "onNext: " + code + baseResponse.msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("SendOpenApp", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("SendOpenApp", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Event handler for a folder icon click.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.os.TTUtils;
|
||||
package com.aoleyun.os.uiuiutils;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.os.TTUtils;
|
||||
package com.aoleyun.os.uiuiutils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.os.TTUtils;
|
||||
package com.aoleyun.os.uiuiutils;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.os.TTUtils;
|
||||
package com.aoleyun.os.uiuiutils;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.os.TTUtils;
|
||||
package com.aoleyun.os.uiuiutils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
@@ -1,14 +1,20 @@
|
||||
package com.aoleyun.os.uiuiutils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.os.BuildConfig;
|
||||
import com.aoleyun.os.model.LoaderTask;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
|
||||
public class JGYUtils {
|
||||
@@ -17,6 +23,7 @@ public class JGYUtils {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static JGYUtils sInstance;
|
||||
private Context mContext;
|
||||
private ContentResolver mResolver;
|
||||
public static int MTKPlatform = 1;
|
||||
public static int ZhanruiPlatform = 2;
|
||||
public static int UnknowPlatform = 0;
|
||||
@@ -25,7 +32,11 @@ public class JGYUtils {
|
||||
|
||||
|
||||
private JGYUtils(Context context) {
|
||||
if (context == null) {
|
||||
throw new RuntimeException("Context is NULL");
|
||||
}
|
||||
this.mContext = context;
|
||||
this.mResolver = context.getContentResolver();
|
||||
}
|
||||
|
||||
public static void init(Context context) {
|
||||
@@ -159,5 +170,15 @@ public class JGYUtils {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isEnforceApp(String pkg) {
|
||||
String appString = Settings.System.getString(mResolver, "qch_force_app");
|
||||
if (TextUtils.isEmpty(appString)) return false;
|
||||
Log.e("isEnforceApp", "appString: " + appString);
|
||||
HashSet<String> appSet = new HashSet<>(Arrays.asList(appString.split(",")));
|
||||
appSet.addAll(LoaderTask.showApp);
|
||||
return appSet.contains(pkg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,29 +4,27 @@ import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.os.TTUtils.APKUtils;
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.NetworkManager;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class TimeUtils {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static TimeUtils sInstance;
|
||||
private Context mContext;
|
||||
private AppUsageRecord mAppUsageRecord;
|
||||
|
||||
private SimpleDateFormat ruleSDF = new SimpleDateFormat("HH:mm:ss");
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
private String TAG = TimeUtils.class.getSimpleName();
|
||||
|
||||
private TimeUtils(Context context) {
|
||||
if (context == null) {
|
||||
throw new RuntimeException("Context is NULL");
|
||||
}
|
||||
this.mContext = context;
|
||||
mAppUsageRecord = new AppUsageRecord();
|
||||
}
|
||||
|
||||
public static void init(Context context) {
|
||||
@@ -45,32 +43,43 @@ public class TimeUtils {
|
||||
private static String normalStartTime = "8:00:00";
|
||||
private static String unusualStartTime = "22:00:00";
|
||||
|
||||
private String appPackageName;
|
||||
private long endTime = 0;
|
||||
private long startTime = 0;
|
||||
|
||||
class AppUsageRecord implements Serializable {
|
||||
private static final long serialVersionUID = 7368756182558952397L;
|
||||
|
||||
String pkg;
|
||||
long startTime;
|
||||
long endTime;
|
||||
}
|
||||
|
||||
public void setAppPackageName(String name) {
|
||||
this.appPackageName = name;
|
||||
mAppUsageRecord.pkg = name;
|
||||
}
|
||||
|
||||
public String getAppPackageName() {
|
||||
return appPackageName;
|
||||
return mAppUsageRecord.pkg;
|
||||
}
|
||||
|
||||
public void setStartTime(long time) {
|
||||
this.startTime = time;
|
||||
mAppUsageRecord.startTime = time;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
return mAppUsageRecord.startTime;
|
||||
}
|
||||
|
||||
public void setEndTime(long time) {
|
||||
this.endTime = time;
|
||||
mAppUsageRecord.endTime = time;
|
||||
}
|
||||
|
||||
public long getEndTime() {
|
||||
return endTime;
|
||||
return mAppUsageRecord.endTime;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
mAppUsageRecord.pkg = "";
|
||||
mAppUsageRecord.startTime = 0;
|
||||
mAppUsageRecord.endTime = 0;
|
||||
}
|
||||
|
||||
private static final long DAY_TIME = 1000 * 60 * 60 * 24;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.os.TTUtils;
|
||||
package com.aoleyun.os.uiuiutils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -12,7 +12,6 @@ import android.widget.Toast;
|
||||
|
||||
import com.aoleyun.os.BuildConfig;
|
||||
import com.aoleyun.os.R;
|
||||
import com.aoleyun.os.uiuiutils.JGYUtils;
|
||||
import com.blankj.utilcode.util.ColorUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.os.TTUtils;
|
||||
package com.aoleyun.os.uiuiutils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActivityManager;
|
||||