version:1.5.1018
bugfixes: add:替换图标,优化网络连接
@@ -29,8 +29,8 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.aoleyun.sn"
|
||||
versionCode 192
|
||||
versionName "1.5.0821"
|
||||
versionCode 197
|
||||
versionName "1.5.1018"
|
||||
|
||||
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
|
||||
minSdkVersion 24
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
<!-- 允许访问振动设备 -->
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<!-- 允许使用PowerManager的 WakeLocks保持进程在休眠时从屏幕消失 -->
|
||||
<!-- <uses-permission android:name="android.permission.WAKE_LOCK" />-->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<!-- 允许程序读取或写入系统设置 -->
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<!-- android 9.0上使用前台服务,需要添加权限 -->
|
||||
@@ -222,9 +222,18 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.update.AppUpdateActivity"
|
||||
android:theme="@style/DialogCloseOnTouchOutside" />
|
||||
<activity
|
||||
android:name=".activity.requestlog.RequestLogActivity"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name=".activity.AudioActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/DialogCloseOnTouchOutside" />
|
||||
|
||||
|
||||
<service
|
||||
android:name=".service.main.MainService"
|
||||
|
||||
160
app/src/main/java/com/aoleyun/sn/activity/AudioActivity.java
Normal file
@@ -0,0 +1,160 @@
|
||||
package com.aoleyun.sn.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.PowerManager;
|
||||
import android.os.Vibrator;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.base.BaseDataBindingActivity;
|
||||
import com.aoleyun.sn.databinding.ActivityAudioBinding;
|
||||
import com.aoleyun.sn.utils.WakeUpUtils;
|
||||
|
||||
public class AudioActivity extends BaseDataBindingActivity {
|
||||
private static final String TAG = "AudioActivity";
|
||||
|
||||
private ActivityAudioBinding mBinding;
|
||||
|
||||
private PowerManager pm;
|
||||
private PowerManager.WakeLock wakeLock;
|
||||
private AudioManager audioManager;
|
||||
private Vibrator vibrator;
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_audio);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
mBinding.tvStop.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
releasePlayer();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
wakeLock = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_DIM_WAKE_LOCK, "WakeAndLock");
|
||||
wakeLock.acquire(60 * 1000L);
|
||||
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (vibrator.hasVibrator()) {
|
||||
long[] pattern = {1000, 5000, 1000, 5000};
|
||||
vibrator.vibrate(pattern, 0);
|
||||
} else {
|
||||
Log.e(TAG, "initView: no vibrator");
|
||||
}
|
||||
WakeUpUtils.wakeUpAndUnlockScreen(this);
|
||||
setMaxVolume();
|
||||
defaultCallMediaPlayer();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
Log.e(TAG, "onNewIntent: " + intent.getAction());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
vibrator.cancel();
|
||||
releasePlayer();
|
||||
mediaPlayer = null;
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private void releasePlayer() {
|
||||
try {
|
||||
if (mediaPlayer != null) {
|
||||
if (mediaPlayer.isPlaying()) {
|
||||
mediaPlayer.stop();
|
||||
}
|
||||
mediaPlayer.release();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "releasePlayer: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 播放系统默认来电铃声
|
||||
*
|
||||
* @return MediaPlayer对象
|
||||
* @throws Exception
|
||||
*/
|
||||
MediaPlayer mediaPlayer;
|
||||
|
||||
public void defaultCallMediaPlayer() {
|
||||
if (mediaPlayer != null) {
|
||||
if (mediaPlayer.isPlaying()) {
|
||||
mediaPlayer.stop();
|
||||
}
|
||||
mediaPlayer.release();
|
||||
}
|
||||
mediaPlayer = MediaPlayer.create(this, R.raw.test);
|
||||
try {
|
||||
// mediaPlayer.prepare();
|
||||
mediaPlayer.setLooping(false);
|
||||
int duration = mediaPlayer.getDuration() / 1000;
|
||||
Log.e(TAG, "defaultCallMediaPlayer: " + "duration: " + duration);
|
||||
int loop = 0;
|
||||
if (duration <= 1) {
|
||||
loop = 30;
|
||||
} else {
|
||||
loop = (30 / duration);
|
||||
}
|
||||
final int[] soundCount = {0};
|
||||
int finalLoop = loop;
|
||||
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
||||
@Override
|
||||
public void onCompletion(MediaPlayer mediaPlayer) {
|
||||
if (soundCount[0] <= finalLoop) {
|
||||
setMaxVolume();
|
||||
mediaPlayer.start();
|
||||
soundCount[0] += 1;
|
||||
Log.e(TAG, "onCompletion: " + "loop: " + finalLoop);
|
||||
Log.e(TAG, "onCompletion: " + "soundCount: " + soundCount[0]);
|
||||
} else {
|
||||
if (mediaPlayer.isPlaying()) {
|
||||
mediaPlayer.stop();
|
||||
}
|
||||
mediaPlayer.release();
|
||||
Log.e(TAG, "onCompletion: " + "loop: " + finalLoop);
|
||||
Log.e(TAG, "onCompletion: " + "soundCount: " + soundCount[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
mediaPlayer.setLooping(false);
|
||||
mediaPlayer.start();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "defaultCallMediaPlayer: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void setMaxVolume() {
|
||||
if (BuildConfig.DEBUG) {
|
||||
return;
|
||||
}
|
||||
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||
int ringMax = audioManager.getStreamMaxVolume(AudioManager.STREAM_RING);
|
||||
int musicMax = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
||||
int voiceMax = audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL);
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_RING, ringMax, 0);
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, voiceMax, 0);
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, musicMax, 0); //音乐音量
|
||||
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
audioManager.setSpeakerphoneOn(true);
|
||||
}
|
||||
}
|
||||
@@ -217,7 +217,7 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
|
||||
|
||||
} else {
|
||||
int aihuaUnlock = Settings.System.getInt(getCtx().getContentResolver(), CommonConfig.AIHUA_UNLOCK, 0);
|
||||
if (JgyUtils.getInstance().isAihuaFramwwork() && aihuaUnlock == 1) {
|
||||
if (JgyUtils.getInstance().isAihuaFramework() && aihuaUnlock == 1) {
|
||||
Log.e(TAG, "getDefaultDesktop: " + "Device aihua");
|
||||
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.aoleyun.sn.activity.update;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.base.mvvm.BaseMvvmActivity;
|
||||
import com.aoleyun.sn.bean.AppUpdateInfo;
|
||||
import com.aoleyun.sn.databinding.ActivityAppUpdateBinding;
|
||||
import com.aoleyun.sn.gson.GsonUtils;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.hjq.toast.Toaster;
|
||||
|
||||
import static com.arialyy.aria.core.inf.IEntity.STATE_RUNNING;
|
||||
|
||||
public class AppUpdateActivity extends BaseMvvmActivity<AppUpdateViewModel, ActivityAppUpdateBinding> {
|
||||
|
||||
private AppUpdateInfo mAppInfoData;
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_app_update;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mViewModel.setCtx(this);
|
||||
mViewModel.setLifecycle(getLifecycleSubject());
|
||||
mViewModel.setVDBinding(mViewDataBinding);
|
||||
mViewDataBinding.setClick(new BtnClick());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
Intent intent = getIntent();
|
||||
mAppInfoData = (AppUpdateInfo) intent.getSerializableExtra("appUpdateInfo");
|
||||
if (mAppInfoData != null) {
|
||||
mViewDataBinding.setAppInfo(mAppInfoData);
|
||||
mViewDataBinding.setMsg("检测到新版本,是否更新");
|
||||
String pkg = mAppInfoData.getPackages();
|
||||
switch (pkg) {
|
||||
case "com.aoleyun.os":
|
||||
mViewDataBinding.ivAppIcon.setImageDrawable(getDrawable(R.drawable.com_aoleyun_os));
|
||||
break;
|
||||
case "com.aoleyun.appstore":
|
||||
mViewDataBinding.ivAppIcon.setImageDrawable(getDrawable(R.drawable.com_aoleyun_appstore));
|
||||
break;
|
||||
case "com.aoleyun.browser":
|
||||
mViewDataBinding.ivAppIcon.setImageDrawable(getDrawable(R.drawable.com_aoleyun_browser));
|
||||
break;
|
||||
case "com.aoleyun.ailog":
|
||||
mViewDataBinding.ivAppIcon.setImageDrawable(getDrawable(R.drawable.com_aoleyun_ailog));
|
||||
break;
|
||||
default:
|
||||
case BuildConfig.APPLICATION_ID:
|
||||
mViewDataBinding.ivAppIcon.setImageDrawable(getDrawable(R.mipmap.ic_launcher));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class BtnClick {
|
||||
public void empty(View view) {
|
||||
|
||||
}
|
||||
|
||||
public void exit(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
public void upgrade(View view) {
|
||||
startService(new Intent(AppUpdateActivity.this, MainService.class));
|
||||
|
||||
if (mAppInfoData != null) {
|
||||
DownloadEntity entity = Aria.download(this).getFirstDownloadEntity(mAppInfoData.getUrl());
|
||||
if (null != entity) {
|
||||
if (entity.isComplete()) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(new Gson().toJson(mAppInfoData));
|
||||
Utils.ariaDownload(AppUpdateActivity.this, mAppInfoData.getUrl(), jsonObject);
|
||||
} else {
|
||||
if (entity.getState() == STATE_RUNNING) {
|
||||
Toaster.show("文件正在下载中");
|
||||
finish();
|
||||
} else {
|
||||
Aria.download(this).resumeAllTask();
|
||||
Toaster.show("正在下载");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(new Gson().toJson(mAppInfoData));
|
||||
Utils.ariaDownload(AppUpdateActivity.this, mAppInfoData.getUrl(), jsonObject);
|
||||
Toaster.show("正在下载更新");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.aoleyun.sn.activity.update;
|
||||
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.aoleyun.sn.base.mvvm.BaseViewModel;
|
||||
import com.aoleyun.sn.databinding.ActivityAppUpdateBinding;
|
||||
|
||||
public class AppUpdateViewModel extends BaseViewModel<ActivityAppUpdateBinding, ActivityEvent> {
|
||||
|
||||
@Override
|
||||
public ActivityAppUpdateBinding getVDBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ public class AppUpdateInfo implements Serializable {
|
||||
@SerializedName("package")
|
||||
String packages;
|
||||
String app_md5;
|
||||
int is_forcedown;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
@@ -74,6 +75,14 @@ public class AppUpdateInfo implements Serializable {
|
||||
this.app_md5 = app_md5;
|
||||
}
|
||||
|
||||
public int getIs_forcedown() {
|
||||
return is_forcedown;
|
||||
}
|
||||
|
||||
public void setIs_forcedown(int is_forcedown) {
|
||||
this.is_forcedown = is_forcedown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||
|
||||
@@ -8,6 +8,10 @@ public class CommonConfig {
|
||||
|
||||
public static final String DEFAULT_DESKTOP_PACKAGE = "default_desktop_package_key";
|
||||
|
||||
/**
|
||||
* 设备重启标志 重启后请求接口,Service重启不请求
|
||||
*/
|
||||
public final static String DEVICES_REBOOT = "device_reboot_mark";
|
||||
/*爱华解锁标识*/
|
||||
public final static String AIHUA_UNLOCK = "Aihua_unlock_state";
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.alibaba.sdk.android.push.CloudPushService;
|
||||
import com.alibaba.sdk.android.push.CommonCallback;
|
||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.activity.update.AppUpdateActivity;
|
||||
import com.aoleyun.sn.base.BaseApplication;
|
||||
import com.aoleyun.sn.bean.AdminAppInfo;
|
||||
import com.aoleyun.sn.bean.AppAttr;
|
||||
@@ -1004,10 +1005,11 @@ public class NetInterfaceManager {
|
||||
Log.e("checkAoleyunUpdate", "onNext: " + jsonString);
|
||||
if (appUpdateInfos != null && appUpdateInfos.size() != 0) {
|
||||
cacheHelper.put(UrlAddress.CHECK_UPDATE, jsonString);
|
||||
for (AppUpdateInfo info : appUpdateInfos) {
|
||||
JsonObject jsonObject = parseString(new Gson().toJson(info)).getAsJsonObject();
|
||||
JgyUtils.getInstance().installAPK(jsonObject);
|
||||
}
|
||||
// for (AppUpdateInfo info : appUpdateInfos) {
|
||||
// JsonObject jsonObject = parseString(new Gson().toJson(info)).getAsJsonObject();
|
||||
// JgyUtils.getInstance().installAPK(jsonObject);
|
||||
// }
|
||||
getAllAppUpdate(appUpdateInfos);
|
||||
} else {
|
||||
cacheHelper.put(UrlAddress.CHECK_UPDATE, "");
|
||||
}
|
||||
@@ -1027,6 +1029,59 @@ public class NetInterfaceManager {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param appInfos 获取所有app直接更新
|
||||
*/
|
||||
public void getAllAppUpdate(List<AppUpdateInfo> appInfos) {
|
||||
if (appInfos == null || appInfos.size() == 0) {
|
||||
return;
|
||||
}
|
||||
HashMap<String, AppUpdateInfo> appInfoHashMap = new HashMap<>();
|
||||
for (AppUpdateInfo appInfo : appInfos) {
|
||||
if (appInfo == null) continue;
|
||||
appInfoHashMap.put(appInfo.getPackages(), appInfo);
|
||||
}
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
for (Map.Entry<String, AppUpdateInfo> entry : appInfoHashMap.entrySet()) {
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
packageInfo = pm.getPackageInfo(entry.getKey(), 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (entry.getValue() != null) {
|
||||
if (packageInfo == null) {
|
||||
//未安装
|
||||
String s = new Gson().toJson(entry.getValue());
|
||||
Log.e(TAG, "getAllAppUpdate: " + s);
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(s);
|
||||
Utils.ariaDownload(mContext, entry.getValue().getUrl(), jsonObject);
|
||||
} else {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = packageInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = packageInfo.versionCode;
|
||||
}
|
||||
long versionCode = entry.getValue().getVersion_code();
|
||||
//版本升级
|
||||
if (appVersionCode < versionCode) {
|
||||
int is_forcedown = entry.getValue().getIs_forcedown();
|
||||
if (is_forcedown == 1) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(new Gson().toJson(entry.getValue()));
|
||||
Utils.ariaDownload(mContext, entry.getValue().getUrl(), jsonObject);
|
||||
} else {
|
||||
Intent intent = new Intent(mContext, AppUpdateActivity.class);
|
||||
intent.putExtra("appUpdateInfo", entry.getValue());
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface UpdateCallback {
|
||||
void onUpdate(List<AppUpdateInfo> appUpdateInfos);
|
||||
}
|
||||
@@ -2582,10 +2637,10 @@ public class NetInterfaceManager {
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
if (response.code == OK) {
|
||||
cacheHelper.put(UrlAddress.SEND_DEVICES, macJson);
|
||||
Log.e("sendMACAddress", response.msg);
|
||||
Log.e("sendMACAddress", "onNext: " + response.msg);
|
||||
SPUtils.put(mContext, "macJson", macJson);
|
||||
} else {
|
||||
Log.e("sendMACAddress", response.toString());
|
||||
Log.e("sendMACAddress", "onNext: " + response.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.view.Gravity;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.activity.AudioActivity;
|
||||
import com.aoleyun.sn.activity.main.MainActivity;
|
||||
import com.aoleyun.sn.bean.ApkInfoPush;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
@@ -1171,8 +1172,10 @@ public class PushManager {
|
||||
}
|
||||
|
||||
private void playSound(String extras) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||
defaultCallMediaPlayer(mContext);
|
||||
// defaultCallMediaPlayer(mContext);
|
||||
Intent intent = new Intent(mContext, AudioActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,7 @@ import io.reactivex.rxjava3.disposables.Disposable;
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
private static String TAG = "BootReceiver" + ":aoleyunsn";
|
||||
public static final String BOOT_COMPLETED = "aoleyun.intent.action.BOOT_COMPLETED";
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
static {
|
||||
getLockedState();
|
||||
@@ -74,7 +75,8 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
default:
|
||||
break;
|
||||
case Intent.ACTION_BOOT_COMPLETED:
|
||||
MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE).encode(ConnectManager.REBOOT_LAST_ONNECT_TIME, System.currentTimeMillis());
|
||||
mMMKV.encode(CommonConfig.DEVICES_REBOOT, true);
|
||||
mMMKV.encode(ConnectManager.REBOOT_LAST_ONNECT_TIME, System.currentTimeMillis());
|
||||
if ((int) SPUtils.get(context, CommonConfig.FIRST_STARTUP, 0) == 0) {
|
||||
LogDBManager.getInstance().creatRebootLog("首次启动", TimeUtils.transferLongToDate(System.currentTimeMillis()));
|
||||
SPUtils.put(context, CommonConfig.FIRST_STARTUP, 1);
|
||||
|
||||
@@ -86,7 +86,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
@Override
|
||||
public void getLockedState() {
|
||||
Log.e(TAG, "getLockedState: ");
|
||||
if (JgyUtils.getInstance().isAihuaFramwwork()) {
|
||||
if (JgyUtils.getInstance().isAihuaFramework()) {
|
||||
int aihuaUnlock = Settings.System.getInt(mContext.getContentResolver(), CommonConfig.AIHUA_UNLOCK, 0);
|
||||
if (aihuaUnlock == 1) {
|
||||
return;
|
||||
@@ -235,14 +235,14 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
if (JgyUtils.isOfficialVersion()) {
|
||||
mView.updateDeviceInfoFinish();
|
||||
}
|
||||
if (!JgyUtils.getInstance().tagEmpty()) {
|
||||
// if (!JgyUtils.getInstance().tagEmpty()) {
|
||||
NetInterfaceManager.getInstance().updateDeviceInfo(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.updateDeviceInfoFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -250,14 +250,14 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
*/
|
||||
@Override
|
||||
public void sendInstalled() {
|
||||
if (!JgyUtils.getInstance().tagEmpty()) {
|
||||
// if (!JgyUtils.getInstance().tagEmpty()) {
|
||||
NetInterfaceManager.getInstance().sendInstalledAppInfo(new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.sendInstalledFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -375,7 +375,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
mView.getDefaultDesktopFinish();
|
||||
} else {
|
||||
int aihuaUnlock = Settings.System.getInt(mContext.getContentResolver(), CommonConfig.AIHUA_UNLOCK, 0);
|
||||
if (JgyUtils.getInstance().isAihuaFramwwork() && aihuaUnlock == 1) {
|
||||
if (JgyUtils.getInstance().isAihuaFramework() && aihuaUnlock == 1) {
|
||||
Log.e(TAG, "getDefaultDesktop: " + "Device aihua");
|
||||
mView.getDefaultDesktopFinish();
|
||||
} else {
|
||||
|
||||
@@ -108,14 +108,14 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
String WiFiAlias = Utils.getWifiAlias(this);
|
||||
Log.e("OnNetworkStatusChanged", "onConnected: " + WiFiAlias);
|
||||
JgyUtils.getInstance().addNetworkConnectedTime(System.currentTimeMillis() / 1000);
|
||||
mPresenter.sendNetwork(JgyUtils.getInstance().getNetworkConnectedTime());
|
||||
if (JgyUtils.getInstance().isScreenOn()) {
|
||||
TimeTask task = new TimeTask();
|
||||
task.execute("ntp.aliyun.com");
|
||||
if (!checkAoleyunApp()) {
|
||||
mPresenter.checkAoleyunUpdate();
|
||||
}
|
||||
mPresenter.sendNetwork(JgyUtils.getInstance().getNetworkConnectedTime());
|
||||
mPresenter.getLockedState();
|
||||
mInternetConnected.onConnected(WiFiAlias);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +186,49 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
});
|
||||
}
|
||||
|
||||
private static KillAppListener killAppListener;
|
||||
private InternetConnected mInternetConnected;
|
||||
|
||||
public interface InternetConnected {
|
||||
void onConnected(String alias);
|
||||
}
|
||||
|
||||
private final ObservableOnSubscribe<String> networkSubscribe = new ObservableOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter emitter) throws Exception {
|
||||
mInternetConnected = new InternetConnected() {
|
||||
@Override
|
||||
public void onConnected(String alias) {
|
||||
Log.e(TAG, "networkSubscribe: onConnected " + alias);
|
||||
emitter.onNext(alias);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
private Observer<String> networkObserver = new Observer<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("networkObserver", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String action) {
|
||||
Log.e("networkObserver", "onNext: " + action);
|
||||
mPresenter.getLockedState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("networkObserver", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("networkObserver", "onComplete: ");
|
||||
}
|
||||
};
|
||||
|
||||
private KillAppListener killAppListener;
|
||||
|
||||
public interface KillAppListener {
|
||||
void killApp(String action);
|
||||
@@ -217,6 +259,10 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
JgyUtils.getInstance().killPackage(PackageNames.NOTIFICATIONS);
|
||||
JgyUtils.getInstance().killPackage(PackageNames.BROWSER);
|
||||
JgyUtils.getInstance().killPackage(PackageNames.AILOG);
|
||||
JgyUtils.getInstance().killPackage("com.jxw.launcher");
|
||||
JgyUtils.getInstance().killPackage("com.jxw.newyouer.video");
|
||||
JgyUtils.getInstance().killPackage("com.jxw.mskt.video");
|
||||
|
||||
// JgyUtils.getInstance().killPackage("com.ygyb.yischool");
|
||||
}
|
||||
|
||||
@@ -446,7 +492,14 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
TimeTask task = new TimeTask();
|
||||
task.execute("ntp.aliyun.com");
|
||||
|
||||
boolean reboot = mMMKV.decodeBool(CommonConfig.DEVICES_REBOOT, false);
|
||||
if (reboot) {
|
||||
mPresenter.getLockedState();
|
||||
mMMKV.encode(CommonConfig.DEVICES_REBOOT, false);
|
||||
Log.e(TAG, "onCreate: device rebooted");
|
||||
} else {
|
||||
Log.e(TAG, "onCreate: device not reboot");
|
||||
}
|
||||
|
||||
Settings.Global.putString(getContentResolver(), "AOLE_SERIAL", Utils.getSerial(MainService.this));
|
||||
|
||||
@@ -561,6 +614,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
.throttleLast(30, TimeUnit.SECONDS)
|
||||
// .throttleLast(3, TimeUnit.SECONDS)
|
||||
.subscribe(killObserver);
|
||||
|
||||
Observable.create(networkSubscribe)
|
||||
.throttleLast(1, TimeUnit.HOURS)
|
||||
.subscribe(networkObserver);
|
||||
|
||||
JgyUtils.getInstance().checkAoleyunApp();
|
||||
}
|
||||
|
||||
@@ -1133,9 +1191,43 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
} else {
|
||||
mPresenter.getFirstConnect();
|
||||
mPresenter.getStudesInfo();
|
||||
|
||||
mPresenter.getSystemSettingBegin();
|
||||
mPresenter.getAppLimit();
|
||||
mPresenter.getForceDownload();
|
||||
mPresenter.getDefaultDesktop();
|
||||
mPresenter.setLogoImg();
|
||||
mPresenter.getWallpaper();
|
||||
mPresenter.getAllAppList();
|
||||
mPresenter.getBrowserBookmarks();
|
||||
mPresenter.getBrowserWhiteList();
|
||||
mPresenter.getDesktopIcon();
|
||||
mPresenter.getAppAutoStartUpdateAndNet();
|
||||
mPresenter.getSnAppAttr();
|
||||
mPresenter.getAppIdControl();
|
||||
mPresenter.setAppinsideWeb();
|
||||
mPresenter.getSystemSetting();
|
||||
mPresenter.getDefaultApp();
|
||||
mPresenter.setTopApp();
|
||||
mPresenter.getPoweroffTime();
|
||||
mPresenter.getSnTimeControl();
|
||||
mPresenter.getSnSetting();
|
||||
mPresenter.getCloudLessonSettings();
|
||||
mPresenter.getEbagCode();
|
||||
mPresenter.getBlackList();
|
||||
mPresenter.getWhiteList();
|
||||
mPresenter.getWiFiPasswd();
|
||||
}
|
||||
mPresenter.getDeveloper();
|
||||
mPresenter.sendMacAddress();
|
||||
mPresenter.updateDeviceInfo();
|
||||
mPresenter.sendInstalled();
|
||||
mPresenter.checkAoleyunUpdate();
|
||||
mPresenter.checkTestUpdate();
|
||||
|
||||
mPresenter.getDeveloper();
|
||||
mPresenter.getRomApp();
|
||||
mPresenter.getScreenLockState();
|
||||
mPresenter.geteFence();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1152,7 +1244,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
SysSettingUtils.setDisableSetting(this);
|
||||
JgyUtils.getInstance().writeAppPackageList();
|
||||
}
|
||||
mPresenter.getSystemSettingBegin();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1167,23 +1258,22 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void sendMacFinish() {
|
||||
mPresenter.updateDeviceInfo();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeviceInfoFinish() {
|
||||
mPresenter.sendInstalled();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendInstalledFinish() {
|
||||
Log.e(TAG, "sendInstalledFinish: ");
|
||||
mPresenter.checkAoleyunUpdate();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkAoleyunUpdateFinish() {
|
||||
mPresenter.checkTestUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1193,12 +1283,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void getDeveloperFinish() {
|
||||
mPresenter.getRomApp();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRomAppFinish() {
|
||||
mPresenter.getScreenLockState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1218,7 +1307,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
SPUtils.put(this, "is_screen_lock", false);
|
||||
SPUtils.put(this, "screen_tips", "");
|
||||
}
|
||||
mPresenter.geteFence();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1228,107 +1316,107 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void setSystemSetting() {
|
||||
mPresenter.getAppLimit();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppLimitFinish() {
|
||||
mPresenter.getForceDownload();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getForceDownloadFinish() {
|
||||
mPresenter.getDefaultDesktop();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDefaultDesktopFinish() {
|
||||
mPresenter.setLogoImg();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogoImgFinish() {
|
||||
mPresenter.getWallpaper();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWallpaperFinish() {
|
||||
mPresenter.getAllAppList();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAllAppListFinish() {
|
||||
mPresenter.getBrowserBookmarks();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBrowserBookmarksFinish() {
|
||||
mPresenter.getBrowserWhiteList();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBrowserWhiteList() {
|
||||
mPresenter.getDesktopIcon();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDesktopIconFinish() {
|
||||
mPresenter.getAppAutoStartUpdateAndNet();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppAutoStartUpdateAndNetFinish() {
|
||||
mPresenter.getSnAppAttr();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSnAppAttrFinish() {
|
||||
mPresenter.getAppIdControl();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppIdControlFinish() {
|
||||
mPresenter.setAppinsideWeb();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAppinsideWebFinish() {
|
||||
mPresenter.getSystemSetting();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSystemSettingFinish() {
|
||||
mPresenter.getDefaultApp();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultAppFinish() {
|
||||
mPresenter.setTopApp();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTopAppFinish() {
|
||||
mPresenter.getPoweroffTime();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPoweroffTime() {
|
||||
mPresenter.getSnTimeControl();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSnTimeControlFinish() {
|
||||
mPresenter.getSnSetting();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSnSettingFinish() {
|
||||
mPresenter.getCloudLessonSettings();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCloudLessonSettings() {
|
||||
mPresenter.getEbagCode();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1340,7 +1428,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
// mPresenter.getBlackList();
|
||||
Log.e(TAG, "getEBagCodeFinish: " + "未激活");
|
||||
}
|
||||
mPresenter.getBlackList();
|
||||
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -1352,13 +1440,12 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
@Override
|
||||
public void getBlackListFinish() {
|
||||
Log.e(TAG, "getBlackListFinish: ");
|
||||
mPresenter.getWhiteList();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWhiteListFinish() {
|
||||
Log.e(TAG, "getWhiteListFinish: ");
|
||||
mPresenter.getWiFiPasswd();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2106,8 +2106,13 @@ public class JgyUtils {
|
||||
if (oldStatu == (state ^ 1)) {
|
||||
Log.e(TAG, "setDeveloperOptions: oldStatu = " + oldStatu + " no changed");
|
||||
}
|
||||
|
||||
if (MT8768Tag.equalsIgnoreCase(BuildConfig.platform)) {
|
||||
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
|
||||
} else {
|
||||
//这个需要反着来
|
||||
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state ^ 1);
|
||||
}
|
||||
|
||||
Log.e(TAG, "setDeveloperOptions: DEVELOPMENT_SETTINGS_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0));
|
||||
Log.e(TAG, "setDeveloperOptions: ADB_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0));
|
||||
@@ -3152,7 +3157,7 @@ public class JgyUtils {
|
||||
return Build.HARDWARE;
|
||||
}
|
||||
|
||||
public boolean isAihuaFramwwork() {
|
||||
public boolean isAihuaFramework() {
|
||||
return (Utils.getProperty("ro.build.display.id", "获取失败").contains("_aihua"));
|
||||
}
|
||||
|
||||
@@ -3171,8 +3176,17 @@ public class JgyUtils {
|
||||
|
||||
public boolean isScreenOn() {
|
||||
PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
|
||||
boolean isScreenOn;
|
||||
// 使用新版本的 API,更准确
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
|
||||
isScreenOn = powerManager.isInteractive();
|
||||
} else {
|
||||
// 旧版本 API(已过时,但用于兼容低版本系统)
|
||||
isScreenOn = powerManager.isScreenOn();
|
||||
}
|
||||
Log.e(TAG, "isScreenOn: " + isScreenOn);
|
||||
return isScreenOn;
|
||||
//true为打开,false为关闭
|
||||
return powerManager.isInteractive();
|
||||
}
|
||||
|
||||
private static final String CONNECTED_TIME_KEY = "connectedTimeKey";
|
||||
|
||||
119
app/src/main/java/com/aoleyun/sn/utils/WakeUpUtils.java
Normal file
@@ -0,0 +1,119 @@
|
||||
package com.aoleyun.sn.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Log;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
public class WakeUpUtils {
|
||||
|
||||
/**
|
||||
* 唤醒手机屏幕并解锁
|
||||
*/
|
||||
public static void wakeUpAndUnlock(Activity activity) {
|
||||
// 获取电源管理器对象
|
||||
PowerManager pm = (PowerManager) activity.getApplicationContext()
|
||||
.getSystemService(Context.POWER_SERVICE);
|
||||
boolean screenOn = pm.isScreenOn();
|
||||
Log.d("WakeScreen0", "screenOn: " + screenOn);
|
||||
if (!screenOn) {
|
||||
// 获取PowerManager.WakeLock对象,后面的参数|表示同时传入两个值,最后的是LogCat里用的Tag
|
||||
@SuppressLint("InvalidWakeLockTag") PowerManager.WakeLock wl = pm.newWakeLock(
|
||||
PowerManager.ACQUIRE_CAUSES_WAKEUP |
|
||||
PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "bright");
|
||||
wl.acquire(10000); // 点亮屏幕
|
||||
wl.release(); // 释放
|
||||
}
|
||||
// 屏幕解锁
|
||||
KeyguardManager keyguardManager = (KeyguardManager) activity.getApplicationContext()
|
||||
.getSystemService(Context.KEYGUARD_SERVICE);
|
||||
KeyguardManager.KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("unLock");
|
||||
// 屏幕锁定
|
||||
// keyguardLock.reenableKeyguard();
|
||||
keyguardLock.disableKeyguard(); // 解锁
|
||||
unLockScreen(activity);
|
||||
}
|
||||
|
||||
private static void unLockScreen(Activity activity) {
|
||||
final Window win = activity.getWindow();
|
||||
win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|
||||
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
|
||||
|
||||
win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
|
||||
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
|
||||
| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);
|
||||
}
|
||||
|
||||
/**
|
||||
* 唤醒手机屏幕并解锁
|
||||
*/
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public static void wakeUpAndUnlockScreen(Activity activity) {
|
||||
|
||||
Window win = activity.getWindow();
|
||||
win.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
|
||||
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|
||||
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
|
||||
|
||||
PowerManager pm = (PowerManager) activity.getSystemService(Context.POWER_SERVICE);
|
||||
@SuppressLint("InvalidWakeLockTag")
|
||||
PowerManager.WakeLock wakelock = pm.newWakeLock(
|
||||
PowerManager.FULL_WAKE_LOCK
|
||||
| PowerManager.ACQUIRE_CAUSES_WAKEUP, "xx");
|
||||
wakelock.acquire();
|
||||
wakelock.release();
|
||||
|
||||
KeyguardManager keyguardManager = (KeyguardManager) activity.getApplicationContext()
|
||||
.getSystemService(Context.KEYGUARD_SERVICE);
|
||||
|
||||
if (activity == null) return;
|
||||
keyguardManager.requestDismissKeyguard(activity, new KeyguardManager.KeyguardDismissCallback() {
|
||||
@Override
|
||||
public void onDismissError() {
|
||||
super.onDismissError();
|
||||
Log.d("xxx-->", "1 onDismissError");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismissSucceeded() {
|
||||
super.onDismissSucceeded();
|
||||
Log.d("xxx-->", "1 onDismissSucceeded");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismissCancelled() {
|
||||
super.onDismissCancelled();
|
||||
Log.d("xxx-->", "1 onDismissCancelled");
|
||||
}
|
||||
});
|
||||
|
||||
if (activity == null) return;
|
||||
keyguardManager.requestDismissKeyguard(activity, new KeyguardManager.KeyguardDismissCallback() {
|
||||
@Override
|
||||
public void onDismissError() {
|
||||
super.onDismissError();
|
||||
Log.d("xxx-->", "2 onDismissError");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismissSucceeded() {
|
||||
super.onDismissSucceeded();
|
||||
Log.d("xxx-->", "2 onDismissSucceeded");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismissCancelled() {
|
||||
super.onDismissCancelled();
|
||||
Log.d("xxx-->", "2 onDismissCancelled");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
BIN
app/src/main/res/drawable-hdpi/icon_close.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
15
app/src/main/res/drawable/bt_emergency_normnl.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid android:color="#D74255" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners
|
||||
android:bottomLeftRadius="8dp"
|
||||
android:bottomRightRadius="8dp"
|
||||
android:topLeftRadius="8dp"
|
||||
android:topRightRadius="8dp" />
|
||||
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:right="10dp" />
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/dialog_background.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#ffffff" />
|
||||
<stroke
|
||||
android:width="0.8dp"
|
||||
android:color="#ffffff" />
|
||||
<!-- 圆角 -->
|
||||
<corners android:radius="12dp" />
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/ic_shake.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#BFBFBF"
|
||||
android:pathData="M900,488c0,-35.2 -17.6,-68 -47.2,-88.8 -12,-7.2 -27.2,-4.8 -36,6.4 -8,12 -4.8,27.2 7.2,35.2 15.2,11.2 25.6,28.8 25.6,47.2 0,18.4 -9.6,36 -25.6,47.2 -12,7.2 -14.4,23.2 -7.2,35.2 4.8,6.4 12.8,11.2 21.6,11.2 4.8,0 10.4,-1.6 14.4,-4 28.8,-21.6 47.2,-54.4 47.2,-89.6zM899.2,314.4c-12,-7.2 -27.2,-4.8 -36,6.4 -8,12 -4.8,27.2 7.2,35.2 44.8,30.4 70.4,80 70.4,132 0,52.8 -26.4,102.4 -70.4,132 -12,7.2 -14.4,23.2 -7.2,35.2 4.8,6.4 12.8,11.2 21.6,11.2 4.8,0 10.4,-1.6 14.4,-4 58.4,-40 92.8,-104.8 92.8,-174.4s-34.4,-134.4 -92.8,-173.6zM210.4,445.6c12,-7.2 14.4,-23.2 7.2,-35.2 -8,-12 -24,-14.4 -36,-6.4 -29.6,20.8 -48.8,54.4 -48.8,91.2s17.6,70.4 48.8,91.2c4,3.2 9.6,4 14.4,4 8.8,0 16,-4 21.6,-11.2 8,-12 4.8,-27.2 -7.2,-35.2 -16.8,-11.2 -26.4,-29.6 -26.4,-49.6s9.6,-38.4 26.4,-48.8zM156.8,632c-46.4,-31.2 -73.6,-82.4 -73.6,-136.8s27.2,-105.6 73.6,-136.8c12,-7.2 14.4,-23.2 7.2,-35.2 -8,-12 -24,-14.4 -36,-6.4C68,356.8 32,424.8 32,496s36,137.6 95.2,179.2c4,3.2 9.6,4 14.4,4 8.8,0 16,-4 21.6,-11.2 8.8,-12.8 4.8,-28.8 -6.4,-36zM653.6,702.4l-344.8,-61.6 87.2,-469.6 344.8,61.6 -87.2,469.6zM482.4,808.8l-51.2,-8.8c-14.4,-2.4 -23.2,-16 -20.8,-29.6 2.4,-13.6 16,-22.4 29.6,-20l51.2,8.8c14.4,2.4 23.2,16 20.8,29.6 -2.4,13.6 -16,22.4 -29.6,20zM756.8,176.8l-356,-63.2c-28,-4.8 -55.2,12.8 -60,40.8L223.2,788.8c-4.8,27.2 13.6,53.6 41.6,59.2l356,63.2c28,4.8 55.2,-12.8 60,-40.8l117.6,-635.2c5.6,-27.2 -12.8,-53.6 -41.6,-58.4z"/>
|
||||
</vector>
|
||||
13
app/src/main/res/drawable/update_background.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid android:color="@color/default_blue" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners android:radius="32dp" />
|
||||
|
||||
<padding
|
||||
android:bottom="6dp"
|
||||
android:left="32dp"
|
||||
android:right="32dp"
|
||||
android:top="6dp" />
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/update_cancel_background.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid android:color="@color/lightGray" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners android:radius="32dp" />
|
||||
|
||||
<padding
|
||||
android:bottom="6dp"
|
||||
android:left="32dp"
|
||||
android:right="32dp"
|
||||
android:top="6dp" />
|
||||
</shape>
|
||||
165
app/src/main/res/layout/activity_app_update.xml
Normal file
@@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".activity.update.AppUpdateActivity">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="appInfo"
|
||||
type="com.aoleyun.sn.bean.AppUpdateInfo" />
|
||||
|
||||
<variable
|
||||
name="msg"
|
||||
type="String" />
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.aoleyun.sn.activity.update.AppUpdateActivity.BtnClick" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/dialog_background"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{click::exit}"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_close"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_vertical"
|
||||
android:text="检查更新"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="visible" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout3"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="2dp"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:minHeight="50dp"
|
||||
android:minLines="2"
|
||||
android:text="@{msg}"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
tools:text="提示消息提示消息提示消息提示消息提示消息" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_app_icon"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="16dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@{`V`+appInfo.version_name}"
|
||||
android:textColor="@color/contact_text_color"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/linearLayout3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="32dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/negative"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/update_cancel_background"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click::exit}"
|
||||
android:singleLine="true"
|
||||
android:text="取消"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/positive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/update_background"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click::upgrade}"
|
||||
android:singleLine="true"
|
||||
android:text="更新"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
68
app/src/main/res/layout/activity_audio.xml
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".activity.AudioActivity">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="320dp"
|
||||
android:background="@drawable/background_main"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="设备提醒"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_shake"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_stop"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_stop"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:background="@drawable/bg_sure"
|
||||
android:gravity="center"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:text="确定"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@+id/textView4"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView4" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 29 KiB |
@@ -62,4 +62,7 @@
|
||||
<color name="text_black">#1f1f1f</color>
|
||||
<color name="text_hint_gray">#989898</color>
|
||||
|
||||
<color name="contact_text_color">#98999a</color>
|
||||
<color name="lightGray">#FFD3D3D3</color>
|
||||
<color name="default_blue">#0166ff</color>
|
||||
</resources>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="app_name">我的设备</string>
|
||||
<string name="app_name">设备管理</string>
|
||||
<string name="unistall_error">卸载失败!</string>
|
||||
<string name="system_unistall_error">系统应用无法卸载!</string>
|
||||
<string name="cleaned">清理垃圾 (<xliff:g id="memory">%1$s</xliff:g>)</string>
|
||||
|
||||
@@ -74,4 +74,25 @@
|
||||
<!-- <item name="android:backgroundDimAmount">0.7</item> //就是用来控制灰度的值,当为1时,界面除了我们的dialog内容是高亮显示的,dialog以外的区域是黑色的,完全看不到其他内容-->
|
||||
<!-- <item name="android:backgroundDimEnabled">true</item>-->
|
||||
</style>
|
||||
|
||||
<style name="DialogCloseOnTouchOutside" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- <item name="android:windowFullscreen">true</item>-->
|
||||
<!--设置dialog的背景-->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!--设置Dialog的windowFrame框为无-->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<!--设置无标题-->
|
||||
<item name="windowNoTitle">true</item>
|
||||
<!--是否浮现在activity之上-->
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<!--是否半透明-->
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<!--设置窗口内容不覆盖-->
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<!--设置动画,在这里使用让它继承系统的Animation.Dialog-->
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
|
||||
<!--背景是否模糊显示-->
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
<item name="android:windowCloseOnTouchOutside">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||