Commit 6786e8ed by huangzhencheng

fix:添加的应用返回桌面后丢失的问题

parent 58b98f28
......@@ -2,6 +2,5 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/Launcher3" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
/*
**
** Copyright 2016, The Android Open Source Project
......@@ -17,10 +16,10 @@
** limitations under the License.
*/
-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.launcher3"
android:sharedUserId="com.secspace.runtime">
<uses-sdk android:targetSdkVersion="23" />
<!--
......@@ -33,10 +32,10 @@
-->
<permission
android:name="com.android.launcher.permission.INSTALL_SHORTCUT"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="dangerous"
android:description="@string/permdesc_install_shortcut"
android:label="@string/permlab_install_shortcut"
android:description="@string/permdesc_install_shortcut" />
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="dangerous" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
......@@ -44,78 +43,87 @@
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
<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"/>
<application
android:backupAgent="com.android.launcher3.LauncherBackupAgent"
android:fullBackupOnly="true"
android:fullBackupContent="@xml/backupscheme"
android:fullBackupOnly="true"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher_home"
android:label="@string/derived_app_name"
android:largeHeap="@bool/config_largeHeap"
android:restoreAnyVersion="true"
android:supportsRtl="true" >
android:supportsRtl="true">
<!-- Intent received used to install shortcuts from other applications -->
<receiver
android:name="com.android.launcher3.InstallShortcutReceiver"
android:permission="com.android.launcher.permission.INSTALL_SHORTCUT"
android:enabled="@bool/enable_install_shortcut_api" >
android:enabled="@bool/enable_install_shortcut_api"
android:permission="com.android.launcher.permission.INSTALL_SHORTCUT">
<intent-filter>
<action android:name="com.android.launcher.action.INSTALL_SHORTCUT" />
</intent-filter>
</receiver>
<!-- Intent received when a session is committed -->
<receiver
android:name="com.android.launcher3.SessionCommitReceiver" >
<receiver android:name="com.android.launcher3.SessionCommitReceiver">
<intent-filter>
<action android:name="android.content.pm.action.SESSION_COMMITTED" />
</intent-filter>
</receiver>
<!-- Intent received used to initialize a restored widget -->
<receiver android:name="com.android.launcher3.AppWidgetsRestoredReceiver" >
<receiver android:name="com.android.launcher3.AppWidgetsRestoredReceiver">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_HOST_RESTORED"/>
<action android:name="android.appwidget.action.APPWIDGET_HOST_RESTORED" />
</intent-filter>
</receiver>
<service android:name="com.android.launcher3.dynamicui.ColorExtractionService"
<service
android:name="com.android.launcher3.dynamicui.ColorExtractionService"
android:exported="false"
android:process=":wallpaper_chooser"
android:permission="android.permission.BIND_JOB_SERVICE">
</service>
android:permission="android.permission.BIND_JOB_SERVICE"
android:process=":wallpaper_chooser"></service>
<service android:name="com.android.launcher3.notification.NotificationListener"
android:enabled="@bool/notification_badging_enabled"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<service
android:name="com.android.launcher3.notification.NotificationListener"
android:enabled="@bool/notification_badging_enabled"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
<meta-data android:name="android.nfc.disable_beam_default"
android:value="true" />
<meta-data
android:name="android.nfc.disable_beam_default"
android:value="true" />
<activity android:name="com.android.launcher3.dragndrop.AddItemActivity"
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog.Alert"
android:excludeFromRecents="true"
<activity
android:name="com.android.launcher3.dragndrop.AddItemActivity"
android:autoRemoveFromRecents="true"
android:label="@string/action_add_to_workspace" >
android:excludeFromRecents="true"
android:label="@string/action_add_to_workspace"
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog.Alert">
<intent-filter>
<action android:name="android.content.pm.action.CONFIRM_PIN_SHORTCUT" />
<action android:name="android.content.pm.action.CONFIRM_PIN_APPWIDGET" />
</intent-filter>
</activity>
<activity android:name=".settings.AppChooseActivity"
<activity
android:name=".settings.AppChooseActivity"
android:excludeFromRecents="true"
android:theme="@style/AppTheme"/>
android:theme="@style/AppTheme" />
<activity android:name=".settings.SettingActivity"
<activity
android:name=".settings.SettingActivity"
android:excludeFromRecents="true"
android:theme="@style/AppTheme" />
<activity
android:name=".settings.wifi.WifiWhiteListActivity"
android:excludeFromRecents="true"
android:theme="@style/AppTheme"/>
android:theme="@style/AppTheme" />
<!--
Should point to the content provider which can be used to dump Launcher3 compatible
......
......@@ -19,6 +19,8 @@ import java.util.Set;
public class AppChooseListAdapter extends BaseRecyclerViewAdapter<AppModel> {
public static final String TAG="AppChooseListAdapter";
public static final int SYSTEM_APP_FLAG=0;
public static final int USER_APP_FLAG=1;
private Set<String> flagShow = new HashSet();
private Set<String> flagAutostart = new HashSet();
private String packageName = "";
......@@ -83,19 +85,17 @@ public class AppChooseListAdapter extends BaseRecyclerViewAdapter<AppModel> {
checkBoxAutostart.setChecked(false);
}
Log.i(TAG, "autoStartPkgList: "+mAutoStartPkgs.toString());
// Log.i(TAG, "autoStartPkgList: "+mAutoStartPkgs.toString());
for (int i = 0; i < mAutoStartPkgs.size(); i++) {
if (packageName.equals(mAutoStartPkgs.get(i))){
Log.i(TAG, "autoStartPkgList is Checked");
checkBoxAutostart.setChecked(true);
break;
}
}
Log.i(TAG, "showPkgList: "+mShowAppPkgs.toString());
// Log.i(TAG, "showPkgList: "+mShowAppPkgs.toString());
for (int i = 0; i < mShowAppPkgs.size(); i++) {
if (packageName.equals(mShowAppPkgs.get(i))){
Log.i(TAG, "showPkgList is Checked");
checkBoxShow.setChecked(true);
break;
}
......@@ -105,7 +105,7 @@ public class AppChooseListAdapter extends BaseRecyclerViewAdapter<AppModel> {
public void saveResult(Context context) {
//使用preference 记录,这个需要实现一下
//用字串也行 用位也行
if (mAppTypeFlag==0){
if (mAppTypeFlag==SYSTEM_APP_FLAG){
StringBuilder stringBuilderShowPkgs = new StringBuilder();
for (String name : flagShow) {
stringBuilderShowPkgs.append(name);
......@@ -141,12 +141,16 @@ public class AppChooseListAdapter extends BaseRecyclerViewAdapter<AppModel> {
List<String> autoStartAppPkgs = new ArrayList<>();
String showAppPkgs;
String autoStartPkgs;
if (mAppTypeFlag==0){
if (mAppTypeFlag==SYSTEM_APP_FLAG){
showAppPkgs = Prefs.getSystemShowAppPkgs(context);
autoStartPkgs=Prefs.getSystemAutoStartPkgs(context);
Log.i(TAG, "showAppPkgs 0: "+showAppPkgs);
Log.i(TAG, "autoStartPkgs 0: "+autoStartPkgs);
}else {
showAppPkgs = Prefs.getUserShowAppPkgs(context);
autoStartPkgs=Prefs.getUserAutoStartPkgs(context);
Log.i(TAG, "showAppPkgs 1: "+showAppPkgs);
Log.i(TAG, "autoStartPkgs 1: "+autoStartPkgs);
}
if (showAppPkgs.equals("null")) {
mShowAppPkgs=systemAppPkgs;
......@@ -160,6 +164,13 @@ public class AppChooseListAdapter extends BaseRecyclerViewAdapter<AppModel> {
String[] split = autoStartPkgs.split(";");
mAutoStartPkgs= Arrays.asList(split);
}
for (int i = 0; i < mShowAppPkgs.size(); i++) {
flagShow.add(mShowAppPkgs.get(i));
}
for (int i = 0; i < mAutoStartPkgs.size(); i++) {
flagAutostart.add(mShowAppPkgs.get(i));
}
}
}
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