summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bestas <mikeioannina@gmail.com>2015-11-28 15:42:39 (GMT)
committerTyson Miller <tmiller@cyngn.com>2015-12-02 19:57:04 (GMT)
commitd69f636f145d8ff2b49348d179cfa0bbb8d4f83b (patch)
treec51f177c619b1f038e7c4a78cf751f2f4b7cd3d1
parent719deb83a0ac84422b68605f4d5c782865766aef (diff)
downloadandroid_packages_apps_Trebuchet-d69f636f145d8ff2b49348d179cfa0bbb8d4f83b.zip
android_packages_apps_Trebuchet-d69f636f145d8ff2b49348d179cfa0bbb8d4f83b.tar.gz
android_packages_apps_Trebuchet-d69f636f145d8ff2b49348d179cfa0bbb8d4f83b.tar.bz2
Trebuchet: RemoteFolder fix subtype & manifest entries
Change-Id: I21282fb06be4391cf5ffbfb9b60a840820ded3e9
-rw-r--r--Android.mk12
-rw-r--r--AndroidManifest.xml21
-rw-r--r--RemoteFolder/Android.mk2
-rw-r--r--RemoteFolder/src/com.cyngn.RemoteFolder/RemoteFolderUpdater.java6
-rw-r--r--src/com/android/launcher3/AutoInstallsLayout.java2
-rw-r--r--src/com/android/launcher3/DefaultLayoutParser.java2
-rw-r--r--src/com/android/launcher3/FolderInfo.java1
-rw-r--r--src/com/android/launcher3/LauncherModel.java8
-rw-r--r--src/com/android/launcher3/LauncherProvider.java20
-rw-r--r--src/com/android/launcher3/LauncherSettings.java6
10 files changed, 41 insertions, 39 deletions
diff --git a/Android.mk b/Android.mk
index f93af5b..70770fc 100644
--- a/Android.mk
+++ b/Android.mk
@@ -27,15 +27,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := android-support-v13 \
android-support-v7-recyclerview \
guava
-<<<<<<< HEAD
-REMOTE_FOLDER_UPDATER ?= $(LOCAL_PATH)/RemoteFolder
-
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
- $(call all-java-files-under, $(REMOTE_FOLDER_UPDATER)/src) \
-=======
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
->>>>>>> 861f6e8... Trebuchet: Remote Folder hooks setup. Updater call still needs to be moved from Folder to LauncherModel
$(call all-java-files-under, WallpaperPicker/src) \
$(call all-renderscript-files-under, src) \
$(call all-proto-files-under, protos)
@@ -105,9 +98,4 @@ $(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/util/etc/launcher_protoutil | $(ACP)
$(copy-file-to-new-target)
$(hide) chmod 755 $@
-<<<<<<< HEAD
-include $(REMOTE_FOLDER_UPDATER)/Android.mk
-
-=======
->>>>>>> 861f6e8... Trebuchet: Remote Folder hooks setup. Updater call still needs to be moved from Folder to LauncherModel
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index b6ae5a2..d433424 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -77,7 +77,6 @@
<uses-permission android:name="cyanogenmod.permission.PROTECTED_APP" />
<uses-permission android:name="com.cyngn.stats.SEND_ANALYTICS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION"/>
<application
android:name="com.android.launcher3.LauncherApplication"
@@ -268,25 +267,5 @@
<meta-data android:name="com.google.android.backup.api_key"
android:value="@string/backup_api_key" />
- <meta-data android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
- <!-- For InMobi -->
- <!--<activity android:name="com.inmobi.rendering.InMobiAdActivity"
- android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize"
- android:theme="@android:style/Theme.Translucent.NoTitleBar"
- android:hardwareAccelerated="true" />
-
- <service android:enabled="true" android:name="com.inmobi.commons.internal.ActivityRecognitionManager" />
-
- <receiver
- android:name="com.inmobi.commons.core.utilities.uid.ImIdShareBroadCastReceiver"
- android:enabled="true"
- android:exported="true" >
- <intent-filter>
- <action android:name="com.inmobi.share.id" />
- </intent-filter>
- </receiver>-->
-
</application>
</manifest>
diff --git a/RemoteFolder/Android.mk b/RemoteFolder/Android.mk
index 0857902..2a74413 100644
--- a/RemoteFolder/Android.mk
+++ b/RemoteFolder/Android.mk
@@ -1 +1 @@
-LOCAL_SRC_FILES += (call all-java-files-under, RemoteFolder/src) \ No newline at end of file
+LOCAL_SRC_FILES += $(call all-java-files-under, RemoteFolder/src)
diff --git a/RemoteFolder/src/com.cyngn.RemoteFolder/RemoteFolderUpdater.java b/RemoteFolder/src/com.cyngn.RemoteFolder/RemoteFolderUpdater.java
index 909154c..eb0da80 100644
--- a/RemoteFolder/src/com.cyngn.RemoteFolder/RemoteFolderUpdater.java
+++ b/RemoteFolder/src/com.cyngn.RemoteFolder/RemoteFolderUpdater.java
@@ -5,9 +5,12 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.view.View;
import java.util.List;
+import android.util.Log;
public class RemoteFolderUpdater {
+ private static final String TAG = "RemoteFolderUpdater";
+
public interface RemoteFolderUpdateListener {
void onSuccess(List<RemoteFolderInfo> remoteFolderInfoList);
void onFailure(String error);
@@ -61,4 +64,5 @@ public class RemoteFolderUpdater {
return null;
}
}
-} \ No newline at end of file
+
+}
diff --git a/src/com/android/launcher3/AutoInstallsLayout.java b/src/com/android/launcher3/AutoInstallsLayout.java
index b7a6d9a..d5c7423 100644
--- a/src/com/android/launcher3/AutoInstallsLayout.java
+++ b/src/com/android/launcher3/AutoInstallsLayout.java
@@ -581,7 +581,7 @@ public class AutoInstallsLayout {
// We can only have folders with >= 2 items, so we need to remove the
// folder and clean up if less than 2 items were included, or some
// failed to add, and less than 2 were actually added
- if (folderItems.size() < 2) {
+ if (folderItems.size() < 2 && !isRemoteFolder()) {
// Delete the folder
Uri uri = Favorites.getContentUri(folderId, false);
SqlArguments args = new SqlArguments(uri, null, null);
diff --git a/src/com/android/launcher3/DefaultLayoutParser.java b/src/com/android/launcher3/DefaultLayoutParser.java
index d9c400b..72f8b29 100644
--- a/src/com/android/launcher3/DefaultLayoutParser.java
+++ b/src/com/android/launcher3/DefaultLayoutParser.java
@@ -35,6 +35,7 @@ public class DefaultLayoutParser extends AutoInstallsLayout {
private static final String TAG_APPWIDGET = "appwidget";
private static final String TAG_SHORTCUT = "shortcut";
private static final String TAG_FOLDER = "folder";
+ private static final String TAG_REMOTE_FOLDER = "remote-folder";
private static final String TAG_PARTNER_FOLDER = "partner-folder";
private static final String TAG_INCLUDE = "include";
@@ -70,6 +71,7 @@ public class DefaultLayoutParser extends AutoInstallsLayout {
parsers.put(TAG_SHORTCUT, new UriShortcutParser(mSourceRes));
parsers.put(TAG_RESOLVE, new ResolveParser());
parsers.put(TAG_FOLDER, new MyFolderParser());
+ parsers.put(TAG_REMOTE_FOLDER, new RemoteFolderParser());
parsers.put(TAG_PARTNER_FOLDER, new PartnerFolderParser());
return parsers;
}
diff --git a/src/com/android/launcher3/FolderInfo.java b/src/com/android/launcher3/FolderInfo.java
index 12b3032..af9cf07 100644
--- a/src/com/android/launcher3/FolderInfo.java
+++ b/src/com/android/launcher3/FolderInfo.java
@@ -34,6 +34,7 @@ public class FolderInfo extends ItemInfo {
* Whether this folder has been opened
*/
boolean opened;
+ int subType;
/**
* The apps and shortcuts and hidden status
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 724fa32..3a04285 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -63,6 +63,8 @@ import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.settings.SettingsProvider;
import com.android.launcher3.stats.internal.service.AggregationIntentService;
+import com.cyngn.RemoteFolder.RemoteFolderUpdater;
+
import java.lang.ref.WeakReference;
import java.net.URISyntaxException;
import java.security.InvalidParameterException;
@@ -1014,6 +1016,7 @@ public class LauncherModel extends BroadcastReceiver
final int cellXIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.CELLX);
final int cellYIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.CELLY);
final int hiddenIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.HIDDEN);
+ final int subType = c.getColumnIndexOrThrow(LauncherSettings.Favorites.SUBTYPE);
FolderInfo folderInfo = null;
switch (c.getInt(itemTypeIndex)) {
@@ -1029,6 +1032,7 @@ public class LauncherModel extends BroadcastReceiver
folderInfo.cellX = c.getInt(cellXIndex);
folderInfo.cellY = c.getInt(cellYIndex);
folderInfo.hidden = c.getInt(hiddenIndex) > 0;
+ folderInfo.subType = subType;
return folderInfo;
}
@@ -2128,6 +2132,7 @@ public class LauncherModel extends BroadcastReceiver
//final int displayModeIndex = c.getColumnIndexOrThrow(
final int hiddenIndex = c.getColumnIndexOrThrow(
LauncherSettings.Favorites.HIDDEN);
+ final int subTypeIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.SUBTYPE);
//final int uriIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.URI); //final int displayModeIndex = c.getColumnIndexOrThrow(
// LauncherSettings.Favorites.DISPLAY_MODE);
@@ -2365,6 +2370,7 @@ public class LauncherModel extends BroadcastReceiver
folderInfo.spanX = 1;
folderInfo.spanY = 1;
folderInfo.hidden = c.getInt(hiddenIndex) > 0;
+ folderInfo.subType = c.getInt(subTypeIndex);
// check & update map of what's occupied
if (!checkItemPlacement(occupied, folderInfo, shouldResize)) {
@@ -2866,7 +2872,7 @@ public class LauncherModel extends BroadcastReceiver
}
workspaceItems.remove(i);
folders.remove(Long.valueOf(item.id));
- } else if (folder.contents.size() == 0 /*&& !(folder instanceof LiveFolderInfo)*/) {
+ } else if (folder.contents.size() == 0 && folder.subType == 0) {
LauncherModel.deleteFolderContentsFromDatabase(mContext, folder);
workspaceItems.remove(i);
folders.remove(Long.valueOf(item.id));
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 1449248..abe082e 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -67,7 +67,7 @@ public class LauncherProvider extends ContentProvider {
private static final String TAG = "Launcher.LauncherProvider";
private static final boolean LOGD = false;
- private static final int DATABASE_VERSION = 22;
+ private static final int DATABASE_VERSION = 23;
static final String OLD_AUTHORITY = "com.android.launcher2.settings";
static final String AUTHORITY = ProviderConfig.AUTHORITY;
@@ -505,7 +505,8 @@ public class LauncherProvider extends ContentProvider {
"modified INTEGER NOT NULL DEFAULT 0," +
"restored INTEGER NOT NULL DEFAULT 0," +
"profileId INTEGER DEFAULT " + userSerialNumber +
- ",hidden INTEGER DEFAULT 0" +
+ ",hidden INTEGER DEFAULT 0," +
+ "subType INTEGER DEFAULT 0" +
");");
addWorkspacesTable(db);
@@ -995,6 +996,21 @@ public class LauncherProvider extends ContentProvider {
version = 22;
}
+ if (version < 23) {
+ db.beginTransaction();
+ try {
+ db.execSQL("ALTER TABLE favorites " +
+ "ADD COLUMN subType INTEGER DEFAULT 0;");
+ db.setTransactionSuccessful();
+ version = 23;
+ } catch (SQLException ex) {
+ // Old version remains, which means we wipe old data
+ Log.e(TAG, ex.getMessage(), ex);
+ } finally {
+ db.endTransaction();
+ }
+ }
+
if (version != DATABASE_VERSION) {
Log.w(TAG, "Destroying all old data.");
db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES);
diff --git a/src/com/android/launcher3/LauncherSettings.java b/src/com/android/launcher3/LauncherSettings.java
index 357bac5..50aa5c4 100644
--- a/src/com/android/launcher3/LauncherSettings.java
+++ b/src/com/android/launcher3/LauncherSettings.java
@@ -45,6 +45,10 @@ class LauncherSettings {
static final String HIDDEN = "hidden";
/**
+ * Folder subtype, used for Remote Folders
+ */
+ static final String SUBTYPE = "subType";
+ /**
* The Intent URL of the gesture, describing what it points to. This
* value is given to {@link android.content.Intent#parseUri(String, int)} to create
* an Intent that can be launched.
@@ -258,6 +262,8 @@ class LauncherSettings {
*/
static final int ITEM_TYPE_WIDGET_PHOTO_FRAME = 1002;
+ static final int ITEM_TYPE_REMOTE_FOLDER = 2000;
+
/**
* The appWidgetId of the widget
*