OSDN Git Service

Merge remote-tracking branch 'cm/cm-14.1' into cm-14.1-x86
authorJaap Jan Meijer <jjmeijer88@gmail.com>
Tue, 15 Nov 2016 18:46:50 +0000 (19:46 +0100)
committerJaap Jan Meijer <jjmeijer88@gmail.com>
Tue, 15 Nov 2016 18:46:50 +0000 (19:46 +0100)
Android.mk
res/layout-land/longpress_cling.xml
res/layout/longpress_cling_welcome_content.xml
res/values-zh-rCN/strings.xml
res/values-zh-rHK/strings.xml
res/values-zh-rTW/strings.xml
res/values/strings.xml
src/com/android/launcher3/LauncherClings.java

index 43f5af8..e8e9342 100644 (file)
@@ -55,6 +55,7 @@ endif
 LOCAL_AAPT_FLAGS += --rename-manifest-package com.cyanogenmod.trebuchet
 
 LOCAL_OVERRIDES_PACKAGES := Launcher3
+LOCAL_REQUIRED_MODULES := AnalyticsService HardwareCollector
 
 LOCAL_PROGUARD_FLAG_FILES := proguard.flags
 LOCAL_PROGUARD_ENABLED := full
index 9672dd8..a404bc6 100644 (file)
@@ -15,7 +15,7 @@
 
     <FrameLayout
         android:id="@+id/cling_content"
-        android:layout_width="360dp"
+        android:layout_width="400dp"
         android:layout_height="wrap_content"
         android:layout_gravity="center_horizontal"
         android:background="@drawable/cling_bg" />
index ede489f..c992911 100644 (file)
         android:fontFamily="sans-serif-medium"
         android:paddingLeft="36dp"
         android:paddingRight="36dp"
-        android:text="@string/workspace_cling_longpress_title"
+        android:text="@string/android_x86_intro"
         android:textColor="@color/workspace_cling_longpress_title_color"
-        android:textSize="20sp" />
+        android:textSize="18sp" />
 
     <TextView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:paddingLeft="36dp"
         android:paddingRight="36dp"
-        android:text="@string/workspace_cling_longpress_description"
+        android:text="@string/android_x86_analytics"
+        android:textColor="@color/workspace_cling_longpress_description_color"
+        android:textSize="16sp" />
+
+    <CheckBox
+        android:id="@+id/collect_hw_info"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="6dp"
+        android:layout_marginLeft="32dp"
+        android:paddingLeft="4dp"
+        android:text="@string/hw_info"
+        android:textColor="@color/workspace_cling_longpress_description_color"
+        android:textSize="16sp" />
+
+    <CheckBox
+        android:id="@+id/collect_apps_usage"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="32dp"
+        android:paddingLeft="4dp"
+        android:text="@string/apps_usage"
         android:textColor="@color/workspace_cling_longpress_description_color"
         android:textSize="16sp" />
 
@@ -43,7 +64,7 @@
         android:layout_height="wrap_content"
         android:layout_gravity="end"
         android:layout_marginRight="12dp"
-        android:layout_marginTop="27dp"
+        android:layout_marginTop="6dp"
         android:fontFamily="sans-serif-medium"
         android:paddingLeft="24dp"
         android:paddingRight="24dp"
@@ -51,4 +72,4 @@
         android:textColor="@color/workspace_cling_longpress_dismiss_text_color"
         android:textSize="14sp" />
 
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
index 77f07c9..7c39d97 100644 (file)
     <string name="migration_cling_description" msgid="2752413805582227644">"要导入旧的主屏幕中的图标和文件夹吗?"</string>
     <string name="migration_cling_copy_apps" msgid="946331230090919440">"复制图标"</string>
     <string name="migration_cling_use_default" msgid="2626475813981258626">"使用全新配置"</string>
-    <string name="workspace_cling_longpress_title" msgid="9173998993909018310">"壁纸、小部件和设置"</string>
-    <string name="workspace_cling_longpress_description" msgid="4119994475505235248">"触摸并按住背景,即可进行个性化设置"</string>
+    <string name="android_x86_intro" msgid="9173998993909018310">"Android-x86 是一个由志愿者维护的开源项目。我们想要收集一些匿名信息以改善项目。"</string>
+    <string name="android_x86_analytics" msgid="4119994475505235248">"我同意提供以下匿名信息:"</string>
+    <string name="hw_info">"硬件信息"</string>
+    <string name="apps_usage">"應用信息"</string>
     <string name="workspace_cling_longpress_dismiss" msgid="368660286867640874">"知道了"</string>
     <string name="folder_opened" msgid="94695026776264709">"文件夹已打开,大小为<xliff:g id="WIDTH">%1$d</xliff:g>×<xliff:g id="HEIGHT">%2$d</xliff:g>"</string>
     <string name="folder_tap_to_close" msgid="1884479294466410023">"触摸可关闭文件夹"</string>
index 62032ec..870df0b 100644 (file)
     <string name="migration_cling_description" msgid="2752413805582227644">"要從舊主畫面匯入圖示和資料夾嗎?"</string>
     <string name="migration_cling_copy_apps" msgid="946331230090919440">"複製圖示"</string>
     <string name="migration_cling_use_default" msgid="2626475813981258626">"重新開始"</string>
-    <string name="workspace_cling_longpress_title" msgid="9173998993909018310">"桌布、小工具和設定"</string>
-    <string name="workspace_cling_longpress_description" msgid="4119994475505235248">"輕觸並按住背景即可自訂"</string>
+    <string name="android_x86_intro" msgid="9173998993909018310">"Android-x86 是一個由志願者所維護的開放原始碼計劃。我們希望收集一些匿名資料以改善計劃。"</string>
+    <string name="android_x86_analytics" msgid="4119994475505235248">"我同意提供以下匿名資訊:"</string>
+    <string name="hw_info">"硬體資訊"</string>
+    <string name="apps_usage">"應用程式資訊"</string>
     <string name="workspace_cling_longpress_dismiss" msgid="368660286867640874">"知道了"</string>
     <string name="folder_opened" msgid="94695026776264709">"資料夾已開啟 (<xliff:g id="WIDTH">%1$d</xliff:g> x <xliff:g id="HEIGHT">%2$d</xliff:g>)"</string>
     <string name="folder_tap_to_close" msgid="1884479294466410023">"輕觸即可關閉資料夾"</string>
index 0b3f4d6..eb25f97 100644 (file)
     <string name="migration_cling_description" msgid="2752413805582227644">"要從舊的主螢幕匯入圖示和資料夾嗎?"</string>
     <string name="migration_cling_copy_apps" msgid="946331230090919440">"複製圖示"</string>
     <string name="migration_cling_use_default" msgid="2626475813981258626">"重新開始"</string>
-    <string name="workspace_cling_longpress_title" msgid="9173998993909018310">"桌布、小工具和設定"</string>
-    <string name="workspace_cling_longpress_description" msgid="4119994475505235248">"輕觸並按住背景即可自訂"</string>
+    <string name="android_x86_intro" msgid="9173998993909018310">"Android-x86 是一個由志願者所維護的開放原始碼計劃。我們希望收集一些匿名資料以改善計劃。"</string>
+    <string name="android_x86_analytics" msgid="4119994475505235248">"我同意提供以下匿名資訊:"</string>
+    <string name="hw_info">"硬體資訊"</string>
+    <string name="apps_usage">"應用程式資訊"</string>
     <string name="workspace_cling_longpress_dismiss" msgid="368660286867640874">"知道了"</string>
     <string name="folder_opened" msgid="94695026776264709">"資料夾已開啟 (<xliff:g id="WIDTH">%1$d</xliff:g> x <xliff:g id="HEIGHT">%2$d</xliff:g>)"</string>
     <string name="folder_tap_to_close" msgid="1884479294466410023">"輕觸即可關閉資料夾"</string>
index b544788..9f7a8fc 100644 (file)
     <string name="migration_cling_copy_apps">COPY ICONS</string>
     <!-- The description of the button to use the default launcher layout [CHAR_LIMIT=30] -->
     <string name="migration_cling_use_default">START FRESH</string>
-    <!-- The title text for workspace longpress action [CHAR_LIMIT=40] -->
-    <string name="workspace_cling_longpress_title">Wallpapers, widgets, &amp; settings</string>
-    <!-- The description of how to use the workspace [CHAR_LIMIT=70] -->
-    <string name="workspace_cling_longpress_description">Touch &amp; hold background to customize</string>
+    <!-- The Android-x86 project introduction [CHAR_LIMIT=140] -->
+    <string name="android_x86_intro">Android-x86 is an open source project maintained by volunteers. To improve the project, we\'d like to collect some anonymous data from you.</string>
+    <!-- The description of anonymous data collection [CHAR_LIMIT=70] -->
+    <string name="android_x86_analytics">I agree to send the anonymous data:</string>
+    <!-- The description of the checkbox to agree [CHAR_LIMIT=30] -->
+    <string name="hw_info">Hardware information</string>
+    <string name="apps_usage">Apps usage</string>
     <!-- The description of the button to dismiss the cling [CHAR_LIMIT=30] -->
     <string name="workspace_cling_longpress_dismiss">GOT IT</string>
 
index 18fe8ef..9590fdd 100644 (file)
@@ -34,6 +34,8 @@ import android.view.View.OnLongClickListener;
 import android.view.ViewGroup;
 import android.view.ViewTreeObserver.OnGlobalLayoutListener;
 import android.view.accessibility.AccessibilityManager;
+import android.widget.CheckBox;
+import java.lang.reflect.Method;
 
 import com.android.launcher3.util.Thunk;
 
@@ -49,6 +51,11 @@ class LauncherClings implements OnClickListener {
     // New Secure Setting in L
     private static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints";
 
+    private static final String PROPERTY_HW_STATISTICS = "persist.sys.hw_statistics";
+    private static final String PROPERTY_APPS_STATISTICS = "persist.sys.apps_statistics";
+    private CheckBox mCollectHwInfo;
+    private CheckBox mCollectAppsUsage;
+
     @Thunk Launcher mLauncher;
     private LayoutInflater mInflater;
     @Thunk boolean mIsVisible;
@@ -137,6 +144,10 @@ class LauncherClings implements OnClickListener {
         mInflater.inflate(showWelcome ? R.layout.longpress_cling_welcome_content
                 : R.layout.longpress_cling_content, content);
         content.findViewById(R.id.cling_dismiss_longpress_info).setOnClickListener(this);
+        mCollectHwInfo = (CheckBox) content.findViewById(R.id.collect_hw_info);
+        mCollectAppsUsage = (CheckBox) content.findViewById(R.id.collect_apps_usage);
+        mCollectHwInfo.setChecked(true);
+        mCollectAppsUsage.setChecked(true);
 
         if (TAG_CROP_TOP_AND_SIDES.equals(content.getTag())) {
             Drawable bg = new BorderCropDrawable(mLauncher.getResources().getDrawable(R.drawable.cling_bg),
@@ -210,6 +221,13 @@ class LauncherClings implements OnClickListener {
             } else {
                 cling.animate().alpha(0).setDuration(duration).withEndAction(cleanUpClingCb);
             }
+            try {
+                Class<?> c = Class.forName("android.os.SystemProperties");
+                Method m = c.getMethod("set", String.class, String.class);
+                m.invoke(null, PROPERTY_HW_STATISTICS, Boolean.toString(mCollectHwInfo.isChecked()));
+                m.invoke(null, PROPERTY_APPS_STATISTICS, Boolean.toString(mCollectAppsUsage.isChecked()));
+            } catch (Exception e) {
+            }
         }
     }
 
@@ -247,6 +265,14 @@ class LauncherClings implements OnClickListener {
     }
 
     public boolean shouldShowFirstRunOrMigrationClings() {
+        try {
+            Class<?> c = Class.forName("android.os.SystemProperties");
+            Method m = c.getMethod("get", String.class, String.class);
+            if (((String)m.invoke(null, PROPERTY_HW_STATISTICS, "")).isEmpty()) {
+                return true;
+            }
+        } catch (Exception e) {
+        }
         SharedPreferences sharedPrefs = mLauncher.getSharedPrefs();
         return areClingsEnabled() &&
             !sharedPrefs.getBoolean(WORKSPACE_CLING_DISMISSED_KEY, false) &&