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 <ImageView
android:layout_width="match_parent" android:id="@+id/icon"
android:layout_height="match_parent"> android:layout_width="42dp"
android:layout_height="42dp"
<ImageView android:layout_alignParentStart="true"
android:id="@+id/icon" android:layout_centerVertical="true"
android:layout_width="42dp" tools:src="@mipmap/ic_launcher_home" />
android:layout_height="42dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
tools:src="@mipmap/ic_launcher_home" />
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_toRightOf="@+id/icon" android:layout_toRightOf="@+id/icon"
android:textColor="@color/material_black" android:textColor="@color/material_black"
android:textSize="16sp" android:textSize="16sp"
tools:text="安全域" /> tools:text="安全域" />
<CheckBox <CheckBox
android:id="@+id/id_cb_show" android:id="@+id/id_cb_show"
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_centerInParent="true" android:layout_alignParentEnd="true"
android:layout_alignParentEnd="true"/> android:layout_centerInParent="true"
</RelativeLayout> android:visibility="gone" />
</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);
}
} }
...@@ -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");
}
}
...@@ -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