version:1.1.7
fix: update:增加通知栏管控
This commit is contained in:
@@ -17,8 +17,8 @@ android {
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
|
||||
versionCode 14
|
||||
versionName "1.1.3"
|
||||
versionCode 18
|
||||
versionName "1.1.7"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.blankj.utilcode.util.ServiceUtils;
|
||||
import com.hihonor.android.app.admin.DeviceControlManager;
|
||||
import com.hjq.permissions.OnPermissionCallback;
|
||||
import com.hjq.permissions.XXPermissions;
|
||||
@@ -74,6 +75,8 @@ import com.xwad.os.manager.AmapManager;
|
||||
import com.xwad.os.mdm.AdminManager;
|
||||
import com.xwad.os.permission.PermissionUtils;
|
||||
import com.xwad.os.receiver.AoleDeviceAdminReceiver;
|
||||
import com.xwad.os.service.SocketService;
|
||||
import com.xwad.os.service.main.MainService;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
import com.xwad.os.utils.DataUtil;
|
||||
@@ -120,14 +123,13 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
this.add("com.jxw.launcher");
|
||||
this.add("com.jxw.zncd");
|
||||
this.add("com.jxw.tbdd");
|
||||
this.add("com.jxw.tbfd");
|
||||
this.add("com.jxw.qkxx");
|
||||
this.add("com.jxw.jpkc");
|
||||
// this.add("com.jxw.tbdd");
|
||||
// this.add("com.jxw.tbfd");
|
||||
// this.add("com.jxw.qkxx");
|
||||
// this.add("com.jxw.jpkc");
|
||||
this.add("com.jxw.download");
|
||||
this.add("com.jxw.jxw");
|
||||
this.add("com.study.flashplayer");
|
||||
this.add("com.jxw.question");
|
||||
// this.add("com.study.flashplayer");
|
||||
// this.add("com.jxw.question");
|
||||
}};
|
||||
|
||||
private DevicePolicyManager mDevicePolicyManager;
|
||||
@@ -170,7 +172,12 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
||||
mDeviceControlManager = new DeviceControlManager();
|
||||
mAdminName = new ComponentName(this, AoleDeviceAdminReceiver.class);
|
||||
|
||||
checkEula();
|
||||
int agree = mMMKV.decodeInt("AgreePrivacyPolicy", 0);
|
||||
if (agree == 0) {
|
||||
showPolicyDialog();
|
||||
} else {
|
||||
checkEula();
|
||||
}
|
||||
|
||||
|
||||
Log.e(TAG, "initView: getSerial = " + AdminManager.getInstance().getSerial());
|
||||
@@ -879,16 +886,19 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Log.e(TAG, "onResume: ");
|
||||
// int agree = mMMKV.decodeInt("AgreePrivacyPolicy", 0);
|
||||
// if (agree == 0) {
|
||||
// showPolicyDialog();
|
||||
// } else {
|
||||
// if (checkPermission()) {
|
||||
// Log.e(TAG, "onResume: all permission granted");
|
||||
// } else {
|
||||
// getPermissions();
|
||||
// }
|
||||
// }
|
||||
int agree = mMMKV.decodeInt("AgreePrivacyPolicy", 0);
|
||||
if (agree == 0) {
|
||||
showPolicyDialog();
|
||||
} else {
|
||||
checkEula();
|
||||
if (!ServiceUtils.isServiceRunning(MainService.class)) {
|
||||
startService(new Intent(HomeActivity.this, MainService.class));
|
||||
}
|
||||
if (!ServiceUtils.isServiceRunning(SocketService.class)) {
|
||||
startService(new Intent(HomeActivity.this, SocketService.class));
|
||||
}
|
||||
}
|
||||
|
||||
setDefaultDesktop();
|
||||
}
|
||||
|
||||
@@ -916,7 +926,9 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
unregisterReceivers();
|
||||
EventBus.getDefault().unregister(this);
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1217,7 +1229,8 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
||||
Log.e(TAG, "onConfirm: all permission granted");
|
||||
} else {
|
||||
// startActivity(new Intent(MainActivity.this, PermissionActivity.class));
|
||||
getPermissions();
|
||||
// getPermissions();
|
||||
checkEula();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,10 +3,13 @@ package com.xwad.os.activity.login.result;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.activity.home.HomeActivity;
|
||||
import com.xwad.os.base.mvvm.BaseMvvmActivity;
|
||||
import com.xwad.os.databinding.ActivityLoginSuccessfulBinding;
|
||||
import com.xwad.os.utils.Utils;
|
||||
|
||||
public class LoginSuccessfulActivity extends BaseMvvmActivity<LoginSuccessfulViewModel, ActivityLoginSuccessfulBinding> {
|
||||
|
||||
@@ -30,13 +33,18 @@ public class LoginSuccessfulActivity extends BaseMvvmActivity<LoginSuccessfulVie
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
mViewModel.mBooleanMutableLiveData.observe(this, new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onChanged(Boolean aBoolean) {
|
||||
Utils.triggerRebirth(LoginSuccessfulActivity.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
startHome();
|
||||
// startHome();
|
||||
}
|
||||
|
||||
private void startHome() {
|
||||
@@ -49,7 +57,7 @@ public class LoginSuccessfulActivity extends BaseMvvmActivity<LoginSuccessfulVie
|
||||
|
||||
public class BtnClick {
|
||||
public void toHome(View view) {
|
||||
finish();
|
||||
mViewModel.getAppInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,97 @@
|
||||
package com.xwad.os.activity.login.result;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.xwad.os.base.mvvm.BaseViewModel;
|
||||
import com.xwad.os.databinding.ActivityLoginBinding;
|
||||
import com.xwad.os.bean.AppInfo;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.databinding.ActivityLoginSuccessfulBinding;
|
||||
import com.xwad.os.jxw.JxwPackageConfig;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
import com.xwad.os.utils.FileUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.functions.Function3;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
public class LoginSuccessfulViewModel extends BaseViewModel<ActivityLoginSuccessfulBinding, ActivityEvent> {
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> mBooleanMutableLiveData = new MutableLiveData<>();
|
||||
|
||||
public void getAppInfo() {
|
||||
Observable.zip(NetInterfaceManager.getInstance().getAdminAppObservable(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME),
|
||||
NetInterfaceManager.getInstance().getAdminAppObservable("com.jxw.download"),
|
||||
NetInterfaceManager.getInstance().getAdminAppObservable("com.study.flashplayer"),
|
||||
new Function3<BaseResponse<AppInfo>, BaseResponse<AppInfo>, BaseResponse<AppInfo>, List<AppInfo>>() {
|
||||
@Override
|
||||
public List<AppInfo> apply(BaseResponse<AppInfo> baseResponse, BaseResponse<AppInfo> baseResponse2, BaseResponse<AppInfo> baseResponse3) throws Throwable {
|
||||
List<AppInfo> appInfos = new ArrayList<>();
|
||||
if (baseResponse.code == 200) {
|
||||
if (!ApkUtils.isAvailable(getCtx(), JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME)) {
|
||||
appInfos.add(baseResponse.data);
|
||||
}
|
||||
}
|
||||
if (baseResponse2.code == 200) {
|
||||
if (!ApkUtils.isAvailable(getCtx(), "com.jxw.download")) {
|
||||
appInfos.add(baseResponse2.data);
|
||||
}
|
||||
}
|
||||
if (baseResponse3.code == 200) {
|
||||
if (!ApkUtils.isAvailable(getCtx(), "com.study.flashplayer")) {
|
||||
appInfos.add(baseResponse3.data);
|
||||
}
|
||||
}
|
||||
return appInfos;
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<AppInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAppInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull List<AppInfo> appInfos) {
|
||||
Log.e("getAppInfo", "onNext: " + appInfos);
|
||||
appInfos.forEach(new Consumer<AppInfo>() {
|
||||
@Override
|
||||
public void accept(AppInfo appInfo) {
|
||||
FileUtils.ariaDownload(getCtx(), appInfo.getApp_url(), appInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAppInfo", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppInfo", "onComplete: ");
|
||||
mBooleanMutableLiveData.setValue(true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ public class PrivacyActivity extends BaseMvvmActivity<PrivacyViewModel, Activity
|
||||
default:
|
||||
case 1:
|
||||
mViewDataBinding.tvTitle.setText("用户协议");
|
||||
mViewDataBinding.webView.loadUrl("https://www.uiuios.com/agreement.html?section=2-1");
|
||||
mViewDataBinding.webView.loadUrl("https://www.uiuios.com/agreement.html?section=4-1&status=1");
|
||||
break;
|
||||
case 2:
|
||||
mViewDataBinding.tvTitle.setText("隐私政策");
|
||||
mViewDataBinding.webView.loadUrl("https://www.uiuios.com/agreement.html?section=2-2");
|
||||
mViewDataBinding.webView.loadUrl("https://www.uiuios.com/agreement.html?section=4-2&status=1");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.xwad.os.activity.update;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
|
||||
import com.arialyy.aria.core.Aria;
|
||||
@@ -59,11 +58,11 @@ public class UpdateActivity extends BaseMvvmActivity<UpdateViewModel, ActivityUp
|
||||
|
||||
public void upgrade(View view) {
|
||||
Intent intent = new Intent(UpdateActivity.this, DownloadService.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(intent);
|
||||
} else {
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// startForegroundService(intent);
|
||||
// } else {
|
||||
startService(intent);
|
||||
}
|
||||
// }
|
||||
if (mAppInfoData != null) {
|
||||
DownloadEntity entity = Aria.download(this).getFirstDownloadEntity(mAppInfoData.getApp_url());
|
||||
if (null != entity) {
|
||||
|
||||
@@ -187,11 +187,7 @@ public class UserActivity extends BaseMvvmActivity<UserViewModel, ActivityUserBi
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (ActivationUtil.getInstance().isLogin()) {
|
||||
mViewModel.getUserAvatarInfo();
|
||||
} else {
|
||||
@@ -199,6 +195,12 @@ public class UserActivity extends BaseMvvmActivity<UserViewModel, ActivityUserBi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
}
|
||||
|
||||
final static int DEBUGCOUNTS = 8;//点击次数
|
||||
final static long DEBUGDURATION = 4 * 1000;//规定有效时间
|
||||
long[] mDEBUGHits = new long[DEBUGCOUNTS];
|
||||
|
||||
@@ -77,6 +77,7 @@ public class SystemSettings implements Serializable {
|
||||
int photo_search_questions;
|
||||
int ai_question_test;
|
||||
int sys_voice_assistant;
|
||||
int app_notify;
|
||||
|
||||
public int getSetting_call() {
|
||||
return setting_call;
|
||||
@@ -582,6 +583,14 @@ public class SystemSettings implements Serializable {
|
||||
this.sys_voice_assistant = sys_voice_assistant;
|
||||
}
|
||||
|
||||
public int getApp_notify() {
|
||||
return app_notify;
|
||||
}
|
||||
|
||||
public void setApp_notify(int app_notify) {
|
||||
this.app_notify = app_notify;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -12,7 +12,7 @@ public class CommonConfig {
|
||||
public static final String isLogined = "isLogined";
|
||||
public static final String AES_KEY = "xqdep8exnafpef3d";
|
||||
|
||||
public static final String LOCK_SCREEN_PASSWORD ="Iflytek_lockScreenPasswordKey";
|
||||
public static final String LOCK_SCREEN_PASSWORD = "Iflytek_lockScreenPasswordKey";
|
||||
public static final String DEFAULT_PASSWORD = "666666";
|
||||
|
||||
public static final String SCREEN_LOCK_PWD = "screen_lock_passwd";
|
||||
@@ -56,7 +56,9 @@ public class CommonConfig {
|
||||
|
||||
public static final String APP_ICON_HIND_SET_KEY = "AppIconHindSet";
|
||||
|
||||
public static final String ShowStatusBarExpandPanel = "ShowStatusBarExpandPanel";
|
||||
|
||||
public static final String ShowNavigationBar = "ShowNavigationBar";
|
||||
|
||||
|
||||
/*让桌面更新定位信息*/
|
||||
@@ -78,7 +80,6 @@ public class CommonConfig {
|
||||
public static final String MAP_BEAN = "MapBean";
|
||||
|
||||
|
||||
public static final String SETTING_OTHER_APPINSTALLER_KEY = "iflytek_setting_other_appInstaller";
|
||||
/*应用市场的app列表*/
|
||||
public final static String ADMIN_APP_LIST = "only_admin_app_list";
|
||||
/*默认地址北京*/
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.xwad.os.adapter.AppAdapter;
|
||||
import com.xwad.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.xwad.os.bean.DesktopIcon;
|
||||
import com.xwad.os.databinding.FragmentAppBinding;
|
||||
import com.xwad.os.fragment.user.UserFragment;
|
||||
import com.xwad.os.view.RecyclerViewSpacesItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -179,15 +180,13 @@ public class AppFragment extends BaseMvvmFragment<AppViewModel, FragmentAppBindi
|
||||
|
||||
private UpdateDesktopReceiver updateDesktopReceiver;
|
||||
|
||||
public static final String UPDATE_DESKTOP_ICON_ACTION = "UPDATE_DESKTOP_ICON";
|
||||
|
||||
private void registerUpdateDesktopReceiver() {
|
||||
if (updateDesktopReceiver == null) {
|
||||
updateDesktopReceiver = new UpdateDesktopReceiver();
|
||||
}
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(UPDATE_DESKTOP_ICON_ACTION);
|
||||
filter.addAction(UserFragment.UPDATE_DESKTOP_ICON_ACTION);
|
||||
mContext.registerReceiver(updateDesktopReceiver, filter);
|
||||
}
|
||||
|
||||
@@ -200,7 +199,7 @@ public class AppFragment extends BaseMvvmFragment<AppViewModel, FragmentAppBindi
|
||||
if (TextUtils.isEmpty(action)) {
|
||||
return;
|
||||
}
|
||||
if (UPDATE_DESKTOP_ICON_ACTION.equals(action)) {
|
||||
if (UserFragment.UPDATE_DESKTOP_ICON_ACTION.equals(action)) {
|
||||
mViewModel.getInstalledAppRx();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,9 +147,11 @@ public class ComplexFragment extends BaseMvvmFragment<ComplexViewModel, Fragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
|
||||
@@ -190,9 +190,6 @@ public class SafeFragment extends BaseMvvmFragment<SafeViewModel, FragmentSafeBi
|
||||
}
|
||||
});
|
||||
|
||||
if (!EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
if (mlistAppInfo != null) {
|
||||
mlistAppInfo.clear();
|
||||
}
|
||||
@@ -214,9 +211,11 @@ public class SafeFragment extends BaseMvvmFragment<SafeViewModel, FragmentSafeBi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -87,6 +87,16 @@ public class AccountFragment extends BaseMvvmFragment<AccountViewModel, Fragment
|
||||
if (vipLevel != null && !TextUtils.isEmpty(vipLevel.getName())) {
|
||||
mViewDataBinding.tvVipName.setText(vipLevel.getName());
|
||||
}
|
||||
if (!ApkUtils.isAvailable(getCtx(), JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME)) {
|
||||
mViewModel.getAppInfo(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME);
|
||||
}
|
||||
if (!ApkUtils.isAvailable(getCtx(), "com.jxw.download")) {
|
||||
mViewModel.getAppInfo("com.jxw.download");
|
||||
}
|
||||
if (!ApkUtils.isAvailable(getCtx(), "com.study.flashplayer")) {
|
||||
mViewModel.getAppInfo("com.study.flashplayer");
|
||||
}
|
||||
mViewModel.getActivation();
|
||||
} else {
|
||||
mViewDataBinding.tvVipName.setText("学王365AI旗舰版");
|
||||
mViewDataBinding.tvVipStatu.setText("点击购买激活");
|
||||
@@ -98,13 +108,13 @@ public class AccountFragment extends BaseMvvmFragment<AccountViewModel, Fragment
|
||||
@Override
|
||||
public void fetchData() {
|
||||
Log.e(TAG, "fetchData: ");
|
||||
mViewModel.getUserInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Log.e(TAG, "onResume: ");
|
||||
mViewModel.getUserInfo();
|
||||
}
|
||||
|
||||
private ActivityResultLauncher<Intent> mLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
|
||||
@@ -115,15 +125,6 @@ public class AccountFragment extends BaseMvvmFragment<AccountViewModel, Fragment
|
||||
Intent intent = result.getData();
|
||||
if (intent != null && result.getResultCode() == Activity.RESULT_OK) {
|
||||
mViewModel.getUserInfo();
|
||||
if (!ApkUtils.isAvailable(mContext, JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME)) {
|
||||
mViewModel.getAppInfo(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME);
|
||||
}
|
||||
if (!ApkUtils.isAvailable(mContext, "com.jxw.download")) {
|
||||
mViewModel.getAppInfo("com.jxw.download");
|
||||
}
|
||||
if (!ApkUtils.isAvailable(mContext, "com.study.flashplayer")) {
|
||||
mViewModel.getAppInfo("com.study.flashplayer");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,12 @@ import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.xwad.os.base.mvvm.BaseViewModel;
|
||||
import com.xwad.os.bean.AppInfo;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.bean.CodeBean;
|
||||
import com.xwad.os.bean.UserInfo;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.databinding.FragmentAccountBinding;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.FileUtils;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
@@ -70,6 +72,39 @@ public class AccountViewModel extends BaseViewModel<FragmentAccountBinding, Frag
|
||||
});
|
||||
}
|
||||
|
||||
public void getActivation() {
|
||||
NetInterfaceManager.getInstance().getActivationCodeControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<CodeBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getActivation", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<CodeBean> baseResponse) {
|
||||
if (baseResponse.code == 200) {
|
||||
CodeBean codeBean = baseResponse.data;
|
||||
mMMKV.encode(CommonConfig.ACTIVATIONBEAN_CODE_KEY, codeBean.getCode());
|
||||
ActivationUtil.getInstance().setActivation(1);
|
||||
ActivationUtil.getInstance().startJxwLauncher();
|
||||
} else {
|
||||
ActivationUtil.getInstance().setActivation(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getActivation", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getActivation", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getAppInfo(String pkg) {
|
||||
NetInterfaceManager.getInstance().getAdminAppObservable(pkg)
|
||||
.subscribe(new Observer<BaseResponse<AppInfo>>() {
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.xwad.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.xwad.os.bean.SnInfo;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.databinding.FragmentInfoBinding;
|
||||
import com.xwad.os.manager.DeviceSNManager;
|
||||
import com.xwad.os.mdm.AdminManager;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
|
||||
@@ -118,12 +117,6 @@ public class InfoFragment extends BaseMvvmFragment<InfoViewModel, FragmentInfoBi
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (ActivationUtil.getInstance().isLogin()) {
|
||||
mViewModel.getSnInfo();
|
||||
} else {
|
||||
@@ -131,6 +124,11 @@ public class InfoFragment extends BaseMvvmFragment<InfoViewModel, FragmentInfoBi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
private void getLocalData() {
|
||||
int gender = mMMKV.decodeInt(CommonConfig.UIUI_USER_GENDER_KEY, 1);
|
||||
if (gender == 1) {
|
||||
|
||||
@@ -152,7 +152,7 @@ public class AppManager {
|
||||
|
||||
Log.e(TAG, "getFilterAppList: " + showPackages);
|
||||
|
||||
List<String> adminApp = getAdminApp();
|
||||
// List<String> adminApp = getAdminApp();
|
||||
// Log.i(TAG, "queryFilterAppInfo: adminapp = " + adminApp);
|
||||
for (ResolveInfo resolveInfo : resolveinfoList) {
|
||||
String pkg = resolveInfo.activityInfo.packageName;
|
||||
@@ -170,9 +170,10 @@ public class AppManager {
|
||||
}
|
||||
} else {
|
||||
if (allowPackages.contains(pkg) && !ApkUtils.excludePackageName.contains(pkg)) {
|
||||
if (adminApp.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
} else if (ApkUtils.showPackageName.contains(pkg)) {
|
||||
// if (adminApp.contains(pkg)) {
|
||||
// resolveInfos.add(resolveInfo);
|
||||
// } else
|
||||
if (ApkUtils.showPackageName.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,16 +311,19 @@ public class ControlManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private void setBar(SystemSettings settings) {
|
||||
//系统导航条显示开关
|
||||
int setting_navigation = settings.getSetting_navigation();
|
||||
Log.e(TAG, "setBar: setting_navigation = " + setting_navigation);
|
||||
AdminManager.getInstance().setStatusBarExpandPanelDisabled(setting_navigation);
|
||||
|
||||
//状态栏显示开关
|
||||
int setting_statusbar = settings.getSetting_statusbar();
|
||||
Log.e(TAG, "setBar: setting_statusbar = " + setting_statusbar);
|
||||
AdminManager.getInstance().setNavigationBarDisabled(setting_statusbar);
|
||||
// //系统导航条显示开关
|
||||
// int setting_navigation = settings.getSetting_navigation();
|
||||
// Log.e(TAG, "setBar: setting_navigation = " + setting_navigation);
|
||||
// mMMKV.encode(CommonConfig.ShowNavigationBar, setting_navigation);
|
||||
// AdminManager.getInstance().setStatusBarExpandPanelDisabled(setting_navigation);
|
||||
//
|
||||
// //状态栏显示开关
|
||||
// int setting_statusbar = settings.getSetting_statusbar();
|
||||
// Log.e(TAG, "setBar: setting_statusbar = " + setting_statusbar);
|
||||
// mMMKV.encode(CommonConfig.ShowStatusBarExpandPanel, setting_statusbar);
|
||||
// AdminManager.getInstance().setNavigationBarDisabled(setting_statusbar);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -802,6 +805,7 @@ public class ControlManager {
|
||||
setDeviceRecover((setting.getIs_device_recover()));
|
||||
setTopNotify(setting.getIs_top_notify());
|
||||
setBottomBar(setting.getIs_bottom_bar());
|
||||
setAppNotify(setting.getApp_notify());
|
||||
}
|
||||
|
||||
public void setBluetoothShare(int status) {
|
||||
@@ -821,14 +825,25 @@ public class ControlManager {
|
||||
|
||||
public void setTopNotify(int status) {
|
||||
Log.e(TAG, "setTopNotify: " + status);
|
||||
mMMKV.encode(CommonConfig.ShowStatusBarExpandPanel, status);
|
||||
AdminManager.getInstance().setStatusBarExpandPanelDisabled(status);
|
||||
}
|
||||
|
||||
public void setBottomBar(int status) {
|
||||
Log.e(TAG, "setBottomBar: " + status);
|
||||
mMMKV.encode(CommonConfig.ShowNavigationBar, status);
|
||||
AdminManager.getInstance().setNavigationBarDisabled(status);
|
||||
}
|
||||
|
||||
public void setAppNotify(int status) {
|
||||
Log.e(TAG, "setAppNotify: " + status);
|
||||
if (status == 0) {
|
||||
Log.e(TAG, "setAppNotify: setNotificationDisabled successful= " + AdminManager.getInstance().setDisallowAppNotification());
|
||||
} else {
|
||||
Log.e(TAG, "setAppNotify: setNotificationDisabled successful = " + AdminManager.getInstance().setAllowAppNotification());
|
||||
}
|
||||
}
|
||||
|
||||
public void setDisallowedRunningApp(SystemSettings setting) {
|
||||
Log.e(TAG, "setDisallowedRunningApp: ");
|
||||
if (setting.getAi_teacher() == 0) {
|
||||
|
||||
@@ -1113,7 +1113,7 @@ public class AdminManager {
|
||||
mDeviceSettingsManager.setNavigationBarDisabled(mAdminName, disable);
|
||||
Log.e(TAG, "isNavigationBarDisabled: " + isNavigationBarDisabled());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setNavigationBarDisabled: " + e.getMessage());
|
||||
Log.e(TAG, "setNavigationBarDisabled: Exception " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1249,8 +1249,9 @@ public class AdminManager {
|
||||
Log.e(TAG, "setStatusBarExpandPanelDisabled: " + disable);
|
||||
try {
|
||||
mDeviceRestrictionManager.setStatusBarExpandPanelDisabled(mAdminName, disable);
|
||||
Log.e(TAG, "isStatusBarExpandPanelDisabled: " + isStatusBarExpandPanelDisabled());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setStatusBarExpandPanelDisabled: " + e.getMessage());
|
||||
Log.e(TAG, "setStatusBarExpandPanelDisabled: Exception " + e.getMessage());
|
||||
}
|
||||
try {
|
||||
//禁用全屏窗口下的状态栏
|
||||
@@ -1781,6 +1782,36 @@ public class AdminManager {
|
||||
}
|
||||
}
|
||||
|
||||
private static final List<String> DEFAULT_ALLOW_NOTIFICATION_APPS = new ArrayList<String>() {{
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
}};
|
||||
|
||||
/**
|
||||
* @param disabled
|
||||
* @return
|
||||
*/
|
||||
public boolean setNotificationDisabled(boolean disabled) {
|
||||
Log.e(TAG, "setNotificationDisabled: " + disabled);
|
||||
try {
|
||||
mDeviceSettingsManager.setNotificationDisabled(mAdminName, disabled);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setNotificationDisabled: " + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean setAllowAppNotification() {
|
||||
Log.e(TAG, "setAllowAppNotification: ");
|
||||
return removeAllAllowNotificationApps();
|
||||
}
|
||||
|
||||
public boolean setDisallowAppNotification() {
|
||||
Log.e(TAG, "setDisallowAppNotification: ");
|
||||
setNotificationDisabled(false);
|
||||
return setAllowNotificationApps(DEFAULT_ALLOW_NOTIFICATION_APPS);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setPowerSaveModeDisabled(boolean disabled) {
|
||||
try {
|
||||
mDeviceHwSystemManager.setPowerSaveModeDisabled(mAdminName, disabled);
|
||||
@@ -2044,12 +2075,12 @@ public class AdminManager {
|
||||
* @param packageNames
|
||||
* @return
|
||||
*/
|
||||
public boolean addAllowNotificationApps(ArrayList<String> packageNames) {
|
||||
Log.e(TAG, "addAllowNotificationApps: " + packageNames);
|
||||
public boolean setAllowNotificationApps(List<String> packageNames) {
|
||||
Log.e(TAG, "setAllowNotificationApps: " + packageNames);
|
||||
try {
|
||||
return mDevicePackageManager.addAllowNotificationApps(mAdminName, packageNames);
|
||||
return mDevicePackageManager.addAllowNotificationApps(mAdminName, new ArrayList<>(packageNames));
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "addAllowNotificationApps: " + e.getMessage());
|
||||
Log.e(TAG, "setAllowNotificationApps: " + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -2069,10 +2100,13 @@ public class AdminManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeAllowNotificationApps() {
|
||||
public boolean removeAllAllowNotificationApps() {
|
||||
try {
|
||||
ArrayList<String> arrayList = getAllowNotificationApps();
|
||||
return mDevicePackageManager.removeAllowNotificationApps(mAdminName, arrayList);
|
||||
Log.e(TAG, "removeAllowNotificationApps: " + arrayList);
|
||||
if (arrayList != null && !arrayList.isEmpty()) {
|
||||
return mDevicePackageManager.removeAllowNotificationApps(mAdminName, arrayList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "removeAllowNotificationApps: " + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import android.util.Log;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xwad.os.BuildConfig;
|
||||
@@ -289,8 +290,9 @@ public class PushManager {
|
||||
/*AI答疑测试*/
|
||||
private static final String AI_QA_TEST = "125";
|
||||
/*语音助手*/
|
||||
private static final String Voice_assistant = "126";
|
||||
|
||||
private static final String VOICE_ASSISTANT = "126";
|
||||
/*APP应用通知管控*/
|
||||
private static final String APP_NOTIFY_SETTING = "127";
|
||||
|
||||
public void setPushContent(String title, String extras) {
|
||||
switch (title) {
|
||||
@@ -341,6 +343,9 @@ public class PushManager {
|
||||
Toaster.debugShow("收到推送消息: 清除应用缓存");
|
||||
cleanAppCache(extras);
|
||||
break;
|
||||
case SHOW_THIRD_APP:
|
||||
showThirdApp(extras);
|
||||
break;
|
||||
case ALARM_CLOCK:
|
||||
Toaster.debugShow("收到推送消息: 设置闹钟");
|
||||
sendAlarmClock(extras);
|
||||
@@ -410,13 +415,27 @@ public class PushManager {
|
||||
case AI_QA_TEST:
|
||||
setAiQuestionTest(extras);
|
||||
break;
|
||||
case Voice_assistant:
|
||||
case VOICE_ASSISTANT:
|
||||
setVoiceAssistant(extras);
|
||||
break;
|
||||
case APP_NOTIFY_SETTING:
|
||||
setAppNotify(extras);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
private void setAppNotify(String extras) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||
JsonElement jsonElement = jsonObject.get("app_notify");
|
||||
if (jsonElement == null || jsonElement.isJsonNull()) {
|
||||
Log.e(TAG, "setAppNotify: jsonElement is null");
|
||||
return;
|
||||
}
|
||||
int app_notify = jsonElement.getAsInt();
|
||||
ControlManager.getInstance().setAppNotify(app_notify);
|
||||
}
|
||||
|
||||
private void setVoiceAssistant(String extras) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||
JsonElement jsonElement = jsonObject.get("sys_voice_assistant");
|
||||
@@ -836,6 +855,15 @@ public class PushManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void showThirdApp(String extras) {
|
||||
JsonObject jsonObject = JsonParser.parseString(extras).getAsJsonObject();
|
||||
int setting_admin_app = jsonObject.get("setting_other_appInstaller").getAsInt();
|
||||
mMMKV.encode(CommonConfig.APP_INSTALLATION, setting_admin_app);
|
||||
Intent intent = new Intent(UserFragment.UPDATE_DESKTOP_ICON_ACTION);
|
||||
mContext.sendBroadcast(intent);
|
||||
|
||||
}
|
||||
|
||||
private void sendZyosRefreshIntent() {
|
||||
Intent intent = new Intent(UserFragment.ACTION_REFRESH_BINDING_STATUS);
|
||||
intent.setPackage("com.uiui.zyos");
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.xwad.os.R;
|
||||
import com.xwad.os.bean.AriaDownloadInfo;
|
||||
import com.xwad.os.mdm.AdminManager;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -47,10 +46,10 @@ public class DownloadService extends Service {
|
||||
Aria.download(this).register();
|
||||
|
||||
|
||||
mNotificationManagerCompat = NotificationManagerCompat.from(this);
|
||||
createNotificationChannel();
|
||||
createDownloadNotificationChannel();
|
||||
sendSimpleNotification();
|
||||
// mNotificationManagerCompat = NotificationManagerCompat.from(this);
|
||||
// createNotificationChannel();
|
||||
// createDownloadNotificationChannel();
|
||||
// sendSimpleNotification();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,7 +197,7 @@ public class DownloadService extends Service {
|
||||
AriaDownloadInfo ariaDownloadInfo = getAriaDownloadInfo(jsonString);
|
||||
if (ariaDownloadInfo != null) {
|
||||
Toaster.show("正在下载: " + ariaDownloadInfo.getAppName() + "\t" + task.getPercent() + "%");
|
||||
sendDownloadRunning(ariaDownloadInfo, task.getPercent());
|
||||
// sendDownloadRunning(ariaDownloadInfo, task.getPercent());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +210,7 @@ public class DownloadService extends Service {
|
||||
AriaDownloadInfo ariaDownloadInfo = getAriaDownloadInfo(jsonString);
|
||||
if (ariaDownloadInfo != null) {
|
||||
Toaster.show("下载完成: " + "\t" + ariaDownloadInfo.getAppName());
|
||||
sendDownloadComplete(ariaDownloadInfo, task.getFilePath());
|
||||
// sendDownloadComplete(ariaDownloadInfo, task.getFilePath());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +222,7 @@ public class DownloadService extends Service {
|
||||
AriaDownloadInfo ariaDownloadInfo = getAriaDownloadInfo(jsonString);
|
||||
if (ariaDownloadInfo != null) {
|
||||
Toaster.show("下载失败: " + "\t" + ariaDownloadInfo.getAppName());
|
||||
sendDownloadFail(ariaDownloadInfo);
|
||||
// sendDownloadFail(ariaDownloadInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -333,6 +333,7 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta
|
||||
public static final String LOCK_STATE = "SCRENN_LOOCKED_STATE";
|
||||
|
||||
private void showFloatingWindow(String name) {
|
||||
Log.e(TAG, "showFloatingWindow: ");
|
||||
AdminManager.getInstance().setStatusBarExpandPanelDisabled(true);
|
||||
AdminManager.getInstance().setNavigationBarDisabled(true);
|
||||
if (Settings.canDrawOverlays(this)) {
|
||||
@@ -532,9 +533,11 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta
|
||||
}
|
||||
|
||||
private void hideFloatingWindow() {
|
||||
|
||||
AdminManager.getInstance().setStatusBarExpandPanelDisabled(false);
|
||||
AdminManager.getInstance().setNavigationBarDisabled(false);
|
||||
Log.e(TAG, "hideFloatingWindow: ");
|
||||
int is_top_notify = mMMKV.decodeInt(CommonConfig.ShowStatusBarExpandPanel, 1);
|
||||
AdminManager.getInstance().setStatusBarExpandPanelDisabled(is_top_notify == 0);
|
||||
int is_bottom_bar = mMMKV.decodeInt(CommonConfig.ShowNavigationBar, 1);
|
||||
AdminManager.getInstance().setNavigationBarDisabled(is_bottom_bar == 0);
|
||||
|
||||
if (null == windowManager) {
|
||||
return;
|
||||
|
||||
@@ -165,6 +165,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Log.e(TAG, "onDestroy: ");
|
||||
NetworkUtils.unregisterNetworkStatusChangedListener(this);
|
||||
dispose();
|
||||
closeOnlineConnect();
|
||||
@@ -176,6 +177,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
||||
}
|
||||
|
||||
private void dispose() {
|
||||
Log.e(TAG, "dispose: ");
|
||||
if (mOnlineDisposable != null && !mOnlineDisposable.isDisposed()) {
|
||||
mOnlineDisposable.dispose();
|
||||
mOnlineDisposable = null;
|
||||
|
||||
@@ -5,15 +5,21 @@ import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.xwad.os.bean.AppInfo;
|
||||
import com.xwad.os.bean.BaseResponse;
|
||||
import com.xwad.os.bean.UserInfo;
|
||||
import com.xwad.os.config.CommonConfig;
|
||||
import com.xwad.os.gson.GsonUtils;
|
||||
import com.xwad.os.jxw.JxwPackageConfig;
|
||||
import com.xwad.os.network.NetInterfaceManager;
|
||||
import com.xwad.os.service.ManagerService;
|
||||
import com.xwad.os.utils.ActivationUtil;
|
||||
import com.xwad.os.utils.ApkUtils;
|
||||
import com.xwad.os.utils.FileUtils;
|
||||
import com.xwad.os.utils.ServiceAliveUtils;
|
||||
import com.xwad.os.utils.Utils;
|
||||
|
||||
@@ -93,7 +99,79 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getSnInfo() {
|
||||
NetInterfaceManager.getInstance().getUserInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<UserInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getUserInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<UserInfo> userInfoBaseResponse) {
|
||||
Log.e("getUserInfo", "onNext: " + userInfoBaseResponse);
|
||||
if (userInfoBaseResponse.code == 200) {
|
||||
UserInfo userInfo = userInfoBaseResponse.data;
|
||||
int vip_level_id = userInfo.getVip_level_id();
|
||||
if (vip_level_id != 0) {
|
||||
if (!ApkUtils.isAvailable(mContext, JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME)) {
|
||||
getAppInfo(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME);
|
||||
}
|
||||
if (!ApkUtils.isAvailable(mContext, "com.jxw.download")) {
|
||||
getAppInfo("com.jxw.download");
|
||||
}
|
||||
if (!ApkUtils.isAvailable(mContext, "com.study.flashplayer")) {
|
||||
getAppInfo("com.study.flashplayer");
|
||||
}
|
||||
}
|
||||
|
||||
} else if (userInfoBaseResponse.code == 401) {
|
||||
ActivationUtil.getInstance().setActivation(0);
|
||||
mMMKV.encode(CommonConfig.ACCOUNT_LOGIN_STATU, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getUserInfo", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getUserInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getAppInfo(String pkg) {
|
||||
NetInterfaceManager.getInstance().getAdminAppObservable(pkg)
|
||||
.subscribe(new Observer<BaseResponse<AppInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAppInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<AppInfo> baseResponse) {
|
||||
Log.e("getAppInfo", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
AppInfo appInfo = baseResponse.data;
|
||||
FileUtils.ariaDownload(mContext, appInfo.getApp_url(), appInfo);
|
||||
} else {
|
||||
Toaster.showLong("没有找到应用信息,请联系客服");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAppInfo", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -81,7 +81,6 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
|
||||
|
||||
mNotificationManagerCompat = NotificationManagerCompat.from(this);
|
||||
createNotificationChannel();
|
||||
// showNotification();
|
||||
sendSimpleNotification();
|
||||
|
||||
startService(new Intent(MainService.this, SocketService.class));
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
@@ -122,7 +123,12 @@ public class ActivationUtil {
|
||||
}
|
||||
|
||||
public void startJxwLauncher() {
|
||||
if (!ApkUtils.isAvailable(mContext, JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME)) {
|
||||
Log.e(TAG, "startJxwLauncher: jxw app not install");
|
||||
return;
|
||||
}
|
||||
String code = getActivationCode();
|
||||
Log.e(TAG, "startJxwLauncher: code is null = " + TextUtils.isEmpty(code));
|
||||
boolean regist_success = mMMKV.decodeBool(MainService.JXW_REGISTER_SUCCESS, false);
|
||||
if (!regist_success) {
|
||||
Intent intent = new Intent("UIUI_ACTIVATION");
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.TextUtils;
|
||||
@@ -289,11 +288,11 @@ public class FileUtils {
|
||||
.create(); //启动下载}
|
||||
}
|
||||
Intent intent = new Intent(context, DownloadService.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
context.startForegroundService(intent);
|
||||
} else {
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// context.startForegroundService(intent);
|
||||
// } else {
|
||||
context.startService(intent);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public static void ariaDownloadTestPaper(Context context, String url, HomeworkBean homeworkBean) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.app.role.RoleManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
@@ -21,7 +20,6 @@ import android.media.AudioManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.PowerManager;
|
||||
@@ -206,18 +204,6 @@ public class JgyUtils {
|
||||
return value;
|
||||
}
|
||||
|
||||
private int getBatteryLevel() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
BatteryManager batteryManager = (BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE);
|
||||
return batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
|
||||
} else {
|
||||
Intent intent = new ContextWrapper(mContext).registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||
return (intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1) * 100) /
|
||||
intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private PowerManager.WakeLock wakeLock = null;
|
||||
private static final String mWakeLockName = "BackupService";
|
||||
|
||||
@@ -1296,15 +1282,15 @@ public class JgyUtils {
|
||||
Log.e(TAG, "startServices: ");
|
||||
boolean noti = mMMKV.decodeBool(CommonConfig.ALLOW_NOTIFICATION, true);
|
||||
Log.e(TAG, "startServices: noti = " + noti);
|
||||
if (noti) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
long time = System.currentTimeMillis();
|
||||
mContext.startForegroundService(new Intent(mContext, MainService.class));
|
||||
Log.e(TAG, "setDefault: startServices time = " + (System.currentTimeMillis() - time) + "ms");
|
||||
} else {
|
||||
// if (noti) {
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// long time = System.currentTimeMillis();
|
||||
// mContext.startForegroundService(new Intent(mContext, MainService.class));
|
||||
// Log.e(TAG, "setDefault: startServices time = " + (System.currentTimeMillis() - time) + "ms");
|
||||
// } else {
|
||||
mContext.startService(new Intent(mContext, MainService.class));
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private Set<String> mJxwApps = new HashSet<String>() {{
|
||||
|
||||
@@ -879,11 +879,11 @@ public class OpenApkUtils {
|
||||
public void onClick(View view) {
|
||||
getAppInfo(pkg);
|
||||
Intent intent = new Intent(mContext, DownloadService.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mContext.startForegroundService(intent);
|
||||
} else {
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// mContext.startForegroundService(intent);
|
||||
// } else {
|
||||
mContext.startService(intent);
|
||||
}
|
||||
// }
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -404,21 +404,6 @@ public class Utils {
|
||||
return batteryCapacity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电量
|
||||
*
|
||||
* @param mContext
|
||||
* @return
|
||||
*/
|
||||
synchronized public static int getBatteryLevel(Context mContext) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
return ((BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE)).getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
|
||||
} else {
|
||||
Intent intent = (new ContextWrapper(mContext)).registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||
return intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0) * 100 / intent.getIntExtra(BatteryManager.EXTRA_SCALE, 100);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDownLoadPath(Context context) {
|
||||
String path = ContextCompat.getExternalFilesDirs(context, Environment.DIRECTORY_DOWNLOADS)[0].getAbsolutePath();
|
||||
return path + File.separator;
|
||||
@@ -833,13 +818,14 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static int getBattery(Context context) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
BatteryManager batteryManager = (BatteryManager) context.getSystemService(Context.BATTERY_SERVICE);
|
||||
return batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
|
||||
} catch (Exception e) {
|
||||
Log.e("getBattery", "getBattery" + e.getMessage());
|
||||
} else {
|
||||
Intent intent = new ContextWrapper(context).registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||
return (intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1) * 100) /
|
||||
intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getIsCharging(Context context) {
|
||||
|
||||
@@ -40,6 +40,7 @@ public class ImageViewAdapter {
|
||||
Glide.with(imageView.getContext())
|
||||
.load(url)
|
||||
.error(error)
|
||||
.placeholder(imageView.getDrawable())
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user