Commit b0439b7b by 郑鹏

更新

parent 742053e9
...@@ -103,7 +103,7 @@ ext { ...@@ -103,7 +103,7 @@ ext {
GITHUB_REPO_PATH = "../../androidlibrary" GITHUB_REPO_PATH = "../../androidlibrary"
PUBLISH_GROUP_ID = 'cn.dankal.android' PUBLISH_GROUP_ID = 'cn.dankal.android'
PUBLISH_ARTIFACT_ID = 'launcher' PUBLISH_ARTIFACT_ID = 'launcher'
PUBLISH_VERSION = '1.4.5.7' PUBLISH_VERSION = '1.4.5.8'
} }
uploadArchives { uploadArchives {
......
...@@ -419,6 +419,9 @@ public class ListenerAppService extends Service { ...@@ -419,6 +419,9 @@ public class ListenerAppService extends Service {
return INTERCEPT_SYSTEM_SETTING; return INTERCEPT_SYSTEM_SETTING;
} }
/* if (LauncherManager.getInstance().isIsInterceptAppointPage() && LauncherManager.getInstance().isInterceptPackage(topActivity)) {
return INTERCEPT_SYSTEM_SETTING;
}*/
ManagementInfo appinfo = LauncherManager.getInstance().getManageAppInfo(topActivity); ManagementInfo appinfo = LauncherManager.getInstance().getManageAppInfo(topActivity);
......
package com.android.launcher3.manager; package com.android.launcher3.manager;
import java.util.ArrayList;
public class Constants { public class Constants {
...@@ -42,6 +44,9 @@ public class Constants { ...@@ -42,6 +44,9 @@ public class Constants {
"com.android.settings.Settings$AppNotificationSettingsActivity", "com.android.settings.Settings$AppNotificationSettingsActivity",
"android.app.Notification"}; "android.app.Notification"};
//需要拦截的设置
public static String[] INTERCEPT_SETTING={"com.huawei.systemmanager","com.android.settings"};
public static final String ACTION_UPDATE_ICON = "update_icon"; public static final String ACTION_UPDATE_ICON = "update_icon";
public static final String EXTRA_PACKAGE = "package"; public static final String EXTRA_PACKAGE = "package";
......
...@@ -107,6 +107,8 @@ public class LauncherManager { ...@@ -107,6 +107,8 @@ public class LauncherManager {
private LockScreenInterface floatWindowHandle; private LockScreenInterface floatWindowHandle;
private boolean mIsInterceptAppointPage = false;
private static boolean DEBUG_MODEL = false; private static boolean DEBUG_MODEL = false;
...@@ -232,6 +234,15 @@ public class LauncherManager { ...@@ -232,6 +234,15 @@ public class LauncherManager {
this.interceptSystemSetting = interceptSystemSetting; this.interceptSystemSetting = interceptSystemSetting;
} }
public boolean isIsInterceptAppointPage() {
return mIsInterceptAppointPage;
}
public void setIsIsInterceptAppointPage(boolean isInterceptAppointPage) {
this.mIsInterceptAppointPage = isInterceptAppointPage;
}
/** /**
* 获取受管理app的信息 * 获取受管理app的信息
* *
...@@ -740,6 +751,18 @@ public class LauncherManager { ...@@ -740,6 +751,18 @@ public class LauncherManager {
return false; return false;
} }
/**
* 判断当前这个设置页面是否需要拦截
*/
public boolean isInterceptPackage(String packageName) {
for (int i = 0; i < Constants.INTERCEPT_SETTING.length; i++) {
if (Constants.INTERCEPT_SETTING[i].equals(packageName)) {
return true;
}
}
return false;
}
/** /**
* 判断当前应用是否是系统应用 * 判断当前应用是否是系统应用
...@@ -767,7 +790,7 @@ public class LauncherManager { ...@@ -767,7 +790,7 @@ public class LauncherManager {
* 判断以前设置的强制锁屏是否过期 * 判断以前设置的强制锁屏是否过期
*/ */
public synchronized boolean updateLockScreenDelay() { public synchronized boolean updateLockScreenDelay() {
Log.i("lock_zzzzzzzz","1"); Log.i("lock_zzzzzzzz", "1");
// 退出管制 // 退出管制
if (getExitState()) { if (getExitState()) {
unlockScreen(); unlockScreen();
...@@ -777,20 +800,20 @@ public class LauncherManager { ...@@ -777,20 +800,20 @@ public class LauncherManager {
return true; return true;
} }
if (timeModeManager.getLockScreenType() == ColumnDef.LockScreen.MODE_FORCE_LOCK || timeModeManager.getLockScreenType() == ColumnDef.LockScreen.MODE_REST) { if (timeModeManager.getLockScreenType() == ColumnDef.LockScreen.MODE_FORCE_LOCK || timeModeManager.getLockScreenType() == ColumnDef.LockScreen.MODE_REST) {
Log.i("lock_zzzzzzzz","2"); Log.i("lock_zzzzzzzz", "2");
//判断之前是否有忽略工作模式去锁屏 //判断之前是否有忽略工作模式去锁屏
long endTime = timeModeManager.getLockScreenEndTime(); long endTime = timeModeManager.getLockScreenEndTime();
Logger.e(TAG, "updateLockScreen\t" + endTime + "\t" + System.currentTimeMillis()); Logger.e(TAG, "updateLockScreen\t" + endTime + "\t" + System.currentTimeMillis());
if (endTime == 0 || endTime > System.currentTimeMillis()) { if (endTime == 0 || endTime > System.currentTimeMillis()) {
// 无限期已家长端临时设定的模式执行锁屏 // 无限期已家长端临时设定的模式执行锁屏
Log.i("lock_zzzzzzzz","3"); Log.i("lock_zzzzzzzz", "3");
// if (lockScreenMode != timeModeManager.getLockScreenType()) { // if (lockScreenMode != timeModeManager.getLockScreenType()) {
lockScreen(getContext(), ColumnDef.LockScreen.MODE_FORCE_LOCK); lockScreen(getContext(), ColumnDef.LockScreen.MODE_FORCE_LOCK);
return true; return true;
// } // }
} else if (endTime < System.currentTimeMillis()) { } else if (endTime < System.currentTimeMillis()) {
Log.i("lock_zzzzzzzz","4"); Log.i("lock_zzzzzzzz", "4");
// 非家长端强制锁定状态或者锁定时间到期 恢复当前工作模式下的锁屏方式 // 非家长端强制锁定状态或者锁定时间到期 恢复当前工作模式下的锁屏方式
Logger.e(TAG, lockScreenMode + "\t" + timeModeManager.getCurrentScreenModel()); Logger.e(TAG, lockScreenMode + "\t" + timeModeManager.getCurrentScreenModel());
...@@ -798,7 +821,7 @@ public class LauncherManager { ...@@ -798,7 +821,7 @@ public class LauncherManager {
if (timeModeManager.getCurrentScreenModel() != ColumnDef.LockScreen.MODE_NORMAL && timeModeManager.getCurrentScreenModel() != ColumnDef.LockScreen.MODE_UNLOCK) { if (timeModeManager.getCurrentScreenModel() != ColumnDef.LockScreen.MODE_NORMAL && timeModeManager.getCurrentScreenModel() != ColumnDef.LockScreen.MODE_UNLOCK) {
Logger.e(TAG, "lockScreen"); Logger.e(TAG, "lockScreen");
lockScreen(getContext(), timeModeManager.getCurrentScreenModel()); lockScreen(getContext(), timeModeManager.getCurrentScreenModel());
Log.i("lock_zzzzzzzz","5"); Log.i("lock_zzzzzzzz", "5");
return true; return true;
} else { } else {
...@@ -808,7 +831,7 @@ public class LauncherManager { ...@@ -808,7 +831,7 @@ public class LauncherManager {
} }
} else { } else {
Log.i("lock_zzzzzzzz","6"); Log.i("lock_zzzzzzzz", "6");
// //判断工作模式去锁屏 // //判断工作模式去锁屏
Logger.e(TAG, "inTimeRegionTolockScreen"); Logger.e(TAG, "inTimeRegionTolockScreen");
...@@ -933,13 +956,13 @@ public class LauncherManager { ...@@ -933,13 +956,13 @@ public class LauncherManager {
Intent intent = new Intent(); Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ComponentName cn = new ComponentName("cn.dankal.bzshchild", "cn.dankal.bzshchild.ui.SplashActivity"); /*ComponentName cn = new ComponentName("cn.dankal.bzshchild", "cn.dankal.bzshchild.ui.SplashActivity");
intent.setComponent(cn); intent.setComponent(cn);
Uri uri = Uri.parse("cn.dankal.bzshchild.ui.SplashActivity"); Uri uri = Uri.parse("cn.dankal.bzshchild.ui.SplashActivity");*/
/* ComponentName cn = new ComponentName("com.dankal.dankal_launcher", "com.dankal.dankal_launcher.PackageManageActivity"); ComponentName cn = new ComponentName("com.dankal.dankal_launcher", "com.dankal.dankal_launcher.PackageManageActivity");
intent.setComponent(cn); intent.setComponent(cn);
Uri uri = Uri.parse("com.dankal.dankal_launcher.PackageManageActivity");*/ Uri uri = Uri.parse("com.dankal.dankal_launcher.PackageManageActivity");
intent.setData(uri); intent.setData(uri);
context.startActivity(intent); context.startActivity(intent);
......
...@@ -252,6 +252,9 @@ public class BgDataModel { ...@@ -252,6 +252,9 @@ public class BgDataModel {
} }
public synchronized void removeItem(Context context, Iterable<? extends ItemInfo> items) { public synchronized void removeItem(Context context, Iterable<? extends ItemInfo> items) {
if (SystemUtils.isOPPO()){
return;
}
for (ItemInfo item : items) { for (ItemInfo item : items) {
switch (item.itemType) { switch (item.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER: case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
......
...@@ -51,6 +51,7 @@ import com.android.launcher3.util.ItemInfoMatcher; ...@@ -51,6 +51,7 @@ import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.LongArrayMap; import com.android.launcher3.util.LongArrayMap;
import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.util.PackageUserKey; import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.util.SystemUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -355,7 +356,7 @@ public class PackageUpdatedTask extends BaseModelUpdateTask { ...@@ -355,7 +356,7 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
// Mark disabled packages in the broadcast to be removed // Mark disabled packages in the broadcast to be removed
final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context); final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context);
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
if (!launcherApps.isPackageEnabledForProfile(packages[i], mUser)) { if (!launcherApps.isPackageEnabledForProfile(packages[i], mUser) && !SystemUtils.isOPPO()) {
removedPackages.add(packages[i]); removedPackages.add(packages[i]);
} }
} }
......
...@@ -790,15 +790,15 @@ public class PermissionUtil { ...@@ -790,15 +790,15 @@ public class PermissionUtil {
* 处理图标的显示和隐藏 * 处理图标的显示和隐藏
*/ */
public static void initLauncherIconIsShow(Context context, boolean isShow) { public static void initLauncherIconIsShow(Context context, boolean isShow) {
if (PermissionUtil.isHideHomeIcon(context)) { /* if (PermissionUtil.isHideHomeIcon(context)) {
ComponentName mDefault = new ComponentName(context, "cn.dankal.bzshchild.ui.EntranceMainActivity"); //ComponentName mDefault = new ComponentName(context, "cn.dankal.bzshchild.ui.EntranceMainActivity");
//ComponentName mDefault = new ComponentName(context, "com.dankal.dankal_launcher.EntranceMainActivity"); ComponentName mDefault = new ComponentName(context, "com.dankal.dankal_launcher.EntranceMainActivity");
if (isShow) { if (isShow) {
enableComponent(context, mDefault); enableComponent(context, mDefault);
} else { } else {
disableComponent(context, mDefault); disableComponent(context, mDefault);
} }
} }*/
} }
/** /**
......
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android { android {
signingConfigs { signingConfigs {
release { release {
......
package com.dankal.dankal_launcher
/**
* Author: roczheng
* Date: 2020/9/8
* Time: 15:38
* Description:
*/
class AppTimeBean {
var list: AppTimeBeanList? = null
class AppTimeBeanList {
var game_time: Long? = 0
var rest_time: Int? = 0
var uuid: String? = ""
var type: String? = ""
var list: List<String>? = null
}
}
\ No newline at end of file
package com.dankal.dankal_launcher;
import java.util.List;
/**
* Author: roczheng
* Date: 2020/11/23
* Time: 14:29
* Description:
*/
public class AppTimeBeanTow {
/**
* list : {"game_time":150,"list":["1","1","0","0","0","0","0","0","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","0"],"rest_time":0,"type":"work","uuid":"531c28693ff26688803f9174666f21c0"}
*/
private ListBean list;
public ListBean getList() {
return list;
}
public void setList(ListBean list) {
this.list = list;
}
public static class ListBean {
/**
* game_time : 150
* list : ["1","1","0","0","0","0","0","0","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","0"]
* rest_time : 0
* type : work
* uuid : 531c28693ff26688803f9174666f21c0
*/
private int game_time;
private int rest_time;
private String type;
private String uuid;
private List<String> list;
public int getGame_time() {
return game_time;
}
public void setGame_time(int game_time) {
this.game_time = game_time;
}
public int getRest_time() {
return rest_time;
}
public void setRest_time(int rest_time) {
this.rest_time = rest_time;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public List<String> getList() {
return list;
}
public void setList(List<String> list) {
this.list = list;
}
}
}
package com.dankal.dankal_launcher; package com.dankal.dankal_launcher;
import android.app.Activity; import android.app.Activity;
import android.app.ActivityManager;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.provider.Settings; import android.provider.Settings;
import android.text.Html;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.android.launcher3.accessibility.DeviceReceiver;
import com.android.launcher3.accessibility.StopRunReceiver;
import com.android.launcher3.manager.ColumnDef; import com.android.launcher3.manager.ColumnDef;
import com.android.launcher3.manager.Constants; import com.android.launcher3.manager.Constants;
import com.android.launcher3.manager.LauncherManager; import com.android.launcher3.manager.LauncherManager;
...@@ -32,13 +24,8 @@ import com.android.launcher3.model.TimeConfig; ...@@ -32,13 +24,8 @@ import com.android.launcher3.model.TimeConfig;
import com.android.launcher3.util.KToast; import com.android.launcher3.util.KToast;
import com.android.launcher3.util.Logger; import com.android.launcher3.util.Logger;
import com.android.launcher3.util.PermissionUtil; import com.android.launcher3.util.PermissionUtil;
import com.android.launcher3.util.SystemUtils;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List; import java.util.List;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
...@@ -91,7 +78,7 @@ public class PackageManageActivity extends Activity { ...@@ -91,7 +78,7 @@ public class PackageManageActivity extends Activity {
break; break;
case 1: case 1:
// //
ManagementInfo managementInfo = new ManagementInfo(); /* ManagementInfo managementInfo = new ManagementInfo();
managementInfo.setUseEndTimeStamp(43320); managementInfo.setUseEndTimeStamp(43320);
managementInfo.setPackageName("com.tencent.mobileqq"); managementInfo.setPackageName("com.tencent.mobileqq");
...@@ -99,7 +86,7 @@ public class PackageManageActivity extends Activity { ...@@ -99,7 +86,7 @@ public class PackageManageActivity extends Activity {
managementInfo.setUseType(ColumnDef.AppUseType.GAME_LOCK_TYPE); managementInfo.setUseType(ColumnDef.AppUseType.GAME_LOCK_TYPE);
LauncherManager.getInstance().addPackageInfo(managementInfo); LauncherManager.getInstance().addPackageInfo(managementInfo);
Logger.e(TAG, "AFTER\t" + LauncherManager.getInstance().getManageAppInfo("com.tencent.mobileqq").toString()); Logger.e(TAG, "AFTER\t" + LauncherManager.getInstance().getManageAppInfo("com.tencent.mobileqq").toString());*/
break; break;
case 2: case 2:
...@@ -120,6 +107,7 @@ public class PackageManageActivity extends Activity { ...@@ -120,6 +107,7 @@ public class PackageManageActivity extends Activity {
}; };
private Context mContent; private Context mContent;
private boolean isA = false;
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
...@@ -204,21 +192,34 @@ public class PackageManageActivity extends Activity { ...@@ -204,21 +192,34 @@ public class PackageManageActivity extends Activity {
ManagementInfo managementInfo = new ManagementInfo(); ManagementInfo managementInfo = new ManagementInfo();
managementInfo.setUseEndTimeStamp(3600); managementInfo.setUseEndTimeStamp(3600);
managementInfo.setPackageName("cn.dankal.www.tudigong_partner"); managementInfo.setPackageName("com.tencent.weread");
managementInfo.setLock(ColumnDef.LockApp.UNLOCKED); managementInfo.setLock(ColumnDef.LockApp.UNLOCKED);
managementInfo.setUseType(ColumnDef.AppUseType.SAFE_TYPE); if (isA) {
isA = false;
managementInfo.setUseType(ColumnDef.AppUseType.GAME_LOCK_TYPE);
} else {
isA = true;
managementInfo.setUseType(ColumnDef.AppUseType.SAFE_TYPE);
}
LauncherManager.getInstance().addPackageInfo(managementInfo); LauncherManager.getInstance().addPackageInfo(managementInfo);
handler.sendEmptyMessageDelayed(1, 500);
ManagementInfo managementInfo2 = new ManagementInfo(); //handler.sendEmptyMessageDelayed(1, 500);
/* ManagementInfo managementInfo2 = new ManagementInfo();
managementInfo2.setUseEndTimeStamp(3600); managementInfo2.setUseEndTimeStamp(3600);
managementInfo2.setPackageName("com.huawei.appmarket"); managementInfo2.setPackageName("com.android.browser");
managementInfo2.setLock(ColumnDef.LockApp.UNLOCKED); managementInfo2.setLock(ColumnDef.LockApp.UNLOCKED);
managementInfo2.setUseType(ColumnDef.AppUseType.SAFE_TYPE); *//* if (isA) {
isA = false;
managementInfo2.setUseType(ColumnDef.AppUseType.SAFE_TYPE);
} else {
isA = true;
managementInfo2.setUseType(ColumnDef.AppUseType.LEARN_TYPE);
}*//*
LauncherManager.getInstance().addPackageInfo(managementInfo2); LauncherManager.getInstance().addPackageInfo(managementInfo2);
handler.sendEmptyMessageDelayed(1, 500); handler.sendEmptyMessageDelayed(1, 500);*/
// Logger.e(TAG, "before\t" + LauncherManager.getInstance().getManageAppInfo("com.tencent.mm").toString()); // Logger.e(TAG, "before\t" + LauncherManager.getInstance().getManageAppInfo("com.tencent.mm").toString());
...@@ -390,7 +391,7 @@ public class PackageManageActivity extends Activity { ...@@ -390,7 +391,7 @@ public class PackageManageActivity extends Activity {
LauncherManager.getInstance().addWorkMode(config); LauncherManager.getInstance().addWorkMode(config);
LauncherManager.getInstance().setCurrentWorkMode(ColumnDef.TimeManager.WORK_DAY);*/ LauncherManager.getInstance().setCurrentWorkMode(ColumnDef.TimeManager.WORK_DAY);*/
initTime(); //initTime();
// handler.sendEmptyMessageDelayed(0, 15000); // handler.sendEmptyMessageDelayed(0, 15000);
...@@ -421,7 +422,7 @@ public class PackageManageActivity extends Activity { ...@@ -421,7 +422,7 @@ public class PackageManageActivity extends Activity {
} }
private void initTime() { private void initTime() {
AppTimeBean appTimeBean= (AppTimeBean) JSONObject.parse(getString(R.string.abc)); AppTimeBeanTow appTimeBean = (AppTimeBeanTow) JSONObject.parse(getString(R.string.abc));
List<Long> regions = new ArrayList<>(); List<Long> regions = new ArrayList<>();
if (appTimeBean.getList() != null && appTimeBean.getList().getList() != null) { if (appTimeBean.getList() != null && appTimeBean.getList().getList() != null) {
for (int i = 0; i < appTimeBean.getList().getList().size(); i++) { for (int i = 0; i < appTimeBean.getList().getList().size(); i++) {
...@@ -449,7 +450,7 @@ public class PackageManageActivity extends Activity { ...@@ -449,7 +450,7 @@ public class PackageManageActivity extends Activity {
//设置当前的工作模式(主要是针对假日模式,其他两个模式会根据当前时间自动变换, //设置当前的工作模式(主要是针对假日模式,其他两个模式会根据当前时间自动变换,
//在假日模式过期之后需要主动调用此方法设置为其他模式) //在假日模式过期之后需要主动调用此方法设置为其他模式)
LauncherManager.getInstance().setCurrentWorkMode(mode); LauncherManager.getInstance().setCurrentWorkMode(mode);
} }
private void toggleNotificationListenerService() { private void toggleNotificationListenerService() {
......
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.3.10'
repositories { repositories {
google() google()
jcenter() jcenter()
...@@ -11,6 +13,8 @@ buildscript { ...@@ -11,6 +13,8 @@ buildscript {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.11' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.11'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment