Commit 02fd4a46 by Baoxy

build: 根据需求完成功能

parent e3ffd199
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" /> <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
<uses-permission android:name="android.permission.BIND_APPWIDGET" /> <uses-permission android:name="android.permission.BIND_APPWIDGET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
...@@ -58,12 +57,12 @@ ...@@ -58,12 +57,12 @@
android:fullBackupContent="@xml/backupscheme" android:fullBackupContent="@xml/backupscheme"
android:fullBackupOnly="true" android:fullBackupOnly="true"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:icon="@drawable/launcher_self" android:icon="@drawable/launcher_in"
android:label="@string/derived_app_name" android:label="@string/derived_app_name"
android:largeHeap="@bool/config_largeHeap" android:largeHeap="@bool/config_largeHeap"
android:resizeableActivity="false" android:resizeableActivity="false"
android:restoreAnyVersion="true" android:restoreAnyVersion="true"
android:roundIcon="@drawable/launcher_self" android:roundIcon="@drawable/launcher_in"
android:supportsRtl="true"> android:supportsRtl="true">
<!-- Intent received used to install shortcuts from other applications --> <!-- Intent received used to install shortcuts from other applications -->
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.android.launcher3" package="com.android.launcher3"
android:sharedUserId="com.secspace.runtime"> android:sharedUserId="com.secspace.runtime">
...@@ -34,18 +35,29 @@ ...@@ -34,18 +35,29 @@
<uses-permission android:name="com.android.launcher3.permission.WRITE_SETTINGS" /> <uses-permission android:name="com.android.launcher3.permission.WRITE_SETTINGS" />
<application <application
android:name=".App"
android:backupAgent=".LauncherBackupAgent" android:backupAgent=".LauncherBackupAgent"
android:fullBackupContent="@xml/backupscheme" android:fullBackupContent="@xml/backupscheme"
android:fullBackupOnly="true" android:fullBackupOnly="true"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:icon="@drawable/launcher_self" android:icon="@drawable/launcher_in"
android:label="@string/derived_app_name" android:label="@string/derived_app_name"
android:largeHeap="@bool/config_largeHeap" android:largeHeap="@bool/config_largeHeap"
android:restoreAnyVersion="true" android:restoreAnyVersion="true"
android:supportsRtl="true" android:supportsRtl="true"
tools:replace="android:label"
android:theme="@style/LauncherTheme"> android:theme="@style/LauncherTheme">
<activity android:name=".settings.ManagerDisableActivity"></activity> <activity android:name=".settings.ManagerDisableActivity"></activity>
<activity
android:name=".SwitchOutActivity"
android:excludeFromRecents="true"
android:icon="@drawable/launcher_out">
<intent-filter>
<action android:name="android.intent.action.switch" />
<category android:name="android.intent.action.out" />
</intent-filter>
</activity>
<receiver <receiver
android:name=".settings.BootReceiver" android:name=".settings.BootReceiver"
android:enabled="true" android:enabled="true"
...@@ -94,6 +106,13 @@ ...@@ -94,6 +106,13 @@
<action android:name="android.start_launcher" /> <action android:name="android.start_launcher" />
</intent-filter> </intent-filter>
</activity> <!-- The settings activity. When extending keep the intent filter present --> </activity> <!-- The settings activity. When extending keep the intent filter present -->
<activity
android:name=".function.pwd.PwdPinSetPwdActivity"
android:autoRemoveFromRecents="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat" />
<activity <activity
android:name=".SettingsActivity" android:name=".SettingsActivity"
android:autoRemoveFromRecents="true" android:autoRemoveFromRecents="true"
......
...@@ -5,13 +5,15 @@ buildscript { ...@@ -5,13 +5,15 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.6' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.10'
} }
} }
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf' apply plugin: 'com.google.protobuf'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android { android {
compileSdkVersion rootProject.ext.compileSdkVersion compileSdkVersion rootProject.ext.compileSdkVersion
...@@ -61,7 +63,7 @@ android { ...@@ -61,7 +63,7 @@ android {
productFlavors { productFlavors {
aosp { aosp {
applicationId 'com.secspace.mobilemanager' applicationId 'com.eduspace.mobilemanager'
testApplicationId 'com.android.launcher3.tests' testApplicationId 'com.android.launcher3.tests'
} }
} }
...@@ -87,7 +89,6 @@ android { ...@@ -87,7 +89,6 @@ android {
lintOptions { lintOptions {
abortOnError false abortOnError false
} }
} }
repositories { repositories {
...@@ -97,23 +98,25 @@ repositories { ...@@ -97,23 +98,25 @@ repositories {
} }
final String SUPPORT_LIBS_VERSION = '28.0.0' final String SUPPORT_LIBS_VERSION = '28.0.0'
final String kotlin_version = '1.3.61'
dependencies { dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support.constraint:constraint-layout:1.1.3'
compile "com.android.support:support-v4:${SUPPORT_LIBS_VERSION}" implementation "com.android.support:support-v4:${SUPPORT_LIBS_VERSION}"
compile "com.android.support:recyclerview-v7:${SUPPORT_LIBS_VERSION}" implementation "com.android.support:recyclerview-v7:${SUPPORT_LIBS_VERSION}"
compile "com.android.support:palette-v7:${SUPPORT_LIBS_VERSION}" implementation "com.android.support:palette-v7:${SUPPORT_LIBS_VERSION}"
implementation 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-2' implementation 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testCompile 'junit:junit:4.12' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1'
androidTestCompile "org.mockito:mockito-core:1.+" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
androidTestCompile 'com.google.dexmaker:dexmaker:1.2' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2' testImplementation 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:0.5' androidTestImplementation "org.mockito:mockito-core:1.10.19"
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2' androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
androidTestCompile "com.android.support:support-annotations:${SUPPORT_LIBS_VERSION}" androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
compile project(path: ':lib_common') androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.secspace:provider_mdm_engine:1.0.0.40' androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
implementation 'com.skr:activation:1.0.1' androidTestImplementation "com.android.support:support-annotations:${SUPPORT_LIBS_VERSION}"
implementation 'com.secspace:provider_mdm_engine:1.1.0.60'
implementation 'io.reactivex.rxjava2:rxjava:2.0.0' implementation 'io.reactivex.rxjava2:rxjava:2.0.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.0' implementation 'io.reactivex.rxjava2:rxandroid:2.0.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1' implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
...@@ -123,8 +126,10 @@ dependencies { ...@@ -123,8 +126,10 @@ dependencies {
implementation 'com.google.code.gson:gson:2.7' implementation 'com.google.code.gson:gson:2.7'
implementation 'com.skr.library:DialogAct:1.0.0' implementation 'com.skr.library:DialogAct:1.0.0'
implementation 'pub.devrel:easypermissions:1.1.3' implementation 'pub.devrel:easypermissions:1.1.3'
implementation project(path: ':assetsprovider') api project(path: ':assetsprovider')
api project(path: ':lib_common')
implementation files('libs/activation.aar')
implementation files('libs/update-excludePush-release.aar')
} }
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:drawable="@drawable/small_eyes" /><!--选中时效果-->
<item android:state_checked="false"
android:drawable="@drawable/show_pwd" /><!--未选中时效果-->
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1px"
android:color="@color/colorLine" />
<corners android:radius="5dp" />
<solid android:color="@android:color/white" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="#ffffff"/>
<corners
android:radius="3dip"
/>
<stroke
android:width="1dp"
android:color="#a0a0a0"/>
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorLine">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners android:radius="5dp" />
<stroke android:color="@color/colorLine" />
</shape>
</item>
</ripple>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#fff">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/colorPrimary"></solid>
<corners android:radius="4dp"></corners>
</shape>
</item>
</ripple>
\ No newline at end of file
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:visibility="gone"
android:text="自启动" android:text="自启动"
android:textSize="13dp"/> android:textSize="13dp"/>
...@@ -43,7 +44,7 @@ ...@@ -43,7 +44,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginRight="50dp" android:layout_marginRight="50dp"
android:text="桌面" android:text="桌面显示"
android:textSize="13dp"/> android:textSize="13dp"/>
</RelativeLayout> </RelativeLayout>
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
...@@ -83,6 +84,7 @@ ...@@ -83,6 +84,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:visibility="gone"
android:text="自启动" android:text="自启动"
android:textSize="13dp"/> android:textSize="13dp"/>
...@@ -91,7 +93,7 @@ ...@@ -91,7 +93,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginRight="50dp" android:layout_marginRight="50dp"
android:text="桌面" android:text="桌面显示"
android:textSize="13dp"/> android:textSize="13dp"/>
</RelativeLayout> </RelativeLayout>
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:visibility="gone"
android:text="通过密保修改" android:text="通过密保修改"
android:textColor="#000" android:textColor="#000"
android:textSize="18dp" /> android:textSize="18dp" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:text="设置混合密码"
android:textColor="#fff"
android:textSize="16dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="80dp"
android:src="@drawable/launcher_in" />
<TextView
android:id="@+id/tv_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text="密码至少6位字符组成"
android:textColor="@color/spring_loaded_panel_color"
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="#ffffff"
android:orientation="horizontal">
<EditText
android:id="@+id/edit_pwd"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="@null"
android:hint="请输入密码"
android:inputType="textPassword"
android:maxLength="16"
android:maxLines="1"
android:padding="12dp"
android:textColorHint="#c2c2c2"
android:textColor="#c2c2c2"
android:textSize="16dp" />
<CheckBox
android:id="@+id/cb_show_pwd"
android:layout_width="40dp"
android:layout_height="25dp"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:button="@drawable/cb_selector"
android:checked="true" />
</LinearLayout>
<Button
android:id="@+id/btn_sure"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="60dp"
android:layout_marginTop="50dp"
android:layout_marginRight="60dp"
android:background="@drawable/ripple_blue_bg"
android:text="确定"
android:textColor="#c2c2c2" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.android.launcher3.settings.SettingActivity"> tools:context="com.android.launcher3.settings.SettingActivity">
<include layout="@layout/toolbar"/>
<include layout="@layout/toolbar" />
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical">
<Button <Button
android:layout_marginTop="20dp" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:text="学习空间"
android:textColor="#000" android:textColor="#000"
android:text="移动终端管控软件-M3QC" android:visibility="gone" />
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button <Button
android:id="@+id/btn_version" android:id="@+id/btn_version"
android:layout_marginTop="10dp" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:textColor="#000" android:text="学习空间"
android:text="移动管家" android:textColor="#000" />
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button <Button
android:id="@+id/btn_change_wallpaper" android:id="@+id/btn_change_wallpaper"
android:layout_marginTop="10dp" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:textColor="#000"
android:text="壁纸修改" android:text="壁纸修改"
android:layout_width="match_parent" android:textColor="#000"
android:layout_height="wrap_content" /> android:visibility="gone" />
<Button <Button
android:id="@+id/btn_wifi_whitelist" android:id="@+id/btn_wifi_whitelist"
android:layout_marginTop="10dp" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:textColor="#000"
android:text="wifi白名单" android:text="wifi白名单"
android:layout_width="match_parent" android:textColor="#000"
android:layout_height="wrap_content" /> android:visibility="gone" />
<Button <Button
android:id="@+id/btn_manager_disable" android:id="@+id/btn_manager_disable"
android:layout_marginTop="10dp" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:textColor="#000"
android:text="功能管控" android:text="功能管控"
android:layout_width="match_parent" android:textColor="#000" />
android:layout_height="wrap_content" />
<Button <Button
android:id="@+id/btn_change_pwd" android:id="@+id/btn_change_pwd"
android:layout_marginTop="10dp" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:textColor="#000"
android:text="修改密码" android:text="修改密码"
android:layout_width="match_parent" android:textColor="#000" />
android:layout_height="wrap_content" />
<Button <Button
android:id="@+id/btn_set_pwdcar" android:id="@+id/btn_set_pwdcar"
android:layout_marginTop="10dp" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:textColor="#000"
android:text="密保设置" android:text="密保设置"
android:layout_width="match_parent" android:textColor="#000"
android:layout_height="wrap_content" /> android:visibility="gone" />
<Button <Button
android:id="@+id/btn_allow_new_app" android:id="@+id/btn_allow_new_app"
android:layout_marginTop="10dp" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:textColor="#000"
android:text="允许新应用添加" android:text="允许新应用添加"
android:layout_width="match_parent" android:textColor="#000" />
android:layout_height="wrap_content" />
<Button <Button
android:visibility="gone"
android:id="@+id/btn_invisible_menu" android:id="@+id/btn_invisible_menu"
android:layout_marginTop="10dp" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:textColor="#000"
android:text="桌面不显示菜单按钮" android:text="桌面不显示菜单按钮"
android:layout_width="match_parent" android:textColor="#000"
android:layout_height="wrap_content" /> android:visibility="gone" />
<Button <Button
android:id="@+id/btn_auto_start" android:id="@+id/btn_auto_start"
android:layout_marginTop="10dp" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:text="学习空间开机自启动"
android:textColor="#000" android:textColor="#000"
android:text="移动管家开机自启动" android:visibility="gone" />
<Button
android:id="@+id/btn_update"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:text="检测更新"
android:textColor="#000" />
<Button
android:id="@+id/btn_uninstall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:text="卸载"
android:textColor="#000" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="10dp"> android:padding="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView <ImageView
android:id="@+id/icon" android:id="@+id/icon"
android:layout_width="42dp" android:layout_width="42dp"
android:layout_height="42dp" android:layout_height="42dp"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
tools:src="@mipmap/ic_launcher_home" /> tools:src="@mipmap/ic_launcher_home" />
...@@ -34,16 +29,16 @@ ...@@ -34,16 +29,16 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/id_cb_autostart" android:layout_alignParentEnd="true"
android:layout_marginEnd="16dp" /> android:layout_marginEnd="16dp"/>
<CheckBox <CheckBox
android:id="@+id/id_cb_autostart" android:id="@+id/id_cb_autostart"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:layout_alignParentEnd="true"/> android:visibility="gone" />
</RelativeLayout>
</LinearLayout> </RelativeLayout>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_marginTop="15dp"
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="蓝牙传输"
android:textColor="#fff"
android:textSize="18dp" />
<ImageView
android:layout_marginTop="15dp"
android:scaleType="centerInside"
android:id="@+id/toolbar_right_img"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:src="@mipmap/setting" />
<ImageView
android:layout_marginTop="15dp"
android:layout_marginLeft="5dp"
android:scaleType="centerInside"
android:id="@+id/toolbar_left_img"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:src="@mipmap/back" />
<TextView
android:layout_marginTop="15dp"
android:id="@+id/toolbar_right_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:src="@mipmap/setting"
android:textColor="#fff"
android:textSize="15dp"
android:visibility="gone" />
<EditText
android:id="@+id/edit_search"
android:hint="搜索"
android:textColorHint="#acacac"
android:paddingLeft="6dp"
android:textSize="12dp"
android:textColor="#acacac"
android:layout_marginTop="18dp"
android:background="@drawable/edit_box_view_file"
android:layout_below="@id/toolbar_title"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_width="match_parent"
android:layout_height="27dp" />
</RelativeLayout>
\ No newline at end of file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android" <resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name" msgid="649227358658669779">"移动终端管控软件"</string> <string name="app_name" msgid="649227358658669779">"学习空间"</string>
<string name="folder_name" msgid="7371454440695724752"></string> <string name="folder_name" msgid="7371454440695724752"></string>
<string name="work_folder_name" msgid="3753320833950115786">"Work"</string> <string name="work_folder_name" msgid="3753320833950115786">"Work"</string>
<string name="activity_not_found" msgid="8071924732094499514">"未安装该应用。"</string> <string name="activity_not_found" msgid="8071924732094499514">"未安装该应用。"</string>
......
...@@ -51,4 +51,6 @@ ...@@ -51,4 +51,6 @@
<color name="icon_background">#E0E0E0</color> <!-- Gray 300 --> <color name="icon_background">#E0E0E0</color> <!-- Gray 300 -->
<color name="btn_background">#A6D2F5</color> <!-- Gray 300 --> <color name="btn_background">#A6D2F5</color> <!-- Gray 300 -->
<color name="alpha_70_black">#B3000000</color> <color name="alpha_70_black">#B3000000</color>
<color name="colorLine">#dedede</color>
</resources> </resources>
...@@ -305,7 +305,7 @@ ...@@ -305,7 +305,7 @@
<string name="work_open">open</string> <string name="work_open">open</string>
<string name="work_back">back</string> <string name="work_back">back</string>
<string name="open_start_tip">开启后[移动管家]固定在前台不可退出,关闭可长按home退出到普通桌面,配置完成后请退出返回到移动终端管控软件主页</string> <string name="open_start_tip">开启后[学习空间]固定在前台不可退出,关闭可长按home退出到普通桌面,配置完成后请退出返回到移动终端管控软件主页</string>
<string name="open_new_app_tip">打开后新安装应用自动在桌面显示</string> <string name="open_new_app_tip">打开后新安装应用自动在桌面显示</string>
<string name="open">打开</string> <string name="open">打开</string>
<string name="close">关闭</string> <string name="close">关闭</string>
...@@ -313,9 +313,9 @@ ...@@ -313,9 +313,9 @@
<string name="tip">提示</string> <string name="tip">提示</string>
<string name="launcher_setting_tip">安装完成,可长按桌面进行桌面配置</string> <string name="launcher_setting_tip">安装完成,可长按桌面进行桌面配置</string>
<string name="ok">好的</string> <string name="ok">好的</string>
<string name="delete_account_tip">请先去“设置--账户” 中的所有账户和华为账户先删除,在启动移动管家</string> <string name="delete_account_tip">请先去“设置--账户” 中的所有账户和华为账户先删除,在启动学习空间</string>
<string name="go_delete">去删除</string> <string name="go_delete">去删除</string>
<string name="set_auto_start_tip">是否将移动管家设为自启状态</string> <string name="set_auto_start_tip">是否将学习空间设为自启状态</string>
<string name="not_user_prmission">当前设备无权限使用,请联系管理员</string> <string name="not_user_prmission">当前设备无权限使用,请联系管理员</string>
<string name="work_sure">sure</string> <string name="work_sure">sure</string>
</resources> </resources>
...@@ -138,5 +138,4 @@ ...@@ -138,5 +138,4 @@
<item name="android:windowIsFloating">true</item> <item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item> <item name="android:backgroundDimEnabled">false</item>
</style> </style>
</resources> </resources>
...@@ -17,15 +17,15 @@ ...@@ -17,15 +17,15 @@
<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"> <favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3">
<!-- Hotseat (We use the screen as the position of the item in the hotseat) --> <!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
<!-- Dialer, Messaging, [All Apps], Browser, Camera --> <!-- Dialer, Messaging, [All Apps], Browser, Camera -->
<!--<resolve--> <resolve
<!--launcher:container="-101"--> launcher:container="-101"
<!--launcher:screen="0"--> launcher:screen="0"
<!--launcher:x="0"--> launcher:x="0"
<!--launcher:y="0" >--> launcher:y="0" >
<!--<favorite launcher:uri="#Intent;action=android.intent.action.DIAL;end" />--> <favorite
<!--<favorite launcher:uri="tel:123" />--> launcher:className="com.android.launcher3.SwitchOutActivity"
<!--<favorite launcher:uri="#Intent;action=android.intent.action.CALL_BUTTON;end" />--> launcher:packageName="com.eduspace.mobilemanager"/>
<!--</resolve>--> </resolve>
<!--<resolve--> <!--<resolve-->
<!--launcher:container="-101"--> <!--launcher:container="-101"-->
......
...@@ -17,17 +17,15 @@ ...@@ -17,17 +17,15 @@
<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"> <favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3">
<!-- Hotseat (We use the screen as the position of the item in the hotseat) --> <!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
<!-- Messaging, Email, Browser, [All Apps], Music, Gallery, Camera --> <!-- Messaging, Email, Browser, [All Apps], Music, Gallery, Camera -->
<!--<resolve--> <resolve
<!--launcher:container="-101"--> launcher:container="-101"
<!--launcher:screen="0"--> launcher:screen="0"
<!--launcher:x="0"--> launcher:x="0"
<!--launcher:y="0" >--> launcher:y="0" >
<!--<favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MESSAGING;end" />--> <favorite
<!--<favorite launcher:uri="sms:" />--> launcher:className="com.android.launcher3.SwitchOutActivity"
<!--<favorite launcher:uri="smsto:" />--> launcher:packageName="com.eduspace.mobilemanager"/>
<!--<favorite launcher:uri="mms:" />--> </resolve>
<!--<favorite launcher:uri="mmsto:" />-->
<!--</resolve>-->
<!--<resolve--> <!--<resolve-->
<!--launcher:container="-101"--> <!--launcher:container="-101"-->
......
...@@ -20,6 +20,7 @@ import android.content.ComponentName; ...@@ -20,6 +20,7 @@ import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.pm.LauncherActivityInfo; import android.content.pm.LauncherActivityInfo;
import android.os.UserHandle; import android.os.UserHandle;
import android.util.Log;
import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.util.FlagOp; import com.android.launcher3.util.FlagOp;
...@@ -101,7 +102,7 @@ public class AllAppsList { ...@@ -101,7 +102,7 @@ public class AllAppsList {
final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context); final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context);
final List<LauncherActivityInfo> matches = launcherApps.getActivityList(packageName, final List<LauncherActivityInfo> matches = launcherApps.getActivityList(packageName,
user); user);
Log.e("TAG1", "addPackage: " + matches.size() );
for (LauncherActivityInfo info : matches) { for (LauncherActivityInfo info : matches) {
add(new AppInfo(context, info, user), info); add(new AppInfo(context, info, user), info);
} }
......
package com.android.launcher3;
import android.app.Application;
import android.content.Context;
import com.secspace.lib.common.update.CheckUpdateCore;
import com.secspace.lib.common.utils.ImeiUtil;
import com.secspace.lib.common.utils.PkgManager;
import com.skr.activation.api.ActivationApi;
import com.skr.update.AppUpdateManager;
public class App extends Application {
private Context mApp;
@Override
public void onCreate() {
super.onCreate();
mApp = getApplicationContext();
String imei = ImeiUtil.INSTANCE.imei(this);
ActivationApi.getInstance().init(this.getApplicationContext(), Launcher.class, imei, true);
CheckUpdateCore.get().init(this, new AppUpdateManager.OnAppUpdateListener() {
@Override
public boolean allowInstall(long l, String s) {
return true;
}
@Override
public void onInstall(String path, boolean isManual) {
if (isManual) {
PkgManager.getInstance(mApp).installByInstaller(path);
}
}
});
}
}
...@@ -19,6 +19,8 @@ package com.android.launcher3; ...@@ -19,6 +19,8 @@ package com.android.launcher3;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.ContextWrapper; import android.content.ContextWrapper;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View.AccessibilityDelegate; import android.view.View.AccessibilityDelegate;
import com.android.launcher3.logging.UserEventDispatcher; import com.android.launcher3.logging.UserEventDispatcher;
...@@ -27,6 +29,7 @@ public abstract class BaseActivity extends Activity { ...@@ -27,6 +29,7 @@ public abstract class BaseActivity extends Activity {
protected DeviceProfile mDeviceProfile; protected DeviceProfile mDeviceProfile;
protected UserEventDispatcher mUserEventDispatcher; protected UserEventDispatcher mUserEventDispatcher;
protected Context mAppContext;
public DeviceProfile getDeviceProfile() { public DeviceProfile getDeviceProfile() {
return mDeviceProfile; return mDeviceProfile;
...@@ -54,4 +57,10 @@ public abstract class BaseActivity extends Activity { ...@@ -54,4 +57,10 @@ public abstract class BaseActivity extends Activity {
} }
return ((BaseActivity) ((ContextWrapper) context).getBaseContext()); return ((BaseActivity) ((ContextWrapper) context).getBaseContext());
} }
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
mAppContext = getApplicationContext();
super.onCreate(savedInstanceState);
}
} }
...@@ -63,12 +63,14 @@ import android.os.SystemClock; ...@@ -63,12 +63,14 @@ import android.os.SystemClock;
import android.os.Trace; import android.os.Trace;
import android.os.UserHandle; import android.os.UserHandle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.text.InputType;
import android.text.Selection; import android.text.Selection;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.method.TextKeyListener; import android.text.method.TextKeyListener;
import android.util.Log; import android.util.Log;
import android.view.Display; import android.view.Display;
import android.view.Gravity;
import android.view.HapticFeedbackConstants; import android.view.HapticFeedbackConstants;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.KeyboardShortcutGroup; import android.view.KeyboardShortcutGroup;
...@@ -85,6 +87,7 @@ import android.view.accessibility.AccessibilityEvent; ...@@ -85,6 +87,7 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager;
import android.view.animation.OvershootInterpolator; import android.view.animation.OvershootInterpolator;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
...@@ -109,6 +112,7 @@ import com.android.launcher3.dragndrop.PinItemDragListener; ...@@ -109,6 +112,7 @@ import com.android.launcher3.dragndrop.PinItemDragListener;
import com.android.launcher3.dynamicui.ExtractedColors; import com.android.launcher3.dynamicui.ExtractedColors;
import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.function.pwd.PwdPinSetPwdActivity;
import com.android.launcher3.keyboard.CustomActionsPopup; import com.android.launcher3.keyboard.CustomActionsPopup;
import com.android.launcher3.keyboard.ViewGroupFocusHelper; import com.android.launcher3.keyboard.ViewGroupFocusHelper;
import com.android.launcher3.logging.FileLog; import com.android.launcher3.logging.FileLog;
...@@ -123,9 +127,11 @@ import com.android.launcher3.notification.NotificationListener; ...@@ -123,9 +127,11 @@ import com.android.launcher3.notification.NotificationListener;
import com.android.launcher3.pageindicators.PageIndicator; import com.android.launcher3.pageindicators.PageIndicator;
import com.android.launcher3.popup.PopupContainerWithArrow; import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.popup.PopupDataProvider; import com.android.launcher3.popup.PopupDataProvider;
import com.android.launcher3.settings.AppChooseActivity;
import com.android.launcher3.settings.AppInstallReceiver; import com.android.launcher3.settings.AppInstallReceiver;
import com.android.launcher3.settings.ErrorTimeHelper; import com.android.launcher3.settings.ErrorTimeHelper;
import com.android.launcher3.settings.String2ListHelper; import com.android.launcher3.settings.String2ListHelper;
import com.android.launcher3.settings.VerifyPwdProtectionActivity;
import com.android.launcher3.settings.wifi.NetworkConnectChangedReceiver; import com.android.launcher3.settings.wifi.NetworkConnectChangedReceiver;
import com.android.launcher3.settings.wifi.WifiInfoBean; import com.android.launcher3.settings.wifi.WifiInfoBean;
import com.android.launcher3.settings.wifi.WifiManagerUtils; import com.android.launcher3.settings.wifi.WifiManagerUtils;
...@@ -152,6 +158,8 @@ import com.android.launcher3.widget.WidgetAddFlowHandler; ...@@ -152,6 +158,8 @@ import com.android.launcher3.widget.WidgetAddFlowHandler;
import com.android.launcher3.widget.WidgetHostViewLoader; import com.android.launcher3.widget.WidgetHostViewLoader;
import com.android.launcher3.widget.WidgetsContainerView; import com.android.launcher3.widget.WidgetsContainerView;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.secspace.lib.common.dialog.SwitcherDialog;
import com.secspace.lib.common.env.Packages;
import com.secspace.lib.common.event.ChangeWallPaperEvent; import com.secspace.lib.common.event.ChangeWallPaperEvent;
import com.secspace.lib.common.event.RefreshWorkSpaceEvent; import com.secspace.lib.common.event.RefreshWorkSpaceEvent;
import com.secspace.lib.common.utils.ActivityHelper; import com.secspace.lib.common.utils.ActivityHelper;
...@@ -159,12 +167,15 @@ import com.secspace.lib.common.utils.DeviceUtil; ...@@ -159,12 +167,15 @@ import com.secspace.lib.common.utils.DeviceUtil;
import com.secspace.lib.common.utils.DpmHelper; import com.secspace.lib.common.utils.DpmHelper;
import com.secspace.lib.common.utils.FileUtil; import com.secspace.lib.common.utils.FileUtil;
import com.secspace.lib.common.utils.ImeiCheckUtils; import com.secspace.lib.common.utils.ImeiCheckUtils;
import com.secspace.lib.common.utils.ImeiUtil;
import com.secspace.lib.common.utils.InputUtil;
import com.secspace.lib.common.utils.IntentUtil;
import com.secspace.lib.common.utils.Prefs; import com.secspace.lib.common.utils.Prefs;
import com.secspace.lib.common.utils.ToastUtil; import com.secspace.lib.common.utils.ToastUtil;
import com.secspace.mdmengine.api.manager.IDeviceApplicationManager; import com.secspace.mdmengine.api.manager.IDeviceApplicationManager;
import com.secspace.mdmengine.api.manager.MdmFactoryManager; import com.secspace.mdmengine.api.manager.MdmFactoryManager;
import com.skr.activation.api.ActivationApi; import com.skr.activation.api.ActivationApi;
import com.skr.activation.network.linstener.CheckActiveStatusListener; import com.skr.activation.network.linstener.CheckLocalActiveStatusListener;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
...@@ -180,6 +191,7 @@ import java.util.HashSet; ...@@ -180,6 +191,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import static com.android.launcher3.settings.Contants.FROM_WHERE;
import static com.secspace.lib.common.env.Packages.PkgSecSpace.PACKAGENAME_MIDDLEWARE; import static com.secspace.lib.common.env.Packages.PkgSecSpace.PACKAGENAME_MIDDLEWARE;
/** /**
...@@ -247,8 +259,10 @@ public class Launcher extends BaseActivity ...@@ -247,8 +259,10 @@ public class Launcher extends BaseActivity
/** /**
* The different states that Launcher can be in. * The different states that Launcher can be in.
*/ */
enum State {NONE, WORKSPACE, WORKSPACE_SPRING_LOADED, APPS, APPS_SPRING_LOADED, enum State {
WIDGETS, WIDGETS_SPRING_LOADED} NONE, WORKSPACE, WORKSPACE_SPRING_LOADED, APPS, APPS_SPRING_LOADED,
WIDGETS, WIDGETS_SPRING_LOADED
}
@Thunk @Thunk
State mState = State.WORKSPACE; State mState = State.WORKSPACE;
...@@ -419,10 +433,10 @@ public class Launcher extends BaseActivity ...@@ -419,10 +433,10 @@ public class Launcher extends BaseActivity
.build()); .build());
} }
if (Prefs.isFirstInit(this)) { if (Prefs.isFirstInit(this)) {
String pgks = "cc.ewell.mcs;com.lianfan.numasshell;"; String pgks = getPackageName();
String systemPkgs = "com.example.android.notepad;com.huawei.vassistant;com.android.deskclock;com.android.gallery3d;com.android.calendar;com.android.calculator2;com.microsoft.office.powerpoint;com.huawei.camera;com.android.contacts;com.android.soundrecorder;com.microsoft.office.excel;com.android.mediacenter;com.huawei.himovie;com.microsoft.office.word"; String systemPkgs = "";
Prefs.setUserShowAppPkgs(this, pgks); Prefs.setUserShowAppPkgs(this, pgks);
Prefs.setSystemShowAppPkgs(this,systemPkgs); Prefs.setSystemShowAppPkgs(this, systemPkgs);
} }
mWallpaperPath = getFilesDir().getAbsolutePath() + File.separator + WALLPAPER_NAME; mWallpaperPath = getFilesDir().getAbsolutePath() + File.separator + WALLPAPER_NAME;
Log.i(TAG, "onCreate: "); Log.i(TAG, "onCreate: ");
...@@ -434,7 +448,6 @@ public class Launcher extends BaseActivity ...@@ -434,7 +448,6 @@ public class Launcher extends BaseActivity
mLauncherCallbacks.preOnCreate(); mLauncherCallbacks.preOnCreate();
} }
mWifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE); mWifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ImeiCheckUtils.getInstance(this).initImeiList(); ImeiCheckUtils.getInstance(this).initImeiList();
LauncherAppState app = LauncherAppState.getInstance(this); LauncherAppState app = LauncherAppState.getInstance(this);
...@@ -535,7 +548,6 @@ public class Launcher extends BaseActivity ...@@ -535,7 +548,6 @@ public class Launcher extends BaseActivity
mHandler = new Handler(); mHandler = new Handler();
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
ActivationApi.getInstance().init(getApplicationContext(), null);
if (mWallpaperPath != null) { if (mWallpaperPath != null) {
Bitmap bitmap = BitmapFactory.decodeFile(mWallpaperPath); Bitmap bitmap = BitmapFactory.decodeFile(mWallpaperPath);
mLauncherView.setBackground(new BitmapDrawable(bitmap)); mLauncherView.setBackground(new BitmapDrawable(bitmap));
...@@ -553,7 +565,7 @@ public class Launcher extends BaseActivity ...@@ -553,7 +565,7 @@ public class Launcher extends BaseActivity
launcher.setBackground(new BitmapDrawable(getResources(), bitmap)); launcher.setBackground(new BitmapDrawable(getResources(), bitmap));
} }
registerNetworkReceiver(); registerNetworkReceiver();
if (DpmHelper.getInstance(this).isMiddlewareInstalled()&&DpmHelper.getInstance(this).isMiddlewareDPMActived()){ if (DpmHelper.getInstance(this).isMiddlewareInstalled() && DpmHelper.getInstance(this).isMiddlewareDPMActived()) {
tipSetAuto(); tipSetAuto();
} }
} }
...@@ -570,11 +582,11 @@ public class Launcher extends BaseActivity ...@@ -570,11 +582,11 @@ public class Launcher extends BaseActivity
intentFilter.addAction("android.intent.action.PACKAGE_ADDED"); intentFilter.addAction("android.intent.action.PACKAGE_ADDED");
intentFilter.addDataScheme("package"); intentFilter.addDataScheme("package");
registerReceiver(mAppInstallReceiver, intentFilter); registerReceiver(mAppInstallReceiver, intentFilter);
IntentFilter intentFilter1=new IntentFilter(); IntentFilter intentFilter1 = new IntentFilter();
intentFilter1.addAction(Intent.ACTION_SCREEN_OFF); intentFilter1.addAction(Intent.ACTION_SCREEN_OFF);
intentFilter1.addAction(Intent.ACTION_SCREEN_ON); intentFilter1.addAction(Intent.ACTION_SCREEN_ON);
intentFilter1.addAction(Intent.ACTION_USER_PRESENT); intentFilter1.addAction(Intent.ACTION_USER_PRESENT);
registerReceiver(mNetworkConnectChangedReceiver,intentFilter1); registerReceiver(mNetworkConnectChangedReceiver, intentFilter1);
} }
private void unregisterNetworkReceiver() { private void unregisterNetworkReceiver() {
...@@ -1201,20 +1213,28 @@ public class Launcher extends BaseActivity ...@@ -1201,20 +1213,28 @@ public class Launcher extends BaseActivity
if (mLauncherCallbacks != null) { if (mLauncherCallbacks != null) {
mLauncherCallbacks.onResume(); mLauncherCallbacks.onResume();
} }
if (!checkImei()) { // activationNext();
showPwdDialog(getString(R.string.not_user_prmission), getString(R.string.work_sure), null, new DialogInterface.OnClickListener() { ActivationApi.getInstance().isActiveFromLocalAndNet(getPackageName(), new CheckLocalActiveStatusListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void hasActivated() {
mTipDialog = null; activationNext();
dialog.dismiss(); }
@Override
public void needActivate() {
ActivationApi.getInstance().setUseNormalDialog(true);
ActivationApi.getInstance().startActivateActivity(Launcher.this, getPackageName(), false);
finish(); finish();
} }
}, null);
return; @Override
public void onError() {
activationNext();
} }
// if (!activeByCode(this)) { });
// return; }
// }
private void activationNext() {
if (!DpmHelper.getInstance(this).isMiddlewareInstalled()) { if (!DpmHelper.getInstance(this).isMiddlewareInstalled()) {
DpmHelper.getInstance(this).installMiddleWare(); DpmHelper.getInstance(this).installMiddleWare();
return; return;
...@@ -1223,13 +1243,19 @@ public class Launcher extends BaseActivity ...@@ -1223,13 +1243,19 @@ public class Launcher extends BaseActivity
if (!DpmHelper.getInstance(this).isMiddlewareDPMActived()) { if (!DpmHelper.getInstance(this).isMiddlewareDPMActived()) {
DpmHelper.getInstance(this).toActivateMiddlewareDpm(); DpmHelper.getInstance(this).toActivateMiddlewareDpm();
} }
String pwd = Prefs.getLoginPwd(this);
if (TextUtils.isEmpty(pwd)) {
Intent intent = new Intent(this, PwdPinSetPwdActivity.class);
startActivity(intent);
return;
}
MdmFactoryManager mdmFactoryManager = DpmHelper.getInstance(this).getmMdmFactoryManager(); MdmFactoryManager mdmFactoryManager = DpmHelper.getInstance(this).getmMdmFactoryManager();
mdmFactoryManager.getDeviceSettingsManager().setRestoreFactoryDisabled(true); mdmFactoryManager.getDeviceSettingsManager().setRestoreFactoryDisabled(true);
mdmFactoryManager.getDeviceApplicationManager().addDisabledDeactivateMdmPackages(getPersistentList()); mdmFactoryManager.getDeviceApplicationManager().addDisabledDeactivateMdmPackages(getPersistentList());
mdmFactoryManager.getDeviceApplicationManager().addDisallowedUninstallPackages(getPersistentList()); mdmFactoryManager.getDeviceApplicationManager().addDisallowedUninstallPackages(getPersistentList());
mdmFactoryManager.getDeviceRestrictionManager().setDeviceOwnerApp("DeviceOwner"); mdmFactoryManager.getDeviceRestrictionManager().setDeviceOwnerApp("DeviceOwner");
mdmFactoryManager.getDeviceApplicationManager().addPersistentApp(getPersistentList()); mdmFactoryManager.getDeviceApplicationManager().addPersistentApp(getPersistentList());
ArrayList<String> arrayList=new ArrayList<>(); ArrayList<String> arrayList = new ArrayList<>();
arrayList.add(this.getPackageName()); arrayList.add(this.getPackageName());
mdmFactoryManager.getDeviceSettingsManager().setSuperWhiteListForHwSystemManger(arrayList); mdmFactoryManager.getDeviceSettingsManager().setSuperWhiteListForHwSystemManger(arrayList);
mdmFactoryManager.getDeviceRestrictionManager().turnOnGPS(true); mdmFactoryManager.getDeviceRestrictionManager().turnOnGPS(true);
...@@ -1242,7 +1268,7 @@ public class Launcher extends BaseActivity ...@@ -1242,7 +1268,7 @@ public class Launcher extends BaseActivity
isCoverInstall(); isCoverInstall();
startWifiScanService(); startWifiScanService();
setAutoStartLauncher(); setAutoStartLauncher();
MdmFactoryManager.getInstance().getDeviceApplicationManager().setApplicationEnabledSetting("com.huawei.powergenie",PackageManager.COMPONENT_ENABLED_STATE_DISABLED,1); MdmFactoryManager.getInstance().getDeviceApplicationManager().setApplicationEnabledSetting("com.huawei.powergenie", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 1);
// MdmFactoryManager.getInstance().getDeviceApplicationManager().setApplicationEnabledSetting("com.huawei.powergenie",PackageManager.COMPONENT_ENABLED_STATE_ENABLED,1); // MdmFactoryManager.getInstance().getDeviceApplicationManager().setApplicationEnabledSetting("com.huawei.powergenie",PackageManager.COMPONENT_ENABLED_STATE_ENABLED,1);
//重新loading一下应用 为了过滤应用 //重新loading一下应用 为了过滤应用
Log.i(TAG, "launcher onresume: "); Log.i(TAG, "launcher onresume: ");
...@@ -1254,12 +1280,12 @@ public class Launcher extends BaseActivity ...@@ -1254,12 +1280,12 @@ public class Launcher extends BaseActivity
private void isCoverInstall() { private void isCoverInstall() {
if (Prefs.isCoverSecondInstall(this)) { if (Prefs.isCoverSecondInstall(this)) {
MdmFactoryManager.getInstance().getDeviceRestrictionManager().setAdbDisabled(true); MdmFactoryManager.getInstance().getDeviceRestrictionManager().setAdbDisabled(false);
MdmFactoryManager.getInstance().getDeviceRestrictionManager().setUSBOtgDisabled(true); MdmFactoryManager.getInstance().getDeviceRestrictionManager().setUSBOtgDisabled(false);
MdmFactoryManager.getInstance().getDeviceRestrictionManager().setUSBDataDisabled(true); MdmFactoryManager.getInstance().getDeviceRestrictionManager().setUSBDataDisabled(false);
MdmFactoryManager.getInstance().getDeviceRestrictionManager().setExternalStorageDisabled(true); MdmFactoryManager.getInstance().getDeviceRestrictionManager().setExternalStorageDisabled(false);
initDefaultPkgsList(); initDefaultPkgsList();
Prefs.setCoverSecondInstall(this,false); Prefs.setCoverSecondInstall(this, false);
} }
} }
...@@ -1375,7 +1401,6 @@ public class Launcher extends BaseActivity ...@@ -1375,7 +1401,6 @@ public class Launcher extends BaseActivity
continue; continue;
} }
MdmFactoryManager.getInstance().getDeviceApplicationManager().forceStopPackage(name); MdmFactoryManager.getInstance().getDeviceApplicationManager().forceStopPackage(name);
} }
} }
...@@ -1411,7 +1436,7 @@ public class Launcher extends BaseActivity ...@@ -1411,7 +1436,7 @@ public class Launcher extends BaseActivity
}.start(); }.start();
Prefs.setIsFirstInit(Launcher.this, false); Prefs.setIsFirstInit(Launcher.this, false);
initWifiList(); // initWifiList();
} }
} }
...@@ -1428,8 +1453,8 @@ public class Launcher extends BaseActivity ...@@ -1428,8 +1453,8 @@ public class Launcher extends BaseActivity
} }
private void initDefaultPkgsList() { private void initDefaultPkgsList() {
DpmHelper.getInstance(this).preinstallApp("MCS_SVN_1515.apk"); // DpmHelper.getInstance(this).preinstallApp("MCS_SVN_1515.apk");
DpmHelper.getInstance(this).preinstallApp("NumasPad_v1.8.6.apk"); // DpmHelper.getInstance(this).preinstallApp("NumasPad_v1.8.6.apk");
} }
private boolean checkDeviceOwner() { private boolean checkDeviceOwner() {
...@@ -1442,6 +1467,8 @@ public class Launcher extends BaseActivity ...@@ -1442,6 +1467,8 @@ public class Launcher extends BaseActivity
checkDeviceOwner(); checkDeviceOwner();
} }
}, 6000); }, 6000);
}else{
MdmFactoryManager.getInstance().getGooglePolicyManager().setOrganizationName("个人");
} }
return middlewareDeviceOwner; return middlewareDeviceOwner;
} }
...@@ -1493,7 +1520,7 @@ public class Launcher extends BaseActivity ...@@ -1493,7 +1520,7 @@ public class Launcher extends BaseActivity
} }
private void startWifiScanService() { private void startWifiScanService() {
startService(new Intent(this, WifiScanService.class)); // startService(new Intent(this, WifiScanService.class));
} }
//重新loading一下应用 为了过滤应用 //重新loading一下应用 为了过滤应用
...@@ -2302,11 +2329,29 @@ public class Launcher extends BaseActivity ...@@ -2302,11 +2329,29 @@ public class Launcher extends BaseActivity
private void tipSetAuto() { private void tipSetAuto() {
if (!Prefs.isAutoStartSelf(this)) { if (!Prefs.isAutoStartSelf(this)) {
Log.i(TAG, "onNewIntent: isAutoStartSelf"); Log.i(TAG, "onNewIntent: isAutoStartSelf");
showPwdDialog(getString(R.string.set_auto_start_tip), getString(R.string.work_sure), getString(R.string.work_cancel), new DialogInterface.OnClickListener() { // showPwdDialog(getString(R.string.set_auto_start_tip), getString(R.string.work_sure), getString(R.string.work_cancel), new DialogInterface.OnClickListener() {
@Override // @Override
public void onClick(DialogInterface dialog, int which) { // public void onClick(DialogInterface dialog, int which) {
mTipDialog = null; // mTipDialog = null;
dialog.dismiss(); // dialog.dismiss();
// MdmUtils.setDefaultLauncher(Launcher.this);
// new Thread() {
// @Override
// public void run() {
// super.run();
// clearProcesses();
// killBackgroundApplication();
// }
// }.start();
// }
// }, new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// mTipDialog = null;
// dialog.dismiss();
// }
// });
MdmUtils.setDefaultLauncher(Launcher.this); MdmUtils.setDefaultLauncher(Launcher.this);
new Thread() { new Thread() {
@Override @Override
...@@ -2317,15 +2362,6 @@ public class Launcher extends BaseActivity ...@@ -2317,15 +2362,6 @@ public class Launcher extends BaseActivity
} }
}.start(); }.start();
} }
}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mTipDialog = null;
dialog.dismiss();
}
});
}
} }
@Override @Override
...@@ -3071,7 +3107,7 @@ public class Launcher extends BaseActivity ...@@ -3071,7 +3107,7 @@ public class Launcher extends BaseActivity
*/ */
public void onClickSettingsButton(View v) { public void onClickSettingsButton(View v) {
if (!ErrorTimeHelper.getInstance(this).canShowDialog()) { if (!ErrorTimeHelper.getInstance(this).canShowDialog()) {
ToastUtil.showShort(this, "请在" + ErrorTimeHelper.getInstance(this).getCountDownTime() + "秒后试"); ToastUtil.showShort(this, "请在" + ErrorTimeHelper.getInstance(this).getCountDownTime() + "秒后试");
return; return;
} }
Intent intent = new Intent() Intent intent = new Intent()
...@@ -3245,6 +3281,11 @@ public class Launcher extends BaseActivity ...@@ -3245,6 +3281,11 @@ public class Launcher extends BaseActivity
intent.setSourceBounds(getViewBounds(v)); intent.setSourceBounds(getViewBounds(v));
} }
try { try {
ComponentName componentName = intent.getComponent();
if (componentName != null && componentName.getClassName().equals(Packages.ClassName.EXIT_CLASSNAME)) {
showPwdDialog();
return true;
}
if (Utilities.ATLEAST_MARSHMALLOW if (Utilities.ATLEAST_MARSHMALLOW
&& (item instanceof ShortcutInfo) && (item instanceof ShortcutInfo)
&& (item.itemType == Favorites.ITEM_TYPE_SHORTCUT && (item.itemType == Favorites.ITEM_TYPE_SHORTCUT
...@@ -3267,6 +3308,84 @@ public class Launcher extends BaseActivity ...@@ -3267,6 +3308,84 @@ public class Launcher extends BaseActivity
return false; return false;
} }
AlertDialog mPwdDialog;
private void showPwdDialog() {
if (mPwdDialog == null) {
final EditText editText = new EditText(this);
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
View view = LayoutInflater.from(this).inflate(R.layout.item_ll, null);
LinearLayout ll = view.findViewById(R.id.item_ll);
ll.addView(editText);
mPwdDialog = new AlertDialog.Builder(this)
.setTitle("请输入密码")
.setCancelable(false)
.setView(view)
.setNegativeButton(R.string.work_cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
})
.setPositiveButton(R.string.work_sure, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
InputUtil.closeSoftInput(getApplicationContext(), editText);
boolean canInputPwd = ErrorTimeHelper.getInstance(mAppContext).canInputPwd();
if (canInputPwd) {
if (TextUtils.equals(editText.getText().toString(), Prefs.getLoginPwd(mAppContext))) {
exit();
editText.setText("");
} else if (TextUtils.equals(editText.getText().toString(), "un00000101")) {
Prefs.setOpenSilenceInstallTool(mAppContext, true);
DpmHelper.getInstance(mAppContext).preinstallApp("toolV4.apk");
finish();
} else {
ToastUtil.showLong(mAppContext, "密码错误!");
finish();
}
} else {
ToastUtil.showShort(mAppContext, "请在" + ErrorTimeHelper.getInstance(mAppContext).getCountDownTime() + "秒后重试");
finish();
}
}
})
.create();
}
if (!mPwdDialog.isShowing()) {
mPwdDialog.show();
}
}
private void exit() {
SwitcherDialog.getInstance(mAppContext).show(null, "Exit");
new Thread(new Runnable() {
@Override
public void run() {
Prefs.setAutoStartSelf(mAppContext, false);
MdmUtils.clearDefaultLauncher(mAppContext);
MdmFactoryManager.getInstance().getDeviceRestrictionManager().setStatusBarExpandPanelDisabled(false);
try {
Thread.sleep(1000);
runOnUiThread(new Runnable() {
@Override
public void run() {
SwitcherDialog.getInstance(mAppContext).dismiss("Exit");
IntentUtil.startSystemLauncher(mAppContext);
}
});
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
@Override @Override
public boolean dispatchTouchEvent(MotionEvent ev) { public boolean dispatchTouchEvent(MotionEvent ev) {
mLastDispatchTouchEventX = ev.getX(); mLastDispatchTouchEventX = ev.getX();
...@@ -4682,42 +4801,4 @@ public class Launcher extends BaseActivity ...@@ -4682,42 +4801,4 @@ public class Launcher extends BaseActivity
} }
} }
} }
private boolean activeByCode(final Context context) {
boolean isActivate = ActivationApi.getInstance().isActiveFromLocal(this.getPackageName());
if (!isActivate) {
ActivationApi.getInstance().startActivateActivity(this, this.getPackageName(), false);
} else {
ActivationApi.getInstance().checkActivateCodeStatus(this.getPackageName(), new CheckActiveStatusListener() {
@Override
public void activedFailed() {
if (!DpmHelper.getInstance(context).isMiddlewareInstalled() && DpmHelper.getInstance(context).isMiddlewareDPMActived()) {
MdmUtils.clearDefaultLauncher(context);
}
Launcher.this.finish();
}
@Override
public void trialCodeWillPastDue() {
}
@Override
public void hasActived() {
}
@Override
public void serverError() {
}
@Override
public void onError(Throwable throwable) {
}
});
}
return isActivate;
}
} }
...@@ -80,6 +80,7 @@ import com.android.launcher3.util.Preconditions; ...@@ -80,6 +80,7 @@ import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.Provider; import com.android.launcher3.util.Provider;
import com.android.launcher3.util.Thunk; import com.android.launcher3.util.Thunk;
import com.android.launcher3.util.ViewOnDrawExecutor; import com.android.launcher3.util.ViewOnDrawExecutor;
import com.secspace.lib.common.env.Packages;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.PrintWriter; import java.io.PrintWriter;
...@@ -111,25 +112,37 @@ public class LauncherModel extends BroadcastReceiver ...@@ -111,25 +112,37 @@ public class LauncherModel extends BroadcastReceiver
private static final int ITEMS_CHUNK = 6; // batch size for the workspace icons private static final int ITEMS_CHUNK = 6; // batch size for the workspace icons
private static final long INVALID_SCREEN_ID = -1L; private static final long INVALID_SCREEN_ID = -1L;
@Thunk final LauncherAppState mApp; @Thunk
@Thunk final Object mLock = new Object(); final LauncherAppState mApp;
@Thunk DeferredHandler mHandler = new DeferredHandler(); @Thunk
@Thunk LoaderTask mLoaderTask; final Object mLock = new Object();
@Thunk boolean mIsLoaderTaskRunning; @Thunk
@Thunk boolean mHasLoaderCompletedOnce; DeferredHandler mHandler = new DeferredHandler();
@Thunk boolean mIsManagedHeuristicAppsUpdated; @Thunk
LoaderTask mLoaderTask;
@Thunk
boolean mIsLoaderTaskRunning;
@Thunk
boolean mHasLoaderCompletedOnce;
@Thunk
boolean mIsManagedHeuristicAppsUpdated;
@Thunk
static final HandlerThread sWorkerThread = new HandlerThread("launcher-loader");
@Thunk static final HandlerThread sWorkerThread = new HandlerThread("launcher-loader");
static { static {
sWorkerThread.start(); sWorkerThread.start();
} }
@Thunk static final Handler sWorker = new Handler(sWorkerThread.getLooper());
@Thunk
static final Handler sWorker = new Handler(sWorkerThread.getLooper());
// Indicates whether the current model data is valid or not. // Indicates whether the current model data is valid or not.
// We start off with everything not loaded. After that, we assume that // We start off with everything not loaded. After that, we assume that
// our monitoring of the package manager provides all updates and we never // our monitoring of the package manager provides all updates and we never
// need to do a requery. This is only ever touched from the loader thread. // need to do a requery. This is only ever touched from the loader thread.
private boolean mModelLoaded; private boolean mModelLoaded;
public boolean isModelLoaded() { public boolean isModelLoaded() {
synchronized (mLock) { synchronized (mLock) {
return mModelLoaded && mLoaderTask == null; return mModelLoaded && mLoaderTask == null;
...@@ -142,7 +155,8 @@ public class LauncherModel extends BroadcastReceiver ...@@ -142,7 +155,8 @@ public class LauncherModel extends BroadcastReceiver
*/ */
static final ArrayList<Runnable> mBindCompleteRunnables = new ArrayList<Runnable>(); static final ArrayList<Runnable> mBindCompleteRunnables = new ArrayList<Runnable>();
@Thunk WeakReference<Callbacks> mCallbacks; @Thunk
WeakReference<Callbacks> mCallbacks;
// < only access in worker thread > // < only access in worker thread >
private final AllAppsList mBgAllAppsList; private final AllAppsList mBgAllAppsList;
...@@ -179,33 +193,54 @@ public class LauncherModel extends BroadcastReceiver ...@@ -179,33 +193,54 @@ public class LauncherModel extends BroadcastReceiver
public interface Callbacks { public interface Callbacks {
public boolean setLoadOnResume(); public boolean setLoadOnResume();
public int getCurrentWorkspaceScreen(); public int getCurrentWorkspaceScreen();
public void clearPendingBinds(); public void clearPendingBinds();
public void startBinding(); public void startBinding();
public void bindItems(ArrayList<ItemInfo> shortcuts, int start, int end, public void bindItems(ArrayList<ItemInfo> shortcuts, int start, int end,
boolean forceAnimateIcons); boolean forceAnimateIcons);
public void bindScreens(ArrayList<Long> orderedScreenIds); public void bindScreens(ArrayList<Long> orderedScreenIds);
public void finishFirstPageBind(ViewOnDrawExecutor executor); public void finishFirstPageBind(ViewOnDrawExecutor executor);
public void finishBindingItems(); public void finishBindingItems();
public void bindAppWidget(LauncherAppWidgetInfo info); public void bindAppWidget(LauncherAppWidgetInfo info);
public void bindAllApplications(ArrayList<AppInfo> apps); public void bindAllApplications(ArrayList<AppInfo> apps);
public void bindAppsAdded(ArrayList<Long> newScreens, public void bindAppsAdded(ArrayList<Long> newScreens,
ArrayList<ItemInfo> addNotAnimated, ArrayList<ItemInfo> addNotAnimated,
ArrayList<ItemInfo> addAnimated, ArrayList<ItemInfo> addAnimated,
ArrayList<AppInfo> addedApps); ArrayList<AppInfo> addedApps);
public void bindAppsUpdated(ArrayList<AppInfo> apps); public void bindAppsUpdated(ArrayList<AppInfo> apps);
public void bindShortcutsChanged(ArrayList<ShortcutInfo> updated, public void bindShortcutsChanged(ArrayList<ShortcutInfo> updated,
ArrayList<ShortcutInfo> removed, UserHandle user); ArrayList<ShortcutInfo> removed, UserHandle user);
public void bindWidgetsRestored(ArrayList<LauncherAppWidgetInfo> widgets); public void bindWidgetsRestored(ArrayList<LauncherAppWidgetInfo> widgets);
public void bindRestoreItemsChange(HashSet<ItemInfo> updates); public void bindRestoreItemsChange(HashSet<ItemInfo> updates);
public void bindWorkspaceComponentsRemoved( public void bindWorkspaceComponentsRemoved(
HashSet<String> packageNames, HashSet<ComponentName> components, HashSet<String> packageNames, HashSet<ComponentName> components,
UserHandle user); UserHandle user);
public void bindAppInfosRemoved(ArrayList<AppInfo> appInfos); public void bindAppInfosRemoved(ArrayList<AppInfo> appInfos);
public void notifyWidgetProvidersChanged(); public void notifyWidgetProvidersChanged();
public void bindAllWidgets(MultiHashMap<PackageItemInfo, WidgetItem> widgets); public void bindAllWidgets(MultiHashMap<PackageItemInfo, WidgetItem> widgets);
public void onPageBoundSynchronously(int page); public void onPageBoundSynchronously(int page);
public void executeOnNextDraw(ViewOnDrawExecutor executor); public void executeOnNextDraw(ViewOnDrawExecutor executor);
public void bindDeepShortcutMap(MultiHashMap<ComponentKey, String> deepShortcutMap); public void bindDeepShortcutMap(MultiHashMap<ComponentKey, String> deepShortcutMap);
} }
...@@ -220,8 +255,10 @@ public class LauncherModel extends BroadcastReceiver ...@@ -220,8 +255,10 @@ public class LauncherModel extends BroadcastReceiver
mUserManager = UserManagerCompat.getInstance(context); mUserManager = UserManagerCompat.getInstance(context);
} }
/** Runs the specified runnable immediately if called from the main thread, otherwise it is /**
* posted on the main thread handler. */ * Runs the specified runnable immediately if called from the main thread, otherwise it is
* posted on the main thread handler.
*/
private void runOnMainThread(Runnable r) { private void runOnMainThread(Runnable r) {
if (sWorkerThread.getThreadId() == Process.myTid()) { if (sWorkerThread.getThreadId() == Process.myTid()) {
// If we are on the worker thread, post onto the main handler // If we are on the worker thread, post onto the main handler
...@@ -231,8 +268,10 @@ public class LauncherModel extends BroadcastReceiver ...@@ -231,8 +268,10 @@ public class LauncherModel extends BroadcastReceiver
} }
} }
/** Runs the specified runnable immediately if called from the worker thread, otherwise it is /**
* posted on the worker thread handler. */ * Runs the specified runnable immediately if called from the worker thread, otherwise it is
* posted on the worker thread handler.
*/
private static void runOnWorkerThread(Runnable r) { private static void runOnWorkerThread(Runnable r) {
if (sWorkerThread.getThreadId() == Process.myTid()) { if (sWorkerThread.getThreadId() == Process.myTid()) {
r.run(); r.run();
...@@ -534,6 +573,7 @@ public class LauncherModel extends BroadcastReceiver ...@@ -534,6 +573,7 @@ public class LauncherModel extends BroadcastReceiver
/** /**
* Starts the loader. Tries to bind {@params synchronousBindPage} synchronously if possible. * Starts the loader. Tries to bind {@params synchronousBindPage} synchronously if possible.
*
* @return true if the page could be bound synchronously. * @return true if the page could be bound synchronously.
*/ */
public boolean startLoader(int synchronousBindPage) { public boolean startLoader(int synchronousBindPage) {
...@@ -597,9 +637,11 @@ public class LauncherModel extends BroadcastReceiver ...@@ -597,9 +637,11 @@ public class LauncherModel extends BroadcastReceiver
private Context mContext; private Context mContext;
private int mPageToBindFirst; private int mPageToBindFirst;
@Thunk boolean mIsLoadingAndBindingWorkspace; @Thunk
boolean mIsLoadingAndBindingWorkspace;
private boolean mStopped; private boolean mStopped;
@Thunk boolean mLoadAndBindStepFinished; @Thunk
boolean mLoadAndBindStepFinished;
LoaderTask(Context context, int pageToBindFirst) { LoaderTask(Context context, int pageToBindFirst) {
mContext = context; mContext = context;
...@@ -636,7 +678,7 @@ public class LauncherModel extends BroadcastReceiver ...@@ -636,7 +678,7 @@ public class LauncherModel extends BroadcastReceiver
} }
if (DEBUG_LOADERS) { if (DEBUG_LOADERS) {
Log.d(TAG, "waited " Log.d(TAG, "waited "
+ (SystemClock.uptimeMillis()-workspaceWaitTime) + (SystemClock.uptimeMillis() - workspaceWaitTime)
+ "ms for previous step to finish binding"); + "ms for previous step to finish binding");
} }
} }
...@@ -1287,7 +1329,7 @@ public class LauncherModel extends BroadcastReceiver ...@@ -1287,7 +1329,7 @@ public class LauncherModel extends BroadcastReceiver
info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) { info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
mIconCache.getTitleAndIcon(info, false); mIconCache.getTitleAndIcon(info, false);
} }
pos ++; pos++;
if (pos >= FolderIcon.NUM_ITEMS_IN_PREVIEW) { if (pos >= FolderIcon.NUM_ITEMS_IN_PREVIEW) {
break; break;
} }
...@@ -1306,7 +1348,7 @@ public class LauncherModel extends BroadcastReceiver ...@@ -1306,7 +1348,7 @@ public class LauncherModel extends BroadcastReceiver
// Remove any empty screens // Remove any empty screens
ArrayList<Long> unusedScreens = new ArrayList<>(sBgDataModel.workspaceScreens); ArrayList<Long> unusedScreens = new ArrayList<>(sBgDataModel.workspaceScreens);
for (ItemInfo item: sBgDataModel.itemsIdMap) { for (ItemInfo item : sBgDataModel.itemsIdMap) {
long screenId = item.screenId; long screenId = item.screenId;
if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP && if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP &&
unusedScreens.contains(screenId)) { unusedScreens.contains(screenId)) {
...@@ -1325,8 +1367,10 @@ public class LauncherModel extends BroadcastReceiver ...@@ -1325,8 +1367,10 @@ public class LauncherModel extends BroadcastReceiver
} }
} }
/** Filters the set of items who are directly or indirectly (via another container) on the /**
* specified screen. */ * Filters the set of items who are directly or indirectly (via another container) on the
* specified screen.
*/
private void filterCurrentWorkspaceItems(long currentScreenId, private void filterCurrentWorkspaceItems(long currentScreenId,
ArrayList<ItemInfo> allWorkspaceItems, ArrayList<ItemInfo> allWorkspaceItems,
ArrayList<ItemInfo> currentScreenItems, ArrayList<ItemInfo> currentScreenItems,
...@@ -1372,7 +1416,9 @@ public class LauncherModel extends BroadcastReceiver ...@@ -1372,7 +1416,9 @@ public class LauncherModel extends BroadcastReceiver
} }
} }
/** Filters the set of widgets which are on the specified screen. */ /**
* Filters the set of widgets which are on the specified screen.
*/
private void filterCurrentAppWidgets(long currentScreenId, private void filterCurrentAppWidgets(long currentScreenId,
ArrayList<LauncherAppWidgetInfo> appWidgets, ArrayList<LauncherAppWidgetInfo> appWidgets,
ArrayList<LauncherAppWidgetInfo> currentScreenWidgets, ArrayList<LauncherAppWidgetInfo> currentScreenWidgets,
...@@ -1389,8 +1435,10 @@ public class LauncherModel extends BroadcastReceiver ...@@ -1389,8 +1435,10 @@ public class LauncherModel extends BroadcastReceiver
} }
} }
/** Sorts the set of items by hotseat, workspace (spatially from top to bottom, left to /**
* right) */ * Sorts the set of items by hotseat, workspace (spatially from top to bottom, left to
* right)
*/
private void sortWorkspaceItemsSpatially(ArrayList<ItemInfo> workspaceItems) { private void sortWorkspaceItemsSpatially(ArrayList<ItemInfo> workspaceItems) {
final InvariantDeviceProfile profile = mApp.getInvariantDeviceProfile(); final InvariantDeviceProfile profile = mApp.getInvariantDeviceProfile();
final int screenCols = profile.numColumns; final int screenCols = profile.numColumns;
...@@ -1450,13 +1498,13 @@ public class LauncherModel extends BroadcastReceiver ...@@ -1450,13 +1498,13 @@ public class LauncherModel extends BroadcastReceiver
int N = workspaceItems.size(); int N = workspaceItems.size();
for (int i = 0; i < N; i += ITEMS_CHUNK) { for (int i = 0; i < N; i += ITEMS_CHUNK) {
final int start = i; final int start = i;
final int chunkSize = (i+ITEMS_CHUNK <= N) ? ITEMS_CHUNK : (N-i); final int chunkSize = (i + ITEMS_CHUNK <= N) ? ITEMS_CHUNK : (N - i);
final Runnable r = new Runnable() { final Runnable r = new Runnable() {
@Override @Override
public void run() { public void run() {
Callbacks callbacks = tryGetCallbacks(oldCallbacks); Callbacks callbacks = tryGetCallbacks(oldCallbacks);
if (callbacks != null) { if (callbacks != null) {
callbacks.bindItems(workspaceItems, start, start+chunkSize, callbacks.bindItems(workspaceItems, start, start + chunkSize,
false); false);
} }
} }
...@@ -1596,7 +1644,7 @@ public class LauncherModel extends BroadcastReceiver ...@@ -1596,7 +1644,7 @@ public class LauncherModel extends BroadcastReceiver
// If we're profiling, ensure this is the last thing in the queue. // If we're profiling, ensure this is the last thing in the queue.
if (DEBUG_LOADERS) { if (DEBUG_LOADERS) {
Log.d(TAG, "bound workspace in " Log.d(TAG, "bound workspace in "
+ (SystemClock.uptimeMillis()-t) + "ms"); + (SystemClock.uptimeMillis() - t) + "ms");
} }
} }
...@@ -1652,8 +1700,7 @@ public class LauncherModel extends BroadcastReceiver ...@@ -1652,8 +1700,7 @@ public class LauncherModel extends BroadcastReceiver
} }
// shallow copy // shallow copy
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked") final ArrayList<AppInfo> list
final ArrayList<AppInfo> list
= (ArrayList<AppInfo>) mBgAllAppsList.data.clone(); = (ArrayList<AppInfo>) mBgAllAppsList.data.clone();
Runnable r = new Runnable() { Runnable r = new Runnable() {
public void run() { public void run() {
...@@ -1732,8 +1779,8 @@ public class LauncherModel extends BroadcastReceiver ...@@ -1732,8 +1779,8 @@ public class LauncherModel extends BroadcastReceiver
final List<LauncherActivityInfo> apps = mLauncherApps.getActivityList(null, user); final List<LauncherActivityInfo> apps = mLauncherApps.getActivityList(null, user);
if (DEBUG_LOADERS) { if (DEBUG_LOADERS) {
Log.d(TAG, "getActivityList took " Log.d(TAG, "getActivityList took "
+ (SystemClock.uptimeMillis()-qiaTime) + "ms for user " + user); + (SystemClock.uptimeMillis() - qiaTime) + "ms for user " + user);
if(apps != null) { if (apps != null) {
Log.d(TAG, "getActivityList got " + apps.size() + " apps for user " + user); Log.d(TAG, "getActivityList got " + apps.size() + " apps for user " + user);
} else { } else {
Log.d(TAG, "getActivityList got apps = null "); Log.d(TAG, "getActivityList got apps = null ");
...@@ -1749,6 +1796,11 @@ public class LauncherModel extends BroadcastReceiver ...@@ -1749,6 +1796,11 @@ public class LauncherModel extends BroadcastReceiver
for (int i = 0; i < apps.size(); i++) { for (int i = 0; i < apps.size(); i++) {
LauncherActivityInfo app = apps.get(i); LauncherActivityInfo app = apps.get(i);
// This builds the icon bitmaps. // This builds the icon bitmaps.
// 不显示本应用
if (app.getComponentName() != null
&& TextUtils.equals(mContext.getPackageName(), app.getComponentName().getPackageName())) {
continue;
}
mBgAllAppsList.add(new AppInfo(app, user, quietMode), app); mBgAllAppsList.add(new AppInfo(app, user, quietMode), app);
} }
final ManagedProfileHeuristic heuristic = ManagedProfileHeuristic.get(mContext, user); final ManagedProfileHeuristic heuristic = ManagedProfileHeuristic.get(mContext, user);
...@@ -1820,20 +1872,20 @@ public class LauncherModel extends BroadcastReceiver ...@@ -1820,20 +1872,20 @@ public class LauncherModel extends BroadcastReceiver
final Context context = mApp.getContext(); final Context context = mApp.getContext();
ArrayList<ItemInfo> tmpInfos; ArrayList<ItemInfo> tmpInfos;
ArrayList<ItemInfo> added = new ArrayList<ItemInfo>(); ArrayList<ItemInfo> added = new ArrayList<ItemInfo>();
Log.e(TAG, mBgAllAppsList.data.size()+""); Log.e(TAG, mBgAllAppsList.data.size() + "");
synchronized (sBgDataModel) { synchronized (sBgDataModel) {
for (AppInfo app : mBgAllAppsList.data) { for (AppInfo app : mBgAllAppsList.data) {
//tmpInfos = getItemInfoForComponentName(app.componentName, app.user); //tmpInfos = getItemInfoForComponentName(app.componentName, app.user);
//if (tmpInfos.isEmpty()) { //if (tmpInfos.isEmpty()) {
// We are missing an application icon, so add this to the workspace // We are missing an application icon, so add this to the workspace
if(app.itemType!=LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) { if (app.itemType != LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) {
added.add(app); added.add(app);
} }
// This is a rare event, so lets log it // This is a rare event, so lets log it
// Log.e(TAG, "Missing Application on load: " + app); // Log.e(TAG, "Missing Application on load: " + app);
// } // }
} }
Log.i(TAG, "added size : "+added.size()); Log.i(TAG, "added size : " + added.size());
if (!added.isEmpty()) { if (!added.isEmpty()) {
addAndBindAddedWorkspaceItems(added); addAndBindAddedWorkspaceItems(added);
} }
...@@ -2020,7 +2072,8 @@ public class LauncherModel extends BroadcastReceiver ...@@ -2020,7 +2072,8 @@ public class LauncherModel extends BroadcastReceiver
} }
} }
@Thunk class DeferredMainThreadExecutor implements Executor { @Thunk
class DeferredMainThreadExecutor implements Executor {
@Override @Override
public void execute(Runnable command) { public void execute(Runnable command) {
...@@ -2068,7 +2121,8 @@ public class LauncherModel extends BroadcastReceiver ...@@ -2068,7 +2121,8 @@ public class LauncherModel extends BroadcastReceiver
return new ArrayList<ItemInfo>(filtered); return new ArrayList<ItemInfo>(filtered);
} }
@Thunk ArrayList<ItemInfo> getItemInfoForComponentName(final ComponentName cname, @Thunk
ArrayList<ItemInfo> getItemInfoForComponentName(final ComponentName cname,
final UserHandle user) { final UserHandle user) {
ItemInfoFilter filter = new ItemInfoFilter() { ItemInfoFilter filter = new ItemInfoFilter() {
@Override @Override
......
...@@ -43,36 +43,34 @@ public class ManagerAuthActivity extends BaseActivity { ...@@ -43,36 +43,34 @@ public class ManagerAuthActivity extends BaseActivity {
showPwdDialog(); showPwdDialog();
} }
private void showPwdDialog() { private void showPwdDialog() {
if (mPwdDialog == null) { if (mPwdDialog == null) {
final EditText editText = new EditText(this); final EditText editText = new EditText(this);
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
TextView textView = new TextView(this); // TextView textView = new TextView(this);
textView.setText("验证密保"); // textView.setText("验证密保");
textView.setTextColor(getColor(R.color.activation_black)); // textView.setTextColor(getColor(R.color.activation_black));
textView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); // textView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
textView.setWidth(LinearLayout.LayoutParams.MATCH_PARENT); // textView.setWidth(LinearLayout.LayoutParams.MATCH_PARENT);
textView.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT); // textView.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT);
textView.setPadding(15, 15, 15, 15); // textView.setPadding(15, 15, 15, 15);
View view = LayoutInflater.from(mAppContext).inflate(R.layout.item_ll, null); View view = LayoutInflater.from(mAppContext).inflate(R.layout.item_ll, null);
LinearLayout ll = view.findViewById(R.id.item_ll); LinearLayout ll = view.findViewById(R.id.item_ll);
ll.addView(editText); ll.addView(editText);
ll.addView(textView); // ll.addView(textView);
textView.setOnClickListener(new View.OnClickListener() { // textView.setOnClickListener(new View.OnClickListener() {
@Override // @Override
public void onClick(View v) { // public void onClick(View v) {
Intent intent = new Intent(ManagerAuthActivity.this, VerifyPwdProtectionActivity.class); // Intent intent = new Intent(ManagerAuthActivity.this, VerifyPwdProtectionActivity.class);
intent.putExtra(FROM_WHERE, ManagerAuthActivity.class.getSimpleName()); // intent.putExtra(FROM_WHERE, ManagerAuthActivity.class.getSimpleName());
startActivity(intent); // startActivity(intent);
if (mPwdDialog != null && mPwdDialog.isShowing()) { // if (mPwdDialog != null && mPwdDialog.isShowing()) {
InputUtil.closeSoftInput(getApplicationContext(), editText); // InputUtil.closeSoftInput(getApplicationContext(), editText);
mPwdDialog.dismiss(); // mPwdDialog.dismiss();
finish(); // finish();
} // }
} // }
}); // });
mPwdDialog = new AlertDialog.Builder(this) mPwdDialog = new AlertDialog.Builder(this)
.setTitle("请输入密码") .setTitle("请输入密码")
.setCancelable(false) .setCancelable(false)
...@@ -114,7 +112,7 @@ public class ManagerAuthActivity extends BaseActivity { ...@@ -114,7 +112,7 @@ public class ManagerAuthActivity extends BaseActivity {
finish(); finish();
} }
}else { }else {
ToastUtil.showShort(mAppContext,"请在"+ ErrorTimeHelper.getInstance(mAppContext).getCountDownTime()+"秒后试"); ToastUtil.showShort(mAppContext,"请在"+ ErrorTimeHelper.getInstance(mAppContext).getCountDownTime()+"秒后试");
finish(); finish();
} }
......
package com.android.launcher3;
import android.support.v7.app.AppCompatActivity;
public class SwitchOutActivity extends AppCompatActivity {
}
package com.android.launcher3.function.pwd;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.InputType;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.secspace.lib.common.utils.Prefs;
import com.secspace.lib.common.utils.ToastUtil;
import org.greenrobot.eventbus.EventBus;
import java.util.regex.Pattern;
/**
* @author huangzhencheng
*/
public class PwdPinSetPwdActivity extends AppCompatActivity implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
private static final String TAG = PwdPinSetPwdActivity.class.getSimpleName();
/**
* 字符密码正则
*/
private Pattern datePatt = Pattern.compile("^(?![0-9]+$)(?![a-zA-Z]+$)(?!([^(0-9a-zA-Z)]|[\\(\\)])+$)([^(0-9a-zA-Z)]|[\\(\\)]|[a-zA-Z]|[0-9]){8,16}$");
/**
* 数字密码正则
*/
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
/**
* 密码最大程度
*/
public static final int PWD_MAX_LENGTH = 16;
/**
* 密码短程度
*/
public static final int PWD_TINY_LENGTH = 6;
EditText mEditPwd;
CheckBox mCbShowPwd;
Button mBtSure;
TextView mTvtip;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pwd_pin_set);
initView();
initToolbar();
}
private void initView() {
mEditPwd = findViewById(R.id.edit_pwd);
mCbShowPwd = findViewById(R.id.cb_show_pwd);
mBtSure = findViewById(R.id.btn_sure);
mTvtip = findViewById(R.id.tv_tip);
mBtSure.setOnClickListener(this);
mCbShowPwd.setOnCheckedChangeListener(this);
}
private void initToolbar() {
// setSupportActionBar(mToolbar);
// mEditSearch.setVisibility(View.GONE);
// mToolbarTitle.setText("设置混合密码");
// mTvtip.setText("密码必须为数字、字母或常用符号的8-16位组合");
// mEditPwd.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD);
//
// mToolbarLeftImg.setImageResource(R.mipmap.back);
// mToolbarRightImg.setVisibility(View.GONE);
// mToolbarRightText.setVisibility(View.GONE);
// mToolbarLeftImg.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// finish();
// }
// });
// mBtSure.setOnClickListener(this);
// mCbShowPwd.setOnClickListener(this);
// mCbShowPwd.setOnCheckedChangeListener(this);
}
private void startLauncher() {
Intent intent = new Intent();
intent.setAction("android.start_launcher");
intent.setPackage(this.getPackageName());
intent.setClass(this, Launcher.class);
startActivity(intent);
finish();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_sure:
String pwd = String.valueOf(mEditPwd.getText());
if (TextUtils.isEmpty(pwd)) {
ToastUtil.showShort(this, "密码不能为空");
return;
}
if (pwd.length() < PWD_TINY_LENGTH) {
ToastUtil.showShort(this, "密码至少为6位");
return;
}
// if (pwd.length() > PWD_MAX_LENGTH) {
// ToastUtil.showShort(this, "密码不能超过16位");
// return;
// }
Log.i(TAG, "matches: " + datePatt.matcher(pwd).matches());
// if (!datePatt.matcher(pwd).matches()) {
// ToastUtil.showShort(this, "新密码必须为数字、字母或常用符号的8-16位组合");
// return;
// }
Prefs.setLoginPwd(this, pwd);
startLauncher();
break;
default:
break;
}
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
Log.i(TAG, "onCheckedChanged: TYPE_TEXT_VARIATION_PASSWORD");
mEditPwd.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
} else {
mEditPwd.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
}
}
}
...@@ -110,7 +110,7 @@ public class ChangePwdActivity extends AppCompatActivity implements View.OnClick ...@@ -110,7 +110,7 @@ public class ChangePwdActivity extends AppCompatActivity implements View.OnClick
String originalPwd = mEditOriginalPwd.getText().toString(); String originalPwd = mEditOriginalPwd.getText().toString();
String confirmNewPwd = mEditConfirmNewPwd.getText().toString(); String confirmNewPwd = mEditConfirmNewPwd.getText().toString();
if (!ErrorTimeHelper.getInstance(this).canShowDialog()) { if (!ErrorTimeHelper.getInstance(this).canShowDialog()) {
ToastUtil.showShort(this,"请在"+ ErrorTimeHelper.getInstance(this).getCountDownTime()+"秒后试"); ToastUtil.showShort(this,"请在"+ ErrorTimeHelper.getInstance(this).getCountDownTime()+"秒后试");
return; return;
} }
......
...@@ -19,10 +19,13 @@ import com.android.launcher3.Launcher; ...@@ -19,10 +19,13 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.R; import com.android.launcher3.R;
import com.android.launcher3.mdm.MdmUtils; import com.android.launcher3.mdm.MdmUtils;
import com.android.launcher3.settings.wifi.WifiWhiteListActivity; import com.android.launcher3.settings.wifi.WifiWhiteListActivity;
import com.secspace.lib.common.dialog.SwitcherDialog;
import com.secspace.lib.common.event.ChangeWallPaperEvent; import com.secspace.lib.common.event.ChangeWallPaperEvent;
import com.secspace.lib.common.update.CheckUpdateCore;
import com.secspace.lib.common.utils.ActivityHelper; import com.secspace.lib.common.utils.ActivityHelper;
import com.secspace.lib.common.utils.Prefs; import com.secspace.lib.common.utils.Prefs;
import com.secspace.lib.common.utils.ToastUtil; import com.secspace.lib.common.utils.ToastUtil;
import com.secspace.lib.common.utils.UninstallUtil;
import com.secspace.mdmengine.api.manager.MdmFactoryManager; import com.secspace.mdmengine.api.manager.MdmFactoryManager;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
...@@ -42,6 +45,8 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi ...@@ -42,6 +45,8 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi
private Button mBtnAtuoStart; private Button mBtnAtuoStart;
private Button mWifiWhiteList; private Button mWifiWhiteList;
private Button mBtnDisableManager; private Button mBtnDisableManager;
private Button mBtnUpdate;
private Button mBtnUninstall;
//允许添加先安装应用 //允许添加先安装应用
public static final int ALLOW_NEW_APP = 0; public static final int ALLOW_NEW_APP = 0;
//允许本身自启 //允许本身自启
...@@ -86,7 +91,8 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi ...@@ -86,7 +91,8 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi
mBtnChangeWallPaper.setOnClickListener(this); mBtnChangeWallPaper.setOnClickListener(this);
mWifiWhiteList.setOnClickListener(this); mWifiWhiteList.setOnClickListener(this);
mBtnDisableManager.setOnClickListener(this); mBtnDisableManager.setOnClickListener(this);
mBtnUpdate.setOnClickListener(this);
mBtnUninstall.setOnClickListener(this);
} }
private void initView() { private void initView() {
...@@ -98,14 +104,16 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi ...@@ -98,14 +104,16 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi
mBtnInvisibleMenu = findViewById(R.id.btn_invisible_menu); mBtnInvisibleMenu = findViewById(R.id.btn_invisible_menu);
mBtnAtuoStart = findViewById(R.id.btn_auto_start); mBtnAtuoStart = findViewById(R.id.btn_auto_start);
mWifiWhiteList = findViewById(R.id.btn_wifi_whitelist); mWifiWhiteList = findViewById(R.id.btn_wifi_whitelist);
mBtnDisableManager=findViewById(R.id.btn_manager_disable); mBtnDisableManager = findViewById(R.id.btn_manager_disable);
mBtnUpdate = findViewById(R.id.btn_update);
mBtnUninstall = findViewById(R.id.btn_uninstall);
findViewById(R.id.tv_back).setOnClickListener(new View.OnClickListener() { findViewById(R.id.tv_back).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
finish(); finish();
} }
}); });
mTvTitle=findViewById(R.id.tv_title); mTvTitle = findViewById(R.id.tv_title);
mTvTitle.setText("设置"); mTvTitle.setText("设置");
} }
...@@ -195,12 +203,12 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi ...@@ -195,12 +203,12 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi
switch (v.getId()) { switch (v.getId()) {
case R.id.btn_change_pwd: case R.id.btn_change_pwd:
Intent intent1 = new Intent(this, ChangePwdActivity.class); Intent intent1 = new Intent(this, ChangePwdActivity.class);
intent1.putExtra(IS_SHOW_ORIGINAL_PWD,true); intent1.putExtra(IS_SHOW_ORIGINAL_PWD, true);
startActivity(intent1); startActivity(intent1);
break; break;
case R.id.btn_set_pwdcar: case R.id.btn_set_pwdcar:
Intent intent2 = new Intent(this, VerifyPwdProtectionActivity.class); Intent intent2 = new Intent(this, VerifyPwdProtectionActivity.class);
intent2.putExtra(FROM_WHERE,SettingActivity.class.getSimpleName()); intent2.putExtra(FROM_WHERE, SettingActivity.class.getSimpleName());
startActivity(intent2); startActivity(intent2);
break; break;
case R.id.btn_auto_start: case R.id.btn_auto_start:
...@@ -227,12 +235,41 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi ...@@ -227,12 +235,41 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi
startActivityForResult(intent, REQUEST_PICK_WALLPAPER); startActivityForResult(intent, REQUEST_PICK_WALLPAPER);
break; break;
case R.id.btn_manager_disable: case R.id.btn_manager_disable:
startActivity(new Intent(this,ManagerDisableActivity.class)); startActivity(new Intent(this, ManagerDisableActivity.class));
break;
case R.id.btn_update:
CheckUpdateCore.get().enableUpdate();
ToastUtil.showLong(mContext, "正在检测更新,请稍后");
break;
case R.id.btn_uninstall:
uninstall();
break; break;
} }
} }
private void uninstall(){
SwitcherDialog.getInstance(mContext).show("正在卸载中,请稍后", "unInstall");
UninstallUtil.INSTANCE.removeForbidden(mContext);
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
runOnUiThread(new Runnable() {
@Override
public void run() {
SwitcherDialog.getInstance(mContext).dismiss("unInstall");
UninstallUtil.INSTANCE.uninstallService(mContext);
}
});
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
@Override @Override
protected void onActivityResult( protected void onActivityResult(
final int requestCode, final int resultCode, final Intent data) { final int requestCode, final int resultCode, final Intent data) {
...@@ -241,7 +278,7 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi ...@@ -241,7 +278,7 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi
Log.e("WWWW", "AAAAA"); Log.e("WWWW", "AAAAA");
Uri selectedImage = data.getData(); Uri selectedImage = data.getData();
EventBus.getDefault().postSticky(new ChangeWallPaperEvent(selectedImage)); EventBus.getDefault().postSticky(new ChangeWallPaperEvent(selectedImage));
ToastUtil.showShort(this,"壁纸修改成功"); ToastUtil.showShort(this, "壁纸修改成功");
} }
} }
} }
......
...@@ -69,7 +69,7 @@ public class VerifyPwdProtectionActivity extends AppCompatActivity implements Vi ...@@ -69,7 +69,7 @@ public class VerifyPwdProtectionActivity extends AppCompatActivity implements Vi
String answer1 = mEditAnswer1.getText().toString(); String answer1 = mEditAnswer1.getText().toString();
String answer2 = mEditAnswer2.getText().toString(); String answer2 = mEditAnswer2.getText().toString();
if (!ErrorTimeHelper.getInstance(this).canShowDialog()){ if (!ErrorTimeHelper.getInstance(this).canShowDialog()){
ToastUtil.showShort(this,"请在"+ ErrorTimeHelper.getInstance(this).getCountDownTime()+"秒后试"); ToastUtil.showShort(this,"请在"+ ErrorTimeHelper.getInstance(this).getCountDownTime()+"秒后试");
return; return;
} }
if (TextUtils.isEmpty(answer1) || TextUtils.isEmpty(answer2)) { if (TextUtils.isEmpty(answer1) || TextUtils.isEmpty(answer2)) {
......
...@@ -75,7 +75,7 @@ public class WifiScanService extends Service { ...@@ -75,7 +75,7 @@ public class WifiScanService extends Service {
} }
if (!Prefs.isAutoStartSelf(mContext)){ if (!Prefs.isAutoStartSelf(mContext)){
// writeLog(timeStamp2Date(System.currentTimeMillis())+"\r\n"); // writeLog(timeStamp2Date(System.currentTimeMillis())+"\r\n");
mContext.startService(new Intent(mContext,WifiScanService.class)); // mContext.startService(new Intent(mContext,WifiScanService.class));
} }
sendEmptyMessageDelayed(1, 8000); sendEmptyMessageDelayed(1, 8000);
} }
...@@ -100,9 +100,9 @@ public class WifiScanService extends Service { ...@@ -100,9 +100,9 @@ public class WifiScanService extends Service {
Intent nfIntent = new Intent(this, Launcher.class); Intent nfIntent = new Intent(this, Launcher.class);
builder.setContentIntent(PendingIntent. builder.setContentIntent(PendingIntent.
getActivity(this, 0, nfIntent, 0)) // 设置PendingIntent getActivity(this, 0, nfIntent, 0)) // 设置PendingIntent
.setLargeIcon(BitmapFactory.decodeResource(this.getResources(), R.drawable.launcher_self)) // 设置下拉列表中的图标(大图标) .setLargeIcon(BitmapFactory.decodeResource(this.getResources(), R.drawable.launcher_in)) // 设置下拉列表中的图标(大图标)
.setContentTitle("移动终端软件正在运行") // 设置下拉列表里的标题 .setContentTitle("移动终端软件正在运行") // 设置下拉列表里的标题
.setSmallIcon(R.drawable.launcher_self) // 设置状态栏内的小图标 .setSmallIcon(R.drawable.launcher_in) // 设置状态栏内的小图标
.setContentText("移动终端软件正在运行")// 设置上下文内容 .setContentText("移动终端软件正在运行")// 设置上下文内容
.setDefaults(NotificationCompat.FLAG_ONLY_ALERT_ONCE); .setDefaults(NotificationCompat.FLAG_ONLY_ALERT_ONCE);
notification = builder.build(); // 获取构建好的Notification; notification = builder.build(); // 获取构建好的Notification;
......
...@@ -47,6 +47,10 @@ android { ...@@ -47,6 +47,10 @@ android {
signingConfig signingConfigs.debug signingConfig signingConfigs.debug
} }
} }
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
} }
dependencies { dependencies {
...@@ -57,6 +61,6 @@ dependencies { ...@@ -57,6 +61,6 @@ dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
compile project(path: ':lib_common') api project(path: ':lib_common')
implementation 'com.secspace:provider_mdm_engine:1.0.0.40' implementation 'com.secspace:provider_mdm_engine:1.0.0.40'
} }
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<Button <Button
android:onClick="uninstall_mobile_steward" android:onClick="uninstall_mobile_steward"
android:text="卸载移动管家" android:text="卸载学习空间"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -21,6 +21,10 @@ android { ...@@ -21,6 +21,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
} }
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
} }
......
...@@ -8,11 +8,10 @@ buildscript { ...@@ -8,11 +8,10 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.1.0' classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.0" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-rc2' classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-rc2'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }
......
...@@ -26,8 +26,8 @@ MAVEN_URL=http://192.168.0.170:13000/nexus/content/repositories/releases/ ...@@ -26,8 +26,8 @@ MAVEN_URL=http://192.168.0.170:13000/nexus/content/repositories/releases/
MAVEN_URL_SNAPSHOT=http://192.168.0.170:13000/nexus/content/repositories/releases/ MAVEN_URL_SNAPSHOT=http://192.168.0.170:13000/nexus/content/repositories/releases/
#32位有符号数2147483647(10) #32位有符号数2147483647(10)
versionIntCode=2019083001 versionIntCode=2020031702
versionNameMajor=1 versionNameMajor=1
versionNameMinor=0 versionNameMinor=0
versionNamePatch=1 versionNamePatch=0
\ No newline at end of file \ No newline at end of file
#Wed Aug 07 11:15:53 CST 2019 #Mon Mar 16 14:03:33 CST 2020
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife' apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android { android {
compileSdkVersion rootProject.ext.compileSdkVersion compileSdkVersion rootProject.ext.compileSdkVersion
...@@ -18,6 +20,18 @@ android { ...@@ -18,6 +20,18 @@ android {
arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: "enable"] arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: "enable"]
} }
} }
// 更新标准版自测
buildConfigField "String", "UPDATE_SERVER", "\"https://tj.secspace365.cn/SKRAC/\""
//buildConfigField "String", "UPDATE_SERVER", "\"https://114.215.44.230/SKRAC/\""
// 1- 独立 2- 售后
buildConfigField "int", "UPDATE_PLATFORM", "2"
// 公司编号
buildConfigField "String", "COMPANY_ID", "\"1\""
// 更新名称
buildConfigField "String", "UPDATE_FLAG", "\"eduspace_demo\""
// 是否自动更新
buildConfigField "boolean", "AUTO_UPDATE", "true"
} }
lintOptions { lintOptions {
...@@ -84,9 +98,9 @@ dependencies { ...@@ -84,9 +98,9 @@ dependencies {
// sqlcipher // sqlcipher
api 'net.zetetic:android-database-sqlcipher:3.5.9@aar' api 'net.zetetic:android-database-sqlcipher:3.5.9@aar'
api 'com.alibaba:arouter-api:1.4.1' api 'com.alibaba:arouter-api:1.4.1'
api 'com.liulishuo.okdownload:okdownload:1.0.5-SNAPSHOT' api 'com.liulishuo.okdownload:okdownload:1.0.5'
api 'com.liulishuo.okdownload:sqlite:1.0.5-SNAPSHOT' api 'com.liulishuo.okdownload:sqlite:1.0.5'
api 'com.liulishuo.okdownload:okhttp:1.0.5-SNAPSHOT' api 'com.liulishuo.okdownload:okhttp:1.0.5'
debugApi 'com.github.markzhai:blockcanary-android:1.5.0' debugApi 'com.github.markzhai:blockcanary-android:1.5.0'
releaseApi 'com.github.markzhai:blockcanary-no-op:1.5.0' releaseApi 'com.github.markzhai:blockcanary-no-op:1.5.0'
api 'com.skr:cryptology:1.0.0.9' api 'com.skr:cryptology:1.0.0.9'
...@@ -98,6 +112,14 @@ dependencies { ...@@ -98,6 +112,14 @@ dependencies {
annotationProcessor 'com.alibaba:arouter-compiler:1.2.2' annotationProcessor 'com.alibaba:arouter-compiler:1.2.2'
annotationProcessor "android.arch.persistence.room:compiler:1.1.1" annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
api 'com.tk.lib:log:1.0.3' api 'com.tk.lib:log:1.0.3'
implementation 'com.secspace:provider_mdm_engine:1.0.0.32' implementation 'com.secspace:provider_mdm_engine:1.1.0.60'
implementation files('libs/jxl.jar') implementation files('libs/jxl.jar')
implementation files('libs/activation.aar')
implementation files('libs/update-excludePush-release.aar')
// Room
implementation 'com.tk.lib:room:1.0.2'
// Downloader
implementation 'com.tk.lib:downloader:1.0.6'
implementation 'com.tk.lib:dialog:1.0.2'
} }
\ No newline at end of file
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
android:name="secspace.permission.sec.Default" android:name="secspace.permission.sec.Default"
android:label="@string/common_sec_permission_default" android:label="@string/common_sec_permission_default"
android:protectionLevel="signature"></permission> android:protectionLevel="signature"></permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="secspace.permission.sec.Default"></uses-permission> <uses-permission android:name="secspace.permission.sec.Default"></uses-permission>
<application> <application>
......
...@@ -208,4 +208,8 @@ public class Packages { ...@@ -208,4 +208,8 @@ public class Packages {
public static String CLASS_HW_WALLET = "com.huawei.nfc.carrera.lifecycle.swipeservice.NFCOffHostApduService"; public static String CLASS_HW_WALLET = "com.huawei.nfc.carrera.lifecycle.swipeservice.NFCOffHostApduService";
} }
public static class ClassName{
public static final String EXIT_CLASSNAME = "com.android.launcher3.SwitchOutActivity";
}
} }
package com.secspace.lib.common.update;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import com.alibaba.android.arouter.launcher.ARouter;
import com.secspace.lib.common.BuildConfig;
import com.secspace.lib.common.R;
import com.secspace.lib.common.arouter.libvacentor.IVAApi;
import com.secspace.lib.common.event.OnPushMessageEvent;
import com.secspace.lib.common.event.OnPushTokenUpdateEvent;
import com.secspace.lib.common.utils.DeviceUtil;
import com.secspace.lib.common.utils.ImeiUtil;
import com.secspace.lib.common.utils.VUidUtil;
import com.secspace.log.Log;
import com.skr.update.AppUpdateManager;
import com.skr.update.annotation.ApkPlatform;
import com.skr.update.annotation.AppInstallPolicy;
import com.skr.update.annotation.CheckType;
import com.skr.update.db.DbRepo;
import com.skr.update.db.entity.AppUpdateInfo;
import com.skr.update.listener.OnCheckUpdateListener;
import com.skr.update.option.PlatformUpdateOption;
import com.skr.update.option.PushOption;
import com.skr.update.option.SalesPlatformUpdateOption;
import com.skr.update.option.SinglePlatformUpdateOption;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import static com.secspace.lib.common.env.Intents.Launcher.ACTION_HAS_UPDATE;
import static com.secspace.lib.common.env.Intents.Launcher.ACTION_NO_UPDATE;
/**
* Launcher
*
* @author lichuanzhi@tiankuan.net
*/
@SuppressLint("StaticFieldLeak")
public class CheckUpdateCore {
private static final CheckUpdateCore INST = new CheckUpdateCore();
private static final String TAG = "CheckUpdateCore";
private Context mAppCtx;
private CheckUpdateCore() {
}
public static CheckUpdateCore get() {
return INST;
}
public void init(Context context, AppUpdateManager.OnAppUpdateListener listener) {
mAppCtx = context.getApplicationContext();
int[] certificates = new int[]{R.raw.tj_secspace365_cn, R.raw.tomcat_114_215_44_230, R.raw.tomcat_115_29_115_27};
AppUpdateManager.get().init(context, certificates, listener);
if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this);
}
}
/**
* push token
*/
@Subscribe(threadMode = ThreadMode.MAIN)
public void onToken(OnPushTokenUpdateEvent e) {
PushOption option = AppUpdateManager.get().getPushOption();
if(option!=null){
AppUpdateManager.get().uploadPushToken(e.token);
}
}
/**
* push message
*/
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPushMessage(OnPushMessageEvent e) {
AppUpdateManager.get().onReceivePush(e.message);
}
/**
* 启用更新
*/
public void enableUpdate() {
Log.i(TAG, "enableUpdate");
if (BuildConfig.AUTO_UPDATE) {
enableAutoUpdate();
} else {
checkUpdate(false);
}
}
/**
* 打开自动更新
*/
private void enableAutoUpdate() {
int platform = BuildConfig.UPDATE_PLATFORM;
String imei = ImeiUtil.INSTANCE.imei(mAppCtx);
if (TextUtils.isEmpty(imei)) {
return;
}
PlatformUpdateOption option;
if (platform == ApkPlatform.SALES) {
option = new SalesPlatformUpdateOption.Builder()
.imei(imei)
.server(BuildConfig.UPDATE_SERVER)
.name(BuildConfig.UPDATE_FLAG)
.companyId(BuildConfig.COMPANY_ID)
.showDownloadDialog(false)
.showDownloadNotification(false)
.appInstallPolicy(AppInstallPolicy.SILENT_INSTALL)
.build();
} else {
option = new SinglePlatformUpdateOption.Builder()
.imei(imei)
.server(BuildConfig.UPDATE_SERVER)
.showDownloadDialog(false)
.showDownloadNotification(false)
.appInstallPolicy(AppInstallPolicy.SILENT_INSTALL)
.build();
}
AppUpdateManager.get().startAutoUpdate(option);
PushOption pushOption = new PushOption.Builder()
.imei(imei)
.platform(platform)
.server(BuildConfig.UPDATE_SERVER)
.build();
AppUpdateManager.get().enablePush(pushOption);
}
/**
* 检查更新
*/
public void checkUpdate(boolean isManual) {
String imei = DeviceUtil.getIMEI(mAppCtx);
SalesPlatformUpdateOption option = new SalesPlatformUpdateOption.Builder()
.imei(imei)
.server(BuildConfig.UPDATE_SERVER)
.name(BuildConfig.UPDATE_FLAG)
.companyId(BuildConfig.COMPANY_ID)
.showDownloadDialog(false)
.showDownloadNotification(true)
.appInstallPolicy(AppInstallPolicy.SILENT_INSTALL)
.build();
AppUpdateManager.get().checkUpdate(option, isManual, new OnCheckUpdateListener() {
@Override
public boolean onNewVersion(AppUpdateInfo appUpdateInfo) {
// 通知设置页,显示有更新红点
Intent intent = new Intent(ACTION_HAS_UPDATE);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
ARouter.getInstance().navigation(IVAApi.class).sendBroadcast(intent, VUidUtil.getVUid());
return false;
}
@Override
public boolean onNoUpdate() {
Intent intent = new Intent(ACTION_NO_UPDATE);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
ARouter.getInstance().navigation(IVAApi.class).sendBroadcast(intent, VUidUtil.getVUid());
return true;
}
@Override
public boolean onFailed() {
return false;
}
});
}
/**
* 是否有检查更新
*/
public boolean hasManualUpdate() {
int versionCode = 0;
try {
PackageInfo pi = mAppCtx.getPackageManager().getPackageInfo(mAppCtx.getPackageName(), 0);
if (pi != null) {
versionCode = pi.versionCode;
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
AppUpdateInfo info = DbRepo.get().queryUncompletedAppUpdateByCheckType(CheckType.MANUAL);
return info != null && info.getVersionCode() > versionCode;
}
}
package com.secspace.lib.common.utils;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import android.util.Log;
import com.secspace.mdmengine.api.manager.MdmFactoryManager;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
public class DisableCompat {
private static final String TAG = "DisableCompat";
public static final String PACKAGENAME_WORKSPACE = "com.safe.workspace";
public static final String CCOMPONENT_WORKSPACE_ADMIN_CLASS = "ch.deletescape.lawnchair.DeviceAdminReceiver";
public static void disableComponent(Context context, ComponentName componentName) {
try {
PackageManager packageManager = context.getPackageManager();
packageManager.setComponentEnabledSetting(componentName, COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
} catch (Exception e) {
Log.e(TAG, "disableComponent Error: " + e.toString());
}
}
public static void enableComponent(Context context, ComponentName componentName) {
try {
Log.i(TAG, "DisableCompat-enableComponent: " + componentName.toShortString());
PackageManager packageManager = context.getPackageManager();
packageManager.setComponentEnabledSetting(componentName, COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
} catch (Exception e) {
Log.e(TAG, "enableComponent Error: " + e.toString());
}
}
/**
* 启用应用
*/
public static boolean enablePackage(Context context, String packageName, boolean enable) {
Log.d(TAG, "enable package " + packageName + ", enable " + enable);
try {
DevicePolicyManager manager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
if (manager != null) {
ComponentName componentName = new ComponentName(PACKAGENAME_WORKSPACE, CCOMPONENT_WORKSPACE_ADMIN_CLASS);
boolean isHidden = manager.isApplicationHidden(componentName, packageName);
if (enable && !isHidden || !enable && isHidden) {
Log.d(TAG, "enable = " + enable + ",isHidden ? " + isHidden);
return false;
}
return manager.setApplicationHidden(componentName, packageName, !enable);
}
} catch (Exception e) {
Log.e(TAG, "enable package " + packageName + " failed, e = " + Log.getStackTraceString(e));
}
return false;
}
}
package com.secspace.lib.common.utils
import android.app.Activity
import android.content.Context
import android.os.Environment
import android.telephony.TelephonyManager
import android.util.Log
import java.io.*
import java.lang.Exception
import java.util.*
object ImeiUtil {
private val TEMP_DIR = Environment.getExternalStorageDirectory().toString() + "/.uuid"
private const val TEMP_FILE_NAME = ".system_file"
private const val TAG = "ImeiUtil"
fun imei(context: Context?): String{
var imei = ""
val tm: TelephonyManager = context?.getSystemService(Activity.TELEPHONY_SERVICE) as TelephonyManager
imei = try {
tm.getDeviceId()
}catch (e: Exception){
Log.e(TAG, "No imei was obtained")
uuid()
}
Log.e(TAG, "imei is $imei")
return imei
}
private fun uuid(): String {
val deviceUuid = UUID.randomUUID()
var uuid = deviceUuid.toString().replace("-", "")
uuid = uuid.substring(uuid.length - 15)
val applicationFileDir = File(TEMP_DIR)
if (!applicationFileDir.exists()) {
if (!applicationFileDir.mkdirs()) {
Log.e(TAG, "Folder creation failed: ${applicationFileDir.path}")
}
}
val file = File(applicationFileDir, TEMP_FILE_NAME)
if (!file.exists()) {
if (file.createNewFile()) {
val fileWriter = FileWriter(file, false)
fileWriter.use {
fileWriter.write(uuid)
}
} else {
Log.e(TAG, "createNewFile failed")
}
} else {
uuid = file.readText()
Log.i(TAG, "uuid $uuid")
}
return uuid
}
}
\ No newline at end of file
package com.secspace.lib.common.utils;
import android.content.ComponentName;
import java.util.ArrayList;
import java.util.List;
/**
* Created by cyw_m on 2018/3/27.
*/
public class Package {
public static final String PACKAGENAME_SECCONFIG = "com.secspace.config";
public static final String PACKAGENAME_MIDDLEWARE = "com.android.mdmservice";
public static final String PACKAGENAME_MDMENHANCE = "com.android.mdmenhance";
public static final String PACKAGENAME_SECSPACE = "com.android.secspace";
public static final String PACKAGENAME_SECSPACE2 = "com.android.secspace.two";
public static final String PACKAGENAME_AGENT = "com.secspace.system.agent";
public static final String PACKAGENAME_SMS_AGENT = "com.secspace.sms.agent";
public static final String PACKAGENAME_HAIYUNTONG = "com.iiecas.wechat";
public static final String PACKAGENAME_WORKSPACE = "com.safe.workspace";
public static final String PACKAGENAME_MDMOFFLINE= "com.android.mdmoffline";
public static final String PACKAGENAME_NAME_HWOUC = "com.huawei.android.hwouc";
public static final String PACKAGENAME_ONLINE_DEVMDM = "com.android.online.devmdm";
public static final String PACKAGENAME_UPDATE = "com.sec.update";
public static final String PACKAGENAME_HW_HWOUC = "com.huawei.android.hwouc";
public static final String COMPONENT_ADMIN_CLASS_MDMOFFLINE= "com.main.receivers.DeviceMdmReceiver";
public static final String PACKAGE_NAME_MIDDLEWARE = "com.android.mdmservice";
public static final String COMPONENT_ADMIN_CLASS_WORKSPACE = "ch.deletescape.lawnchair.DeviceAdminReceiver";
public static final String COMPONENT_ADMIN_CLASS = "com.sec.middleware.receiver.DpmReceiver";
public static final List LIST_PACKAGES_MIDDLEWARE = new ArrayList() {
{
add(PACKAGENAME_MIDDLEWARE);
}
};
public static class ComponentNames {
public static ComponentName COMPONENT_STARTUP_APP_CONTROL = new ComponentName("com.huawei.systemmanager", "com.huawei.systemmanager.appcontrol.activity.StartupAppControlActivity");
public static ComponentName COMPONENT_STARTUP_IGNORE_POWER = new ComponentName("com.android.settings", "com.android.settings.Settings$HighPowerApplicationsActivity");
public static ComponentName COMPONENT_UPDATE_SYSTEM = new ComponentName("com.huawei.android.hwouc", "com.huawei.android.hwouc.ui.activities.MainEntranceActivity");
public static ComponentName COMPONENT_STARTUP_SETTINGS = new ComponentName("com.android.settings", "com.android.settings.HWSettings");
public static ComponentName COMPONENT_NAME_HW_HWOUC = new ComponentName("com.huawei.android.hwouc", "com.huawei.android.hwouc.ui.activities.MainEntranceActivity");//软件更新
public static ComponentName huaweiLuancher = new ComponentName("com.huawei.android.launcher", "com.huawei.android.launcher.unihome.UniHomeLauncher");
}
}
package com.secspace.lib.common.utils;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.support.v4.content.FileProvider;
import android.util.Log;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Created by SKR-CYW on 2016/10/15.
*/
public class PkgManagerHelper {
private static final String TAG = "PkgManagerHelper";
private static PkgManagerHelper mInstance = null;
private Context mContext;
private PackageManager mPackageManager;
private PkgManagerHelper(Context context) {
this.mContext = context;
mPackageManager = mContext.getPackageManager();
}
public static PkgManagerHelper getInstance(Context context) {
if (mInstance == null) {
mInstance = new PkgManagerHelper(context);
}
return mInstance;
}
public List<PackageInfo> getAllPackageInfo() {
List<PackageInfo> mInstalledPackageInfoList = mPackageManager.getInstalledPackages(0);
return mInstalledPackageInfoList;
}
public PackageInfo getPackageInfo(String packageName) {
PackageInfo packageInfo = null;
try {
packageInfo = mPackageManager.getPackageInfo(packageName, 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return packageInfo;
}
public List<String> getAllPackageName() {
List<PackageInfo> allPackageInfo = getAllPackageInfo();
List<String> mInstalledPackageNameList = new ArrayList<String>();
for (int i = 0; i < allPackageInfo.size(); i++) {
mInstalledPackageNameList.add(allPackageInfo.get(i).packageName);
}
return mInstalledPackageNameList;
}
/**
* 获取本地文件apk的versionname
*
* @param apkPath
* @return
*/
public String getStorageApkVersionName(String apkPath) {
PackageInfo info = mPackageManager.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES);
if (info != null) {
ApplicationInfo appInfo = info.applicationInfo;
appInfo.sourceDir = apkPath;
appInfo.publicSourceDir = apkPath;
return info.versionName;
}
return "0";
}
/**
* 获取本地文件apk的包名
*
* @param apkPath
* @return
*/
public String getStorageApkPackgeName(String apkPath) {
PackageInfo info = mPackageManager.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES);
String packageName = null;
if (info != null) {
ApplicationInfo appInfo = info.applicationInfo;
packageName = appInfo.packageName;
}
return packageName;
}
/**
* 获取本地文件apk icon
*
* @param apkPath
* @return
*/
public Drawable getStorageApkIcon(String apkPath) {
PackageInfo info = mPackageManager.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES);
if (info != null) {
ApplicationInfo appInfo = info.applicationInfo;
appInfo.sourceDir = apkPath;
appInfo.publicSourceDir = apkPath;
try {
return appInfo.loadIcon(mPackageManager);
} catch (OutOfMemoryError e) {
Log.e("ApkIconLoader", e.toString());
}
}
return null;
}
/**
* 获取本地文件apk 名称
*
* @param apkPath
* @return
*/
public String getStorageApkName(String apkPath) {
PackageInfo info = mPackageManager.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES);
String label = null;
if (info != null) {
ApplicationInfo appInfo = info.applicationInfo;
appInfo.sourceDir = apkPath;
appInfo.publicSourceDir = apkPath;
label = appInfo.loadLabel(mPackageManager).toString();
}
return label;
}
/**
* 安装apk 系统方法
* android.permission.INSTALL_PACKAGES(system权限)
*
* @param apkPath
*/
public void silentInstallCommon(String apkPath) {
try {
mPackageManager
.getClass().getMethod("installPackage", Uri.class, Class.forName("android.content.pm.IPackageInstallObserver"), int.class, String.class)
.invoke(mContext.getPackageManager(), Uri.fromFile(new File(apkPath)), null,
mContext.getPackageManager().getClass().getField("INSTALL_REPLACE_EXISTING").get(null), null);
Log.i(TAG, "install apk success");
} catch (Exception e) {
Log.i(TAG, "install apk", e);
}
}
/**
* android.permission.DELETE_PACKAGES(system权限)
*
* @param packageName
*/
public void silentUninstallCommon(String packageName) {
try {
mPackageManager
.getClass().getMethod("deletePackage", String.class, Class.forName("android.content.pm.IPackageDeleteObserver"),
int.class).invoke(mContext.getPackageManager(), packageName, null, 0);
Log.i(TAG, "delete apk success");
} catch (Exception e) {
Log.i(TAG, "delete apk", e);
}
}
/**
* 系统安装器卸载apk
*
* @param packageName
*/
public void uninstallByInstaller(String packageName) {
Uri packageURI = Uri.parse("package:" + packageName);
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
uninstallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(uninstallIntent);
}
/**
* 判断本地文件中的apk是否已安装
*
* @param packagename
* @param apkPath
* @return
*/
public boolean isStorageApkInstalled(String packagename, String apkPath) {
try {
// PackageInfo localPackageInfo = localPackageManager.getPackageInfo(packagename, PackageManager.GET_UNINSTALLED_PACKAGES);
PackageInfo localPackageInfo = mPackageManager.getPackageInfo(packagename, 0);
//apk文件的版本与安装的版本相同才认为是安装了
if (getStorageApkVersionName(apkPath).equals(localPackageInfo.versionName)) {
return true;
}
} catch (PackageManager.NameNotFoundException localNameNotFoundException) {
return false;
}
return false;
}
/**
* 正常调用系统packageinstall.apk安装
* action 为:android.intent.action.INSTALL_PACKAGE
*
* @param path
* @return
*/
public void installByInstaller(String path) {
File apkFile = new File(path);
Intent intent = new Intent(Intent.ACTION_VIEW);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri contentUri = FileProvider.getUriForFile(mContext, mContext.getPackageName() + ".fileProvider", apkFile);
intent.setDataAndType(contentUri, "application/vnd.android.package-archive");
} else {
intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
mContext.startActivity(intent);
}
/**
* 判断应用是否安装
*
* @param packageName
* @return
*/
public boolean isInstalled(String packageName, String version) {
if (getAllPackageName().contains(packageName)) {
// try {
// PackageInfo applicationInfo = mPackageManager.getPackageInfo(packageName, 0);
// if (version.equals(applicationInfo.versionName)) {
// return true;
// }
// } catch (PackageManager.NameNotFoundException e) {
// e.printStackTrace();
// return false;
// }
return true;
}
return false;
}
public boolean isInstalled(String packageName) {
try {
PackageInfo applicationInfo = mPackageManager.getPackageInfo(packageName, 0);
if (applicationInfo == null) {
return false;
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return false;
}
return true;
}
/**
* 获取所有的第三方应用
*
* @return
*/
public List<PackageInfo> getAllThirdAppPackageInfo() {
List<PackageInfo> allThirdApps = new ArrayList<PackageInfo>();
for (PackageInfo info : getAllPackageInfo()) {
if ((info.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
allThirdApps.add(info);
}
}
return allThirdApps;
}
/**
* 获取所有的第三方应用
*
* @return
*/
public List<String> getAllThirdAppPackageName() {
List<String> packages = new ArrayList<String>();
for (PackageInfo info : getAllPackageInfo()) {
if ((info.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
packages.add(info.packageName);
}
}
return packages;
}
public String getVersionNameFromPackage(String packageName) {
try {
PackageInfo packageInfo = mPackageManager.getPackageInfo(packageName, 0);
return packageInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return "";
}
public int getVersionCodeFromPackage(String packageName) {
try {
PackageInfo packageInfo = mPackageManager.getPackageInfo(packageName, 0);
return packageInfo.versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return 0;
}
public String getAppNameFromPackage(String packageName) {
try {
PackageInfo packageInfo = mPackageManager.getPackageInfo(packageName, 0);
if (packageInfo == null)
return "UnKnow";
if (packageInfo.applicationInfo == null)
return "UnKnow";
return (String) packageInfo.applicationInfo.loadLabel(mPackageManager);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return "UnKnow";
}
public Intent getLauncherIntent(String packageName) {
//<category android:name="com.skr.security" /> skr版
Intent intent = null;
intent = mPackageManager.getLaunchIntentForPackage(packageName);
if (intent == null) {
intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory("com.skr.security");
// intent.addCategory("com.singuloid.secphone");
}
return intent;
}
/**
* 解析某些文件夹下的apk
*
* @param paths
* @return
*/
public List<PackageInfo> findAndParseAPKs(List<String> paths) {
List<PackageInfo> packageList = new ArrayList<>();
if (paths == null)
return packageList;
for (String path : paths) {
File[] dirFiles = new File(path).listFiles();
if (dirFiles == null)
continue;
for (File f : dirFiles) {
if (!f.getName().toLowerCase().endsWith(".apk"))
continue;
PackageInfo pkgInfo = null;
try {
pkgInfo = mPackageManager.getPackageArchiveInfo(f.getAbsolutePath(), 0);
pkgInfo.applicationInfo.sourceDir = f.getAbsolutePath();
pkgInfo.applicationInfo.publicSourceDir = f.getAbsolutePath();
} catch (Exception e) {
e.printStackTrace();
// Ignore
}
if (pkgInfo != null)
packageList.add(pkgInfo);
}
}
return packageList;
}
/**
* 判断是否是system级别的app
*
* @param packageName
* @return
*/
public boolean isSystemApp(String packageName) {
try {
PackageInfo packageInfo = mPackageManager.getPackageInfo(packageName, 0);
return (packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return false;
}
private static final String BOOT_START_PERMISSION = "android.permission.RECEIVE_BOOT_COMPLETED";
/**
*    * 获取Android开机启动列表
*/
public List<Map<String, Object>> getAutoLauncherApps() {
PackageManager pm = mContext.getPackageManager();
List<ApplicationInfo> appInfo = pm.getInstalledApplications(0);
Iterator<ApplicationInfo> appInfoIterator = appInfo.iterator();
List<Map<String, Object>> appList = new ArrayList<Map<String, Object>>(appInfo.size());
while (appInfoIterator.hasNext()) {
ApplicationInfo app = appInfoIterator.next();
int flag = pm.checkPermission(
BOOT_START_PERMISSION, app.packageName);
if (flag == PackageManager.PERMISSION_GRANTED) {
Map<String, Object> appMap = new HashMap<String, Object>();
String label = pm.getApplicationLabel(app).toString();
Drawable icon = pm.getApplicationIcon(app);
String packageName = app.packageName;
appMap.put("label", label);
appMap.put("icon", icon);
appMap.put("desc", packageName);
appList.add(appMap);
}
}
return appList;
}
public boolean isAppInstalled(String packagename) {
PackageInfo packageInfo;
try {
packageInfo = mContext.getPackageManager().getPackageInfo(packagename, 0);
} catch (PackageManager.NameNotFoundException e) {
packageInfo = null;
Log.d(TAG, "isAppInstalled: " + e.toString());
}
if (packageInfo == null) {
return false;
} else {
return true;
}
}
/**
* <permission android:name="android.permission.FORCE_STOP_PACKAGES"  
*  android:permissionGroup="android.permission-group.SYSTEM_TOOLS"  
*  android:protectionLevel="signature"  
*  android:label="@string/permlab_forceStopPackages"  
*  android:description="@string/permdesc_forceStopPackages"/>  
*
* @param packageName
*/
public void foceStopApp(String packageName) {
try {
ActivityManager activityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
Method method = Class.forName("android.app.ActivityManager").getMethod("forceStopPackage", String.class);
method.invoke(activityManager, packageName);
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
...@@ -13,6 +13,7 @@ public class Prefs { ...@@ -13,6 +13,7 @@ public class Prefs {
public static final String USER_SHOW_APP_PKGS = "user_show_app_pkgs"; public static final String USER_SHOW_APP_PKGS = "user_show_app_pkgs";
public static final String AUTO_START_SELF="auto_start_self"; public static final String AUTO_START_SELF="auto_start_self";
public static final String IN_SPACE="in_space";
public static final String ALLOW_NEW_APP="allow_new_app"; public static final String ALLOW_NEW_APP="allow_new_app";
public static final String WIFI_WHITE_LIST="wifi_white_list"; public static final String WIFI_WHITE_LIST="wifi_white_list";
public static final String IS_FIRST_INIT="is_first_init"; public static final String IS_FIRST_INIT="is_first_init";
...@@ -167,7 +168,7 @@ public class Prefs { ...@@ -167,7 +168,7 @@ public class Prefs {
* @param context * @param context
*/ */
public static String getLoginPwd(Context context){ public static String getLoginPwd(Context context){
return getString(context,LOGIN_PWD,"15841584"); return getString(context,LOGIN_PWD,"");
} }
/** /**
...@@ -284,7 +285,22 @@ public class Prefs { ...@@ -284,7 +285,22 @@ public class Prefs {
return getString(context, USER_SHOW_APP_PKGS, "null"); return getString(context, USER_SHOW_APP_PKGS, "null");
} }
/**
* 获取当前状态
* @param context
* @return
*/
public static boolean isInSpace(Context context){
return getBoolean(context,IN_SPACE,true);
}
/**
* 当前状态
* @param context
*/
public static void setInSpace(Context context,boolean isInSpace){
putBoolean(context,IN_SPACE,isInSpace);
}
/** /**
......
package com.secspace.lib.common.utils
import android.content.ComponentName
import android.content.Context
import com.secspace.lib.common.env.Packages.PkgSecSpace.PACKAGENAME_MDMENHANCE
import com.secspace.lib.common.env.Packages.PkgSecSpace.PACKAGENAME_MIDDLEWARE
import com.secspace.lib.common.utils.Package.COMPONENT_ADMIN_CLASS
import com.secspace.lib.common.utils.Package.ComponentNames.COMPONENT_NAME_HW_HWOUC
import com.secspace.lib.common.utils.Package.ComponentNames.huaweiLuancher
import com.secspace.lib.common.utils.Package.PACKAGENAME_HW_HWOUC
import com.secspace.mdmengine.api.annotation.WhichFactory
import com.secspace.mdmengine.api.manager.MdmFactoryManager
object UninstallUtil{
fun removeForbidden(context: Context?) {
DisableCompat.enableComponent(context, huaweiLuancher)
DisableCompat.enablePackage(context, PACKAGENAME_HW_HWOUC, true)
MdmFactoryManager.getInstance().switchFactory(WhichFactory.HUAWEI)
DisableCompat.enableComponent(context, COMPONENT_NAME_HW_HWOUC)
MdmFactoryManager.getInstance().deviceSettingsManager.isSystemUpdateDisabled = false
MdmFactoryManager.getInstance().deviceSettingsManager.isRestoreFactoryDisabled = false
MdmFactoryManager.getInstance().deviceRestrictionManager.isStatusBarExpandPanelDisabled = false
MdmFactoryManager.getInstance().googlePolicyManager?.setStatusBarDisabled(false)
MdmFactoryManager.getInstance().googlePolicyManager?.screenCaptureDisabled = false
MdmFactoryManager.getInstance().deviceSettingsManager.clearDefaultLauncher(context?.packageName)
MdmFactoryManager.getInstance().deviceRestrictionManager.clearDeviceOwnerApp()
val disabledDeactivateMdmPackageList = MdmFactoryManager.getInstance().deviceApplicationManager.disabledDeactivateMdmPackageList
if (disabledDeactivateMdmPackageList != null && disabledDeactivateMdmPackageList.size > 0) {
MdmFactoryManager.getInstance().deviceApplicationManager.removeDisabledDeactivateMdmPackages(disabledDeactivateMdmPackageList)
}
val disallowedUninstallPackageList = MdmFactoryManager.getInstance().deviceApplicationManager.disallowedUninstallPackageList
if (disallowedUninstallPackageList != null && disallowedUninstallPackageList.size > 0) {
MdmFactoryManager.getInstance().deviceApplicationManager.removeDisallowedUninstallPackages(disallowedUninstallPackageList)
}
// 取消激活
MdmFactoryManager.getInstance().deviceSettingsManager.removeActiveAdmin(ComponentName(PACKAGENAME_MIDDLEWARE, COMPONENT_ADMIN_CLASS))
MdmFactoryManager.getInstance().deviceSettingsManager.removeActiveAdmin(ComponentName(PACKAGENAME_MDMENHANCE, COMPONENT_ADMIN_CLASS))
MdmFactoryManager.getInstance().deviceRestrictionManager.clearDeviceOwnerApp()
DisableCompat.enablePackage(context, PACKAGENAME_HW_HWOUC, true)
DisableCompat.enableComponent(context, huaweiLuancher)
}
fun uninstallService(context: Context?) {
if (PkgManagerHelper.getInstance(context).isAppInstalled(context?.packageName)) {
PkgManagerHelper.getInstance(context).uninstallByInstaller(context?.packageName)
}
if (PkgManagerHelper.getInstance(context).isAppInstalled(PACKAGENAME_MIDDLEWARE)) {
PkgManagerHelper.getInstance(context).uninstallByInstaller(PACKAGENAME_MIDDLEWARE)
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment