docs: Add new samples for N MR1 am: 0af1e772c4
am: 2b4561c639
Change-Id: I9fd2e353866986677a9724931196820afabd6dc2
diff --git a/apps/Development/res/layout/development_settings.xml b/apps/Development/res/layout/development_settings.xml
deleted file mode 100644
index e9b1dad..0000000
--- a/apps/Development/res/layout/development_settings.xml
+++ /dev/null
@@ -1,175 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/Settings/assets/res/any/layout/keyboard_version.xml
-**
-** Copyright 2006, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <TextView android:id="@+id/debug_app_label"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- android:text="@string/development_settings_debug_app_label_text" />
-
- <Button android:id="@+id/debug_app"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/debug_app_label"
- android:layout_alignParentLeft="true"
- android:layout_toRightOf="@id/debug_app_label" />
-
- <!-- android:visibility="gone" -->
-
- <CheckBox android:id="@+id/wait_for_debugger"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/debug_app"
- android:layout_alignParentLeft="true"
- android:text="@string/development_settings_wait_for_debugger_text" />
-
- <View android:id="@+id/separator"
- android:layout_width="8dip"
- android:layout_height="8dip"
- android:layout_below="@id/wait_for_debugger"
- android:layout_alignParentLeft="true" />
-
- <Spinner android:id="@+id/pointer_location"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/separator"
- android:layout_alignParentLeft="true" />
-
- <CheckBox android:id="@+id/show_load"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/pointer_location"
- android:layout_alignParentLeft="true"
- android:text="@string/development_settings_show_load_text" />
-
- <CheckBox android:id="@+id/show_updates"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/show_load"
- android:layout_alignParentLeft="true"
- android:text="@string/development_settings_show_updates_text" />
-
- <Spinner android:id="@+id/strictmode_visual"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/show_updates"
- android:layout_alignParentLeft="true" />
-
- <CheckBox android:id="@+id/compatibility_mode"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/strictmode_visual"
- android:layout_alignParentLeft="true"
- android:text="@string/development_settings_compatibility_mode_text" />
-
- <Spinner android:id="@+id/max_procs"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/compatibility_mode"
- android:layout_alignParentLeft="true" />
-
- <View android:id="@+id/separator2"
- android:layout_width="8dip"
- android:layout_height="8dip"
- android:layout_below="@id/max_procs"
- android:layout_alignParentLeft="true" />
-
- <CheckBox android:id="@+id/always_finish"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/separator2"
- android:layout_alignParentLeft="true"
- android:text="@string/development_settings_always_finish_text" />
-
- <CheckBox android:id="@+id/show_cpu"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/always_finish"
- android:layout_alignParentLeft="true"
- android:text="@string/development_settings_show_cpu_text" />
-
- <CheckBox android:id="@+id/enable_gl"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/show_cpu"
- android:layout_alignParentLeft="true"
- android:text="@string/development_settings_enable_gl_text" />
-
- <CheckBox android:id="@+id/show_background"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/enable_gl"
- android:layout_alignParentLeft="true"
- android:text="@string/development_settings_show_background_text" />
-
- <CheckBox android:id="@+id/show_sleep"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/show_background"
- android:layout_alignParentLeft="true"
- android:text="@string/development_settings_show_sleep_text" />
-
- <Spinner android:id="@+id/window_animation_scale"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/show_sleep"
- android:layout_alignParentLeft="true">
- </Spinner>
-
- <Spinner android:id="@+id/transition_animation_scale"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/window_animation_scale"
- android:layout_alignParentLeft="true">
- </Spinner>
-
- <Spinner android:id="@+id/font_hinting"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/transition_animation_scale"
- android:layout_alignParentLeft="true">
- </Spinner>
-
- <CheckBox android:id="@+id/show_xmpp"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/font_hinting"
- android:layout_alignParentLeft="true"
- android:text="@string/development_settings_show_xmpp_text" />
-
- <CheckBox android:id="@+id/window_orientation_listener_log"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/show_xmpp"
- android:layout_alignParentLeft="true"
- android:text="@string/development_settings_window_orientation_listener_log" />
-
- </RelativeLayout>
-
-</ScrollView>
-
diff --git a/apps/Development/res/values/strings.xml b/apps/Development/res/values/strings.xml
index 5f96d24..1ee1c18 100644
--- a/apps/Development/res/values/strings.xml
+++ b/apps/Development/res/values/strings.xml
@@ -108,23 +108,6 @@
<string name="launch_singleInstance">Single Instance</string>
<string name="launch_unknown">"(Unknown)"</string>
- <string name="development_settings_show_cpu_text">Show CPU usage</string>
- <string name="development_settings_always_finish_text">Immediately destroy activities</string>
- <string name="development_settings_show_load_text">Show running processes</string>
- <string name="development_settings_show_updates_text">Show screen updates</string>
- <string name="development_settings_compatibility_mode_text">Disable compatibility mode</string>
- <string name="development_settings_compatibility_mode_toast">Reboot required for
- change to take effect.</string>
- <string name="development_settings_enable_gl_text">Enable OpenGL ES (reboot needed)</string>
- <string name="development_settings_allow_mock_location_text">Allow mock locations for testing</string>
- <string name="development_settings_wait_for_debugger_text">Wait for debugger</string>
- <string name="development_settings_show_background_text">Show background</string>
- <string name="development_settings_show_xmpp_text">Show GTalk service connection status</string>
- <string name="development_settings_debug_app_label_text">Debug App:</string>
- <string name="development_settings_show_sleep_text">Show sleep state on LED</string>
- <string name="development_settings_keep_screen_on_text">Keep screen on while plugged in</string>
- <string name="development_settings_window_orientation_listener_log">Enable window orientation listener log</string>
-
<string name="monkey_screen_initialActivity_text"></string>
<string name="monkey_screen_number_of_events_label">Number of Events: </string>
<string name="monkey_screen_start_text">Start</string>
diff --git a/apps/Development/src/com/android/development/SyncAdapterDriver.java b/apps/Development/src/com/android/development/SyncAdapterDriver.java
index 1bf27ae..a860aef 100644
--- a/apps/Development/src/com/android/development/SyncAdapterDriver.java
+++ b/apps/Development/src/com/android/development/SyncAdapterDriver.java
@@ -371,7 +371,7 @@
sa.getString(com.android.internal.R.styleable
.SyncAdapter_settingsActivity);
return new SyncAdapterType(authority, accountType, userVisible, supportsUploading,
- isAlwaysSyncable, allowParallelSyncs, settingsActivity);
+ isAlwaysSyncable, allowParallelSyncs, settingsActivity, packageName);
} finally {
sa.recycle();
}
diff --git a/build/Android.mk b/build/Android.mk
index 8fbab3b..0954581 100644
--- a/build/Android.mk
+++ b/build/Android.mk
@@ -121,12 +121,21 @@
endef
ANDROID_SUPPORT_LIBRARIES := \
+ android-support-animatedvectordrawable \
android-support-annotations \
android-support-compat \
- android-support-media-compat \
android-support-core-ui \
- android-support-fragment \
android-support-core-utils \
+ android-support-customtabs \
+ android-support-design \
+ android-support-documents-archive \
+ android-support-fragment \
+ android-support-media-compat \
+ android-support-multidex \
+ android-support-multidex-instrumentation \
+ android-support-percent \
+ android-support-recommendation \
+ android-support-transition \
android-support-v4 \
android-support-v7-appcompat \
android-support-v7-cardview \
@@ -139,15 +148,7 @@
android-support-v14-preference \
android-support-v17-leanback \
android-support-v17-preference-leanback \
- android-support-multidex \
- android-support-multidex-instrumentation \
- android-support-design \
- android-support-percent \
- android-support-recommendation \
- android-support-customtabs \
- android-support-documents-archive \
- android-support-vectordrawable \
- android-support-animatedvectordrawable
+ android-support-vectordrawable
$(foreach lib, $(ANDROID_SUPPORT_LIBRARIES), $(eval $(call _package_sdk_library,$(lib))))
diff --git a/build/sdk.atree b/build/sdk.atree
index ffd6efa..093bd3a 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -57,11 +57,11 @@
prebuilts/sdk/sdk-annotations/annotations.zip platform-tools/api/annotations.zip
# systrace
-external/chromium-trace/catapult/systrace/systrace/ platform-tools/systrace/catapult/systrace/systrace/
-external/chromium-trace/catapult/systrace/systrace/__init__.py platform-tools/systrace/catapult/systrace/systrace/__init__.py
-external/chromium-trace/catapult/systrace/systrace/agents/__init__.py platform-tools/systrace/catapult/systrace/systrace/agents/__init__.py
+external/chromium-trace/catapult/common/ platform-tools/systrace/catapult/common/
+external/chromium-trace/catapult/dependency_manager/ platform-tools/systrace/catapult/dependency_manager/
+external/chromium-trace/catapult/devil/ platform-tools/systrace/catapult/devil/
+external/chromium-trace/catapult/systrace/ platform-tools/systrace/catapult/systrace/
external/chromium-trace/systrace.py platform-tools/systrace/systrace.py
-external/chromium-trace/systrace_trace_viewer.html platform-tools/systrace/systrace_trace_viewer.html
external/chromium-trace/NOTICE platform-tools/systrace/NOTICE
external/chromium-trace/UPSTREAM_REVISION platform-tools/systrace/UPSTREAM_REVISION
@@ -575,6 +575,13 @@
${OUT_DIR}/target/common/obj/PACKAGING/android-support-animatedvectordrawable_intermediates/android-support-animatedvectordrawable.jar extras/android/support/graphics/drawable/libs/android-support-animatedvectordrawable.jar
+frameworks/support/transition/AndroidManifest.xml extras/android/support/transition/AndroidManifest.xml
+frameworks/support/transition/res extras/android/support/transition/res
+${OUT_DIR}/target/common/obj/PACKAGING/android-support-transition_intermediates/android-support-transition.jar extras/android/support/transition/libs/android-support-transition.jar
+
+frameworks/support/documents-archive/AndroidManifest.xml extras/android/support/documents-archive/AndroidManifest.xml
+${OUT_DIR}/target/common/obj/PACKAGING/android-support-documents-archive_intermediates/android-support-documents-archive.jar extras/android/support/documents-archive/libs/android-support-documents-archive.jar
+
##############################################################################
# Tests Component
##############################################################################
diff --git a/build/sdk.exclude.atree b/build/sdk.exclude.atree
index 5a93b1b..479d79c 100644
--- a/build/sdk.exclude.atree
+++ b/build/sdk.exclude.atree
@@ -20,7 +20,8 @@
-.*.swp
-.DS_Store
-*~
--_*
+-_[!_]*
+-*.pyc
-.*
-OWNERS
-MODULE_LICENSE_*
diff --git a/build/tools/mk_sources_zip.py b/build/tools/mk_sources_zip.py
index 3220e3a..09cfed1 100755
--- a/build/tools/mk_sources_zip.py
+++ b/build/tools/mk_sources_zip.py
@@ -39,7 +39,7 @@
self.CNT_NOPKG = 0
# DIR is the list of directories to scan in TOPDIR.
self.DIR = "frameworks libcore"
- self.IGNORE_DIR = [ "hosttests", "tools", "tests" ]
+ self.IGNORE_DIR = [ "hosttests", "tools", "tests", "samples" ]
# IGNORE is a list of namespaces to ignore. Must be java
# package definitions (e.g. "com.blah.foo.")
self.IGNORE = [ "sun.", "libcore.", "dalvik.",
diff --git a/samples/ShortcutSample/AndroidManifest.xml b/samples/ShortcutSample/AndroidManifest.xml
index 88b0544..4fb99b8 100644
--- a/samples/ShortcutSample/AndroidManifest.xml
+++ b/samples/ShortcutSample/AndroidManifest.xml
@@ -19,6 +19,8 @@
<uses-sdk android:minSdkVersion="25" />
+ <uses-permission android:name="android.permission.INTERNET" />
+
<application
android:label="@string/app_name"
android:icon="@drawable/app"
diff --git a/samples/ShortcutSample/src/com/example/android/shortcutsample/Main.java b/samples/ShortcutSample/src/com/example/android/shortcutsample/Main.java
index 41f0b2b..3e7f893 100644
--- a/samples/ShortcutSample/src/com/example/android/shortcutsample/Main.java
+++ b/samples/ShortcutSample/src/com/example/android/shortcutsample/Main.java
@@ -19,6 +19,7 @@
import android.app.ListActivity;
import android.content.Context;
import android.content.pm.ShortcutInfo;
+import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
@@ -98,13 +99,27 @@
.setPositiveButton("Add", (dialog, whichButton) -> {
final String url = editUri.getText().toString().trim();
if (url.length() > 0) {
- mHelper.addWebSiteShortcut(url);
- refreshList();
+ addUriAsync(url);
}
})
.show();
}
+ private void addUriAsync(String uri) {
+ new AsyncTask<Void, Void, Void>() {
+ @Override
+ protected Void doInBackground(Void... params) {
+ mHelper.addWebSiteShortcut(uri);
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(Void aVoid) {
+ refreshList();
+ }
+ }.execute();
+ }
+
private void refreshList() {
mAdapter.setShortcuts(mHelper.getShortcuts());
}
diff --git a/samples/ShortcutSample/src/com/example/android/shortcutsample/ShortcutHelper.java b/samples/ShortcutSample/src/com/example/android/shortcutsample/ShortcutHelper.java
index 61c4f29..6649f9d 100644
--- a/samples/ShortcutSample/src/com/example/android/shortcutsample/ShortcutHelper.java
+++ b/samples/ShortcutSample/src/com/example/android/shortcutsample/ShortcutHelper.java
@@ -19,12 +19,19 @@
import android.content.Intent;
import android.content.pm.ShortcutInfo;
import android.content.pm.ShortcutManager;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.PersistableBundle;
import android.util.Log;
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -169,8 +176,12 @@
b.setShortLabel(uri.getHost());
b.setLongLabel(uri.toString());
- // TODO Fetch the favicon from the URI and sets to the icon.
- b.setIcon(Icon.createWithResource(mContext, R.drawable.link));
+ Bitmap bmp = fetchFavicon(uri);
+ if (bmp != null) {
+ b.setIcon(Icon.createWithBitmap(bmp));
+ } else {
+ b.setIcon(Icon.createWithResource(mContext, R.drawable.link));
+ }
return b;
}
@@ -209,4 +220,23 @@
public void enableShortcut(ShortcutInfo shortcut) {
mShortcutManager.enableShortcuts(Arrays.asList(shortcut.getId()));
}
+
+ private Bitmap fetchFavicon(Uri uri) {
+ final Uri iconUri = uri.buildUpon().path("favicon.ico").build();
+ Log.i(TAG, "Fetching favicon from: " + iconUri);
+
+ InputStream is = null;
+ BufferedInputStream bis = null;
+ try
+ {
+ URLConnection conn = new URL(iconUri.toString()).openConnection();
+ conn.connect();
+ is = conn.getInputStream();
+ bis = new BufferedInputStream(is, 8192);
+ return BitmapFactory.decodeStream(bis);
+ } catch (IOException e) {
+ Log.w(TAG, "Failed to fetch favicon from " + iconUri, e);
+ return null;
+ }
+ }
}
diff --git a/samples/ShortcutSample/src/com/example/android/shortcutsample/Utils.java b/samples/ShortcutSample/src/com/example/android/shortcutsample/Utils.java
index 523f4dc..7f03b57 100644
--- a/samples/ShortcutSample/src/com/example/android/shortcutsample/Utils.java
+++ b/samples/ShortcutSample/src/com/example/android/shortcutsample/Utils.java
@@ -16,20 +16,17 @@
package com.example.android.shortcutsample;
import android.content.Context;
-import android.content.pm.ShortcutInfo;
-import android.os.AsyncTask;
-import android.os.PersistableBundle;
-import android.util.Log;
+import android.os.Handler;
+import android.os.Looper;
import android.widget.Toast;
-import java.util.ArrayList;
-import java.util.List;
-
public class Utils {
private Utils() {
}
public static void showToast(Context context, String message) {
- Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
+ new Handler(Looper.getMainLooper()).post(() -> {
+ Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
+ });
}
}
diff --git a/sdk/build_tools_source.prop_template b/sdk/build_tools_source.prop_template
index d72f334..5d62307 100644
--- a/sdk/build_tools_source.prop_template
+++ b/sdk/build_tools_source.prop_template
@@ -1,4 +1,3 @@
Pkg.UserSrc=false
-#Pkg.Revision=${PLATFORM_SDK_VERSION}.0.0
-Pkg.Revision=24.0.1
+Pkg.Revision=${PLATFORM_SDK_VERSION}.0.0
diff --git a/sdk/plat_tools_source.prop_template b/sdk/plat_tools_source.prop_template
index 7912856..5d62307 100644
--- a/sdk/plat_tools_source.prop_template
+++ b/sdk/plat_tools_source.prop_template
@@ -1,3 +1,3 @@
Pkg.UserSrc=false
-#Pkg.Revision=${PLATFORM_SDK_VERSION}.0.0
-Pkg.Revision=24.0.1
+Pkg.Revision=${PLATFORM_SDK_VERSION}.0.0
+
diff --git a/sdk/platform_source.prop_template b/sdk/platform_source.prop_template
index 44ace73..5303246 100644
--- a/sdk/platform_source.prop_template
+++ b/sdk/platform_source.prop_template
@@ -2,7 +2,7 @@
Pkg.UserSrc=false
Platform.Version=${PLATFORM_VERSION}
Platform.CodeName=
-Pkg.Revision=2
+Pkg.Revision=1
AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION}
#AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME}
Layoutlib.Api=16
diff --git a/sys-img/images_arm64-v8a_source.prop_template b/sys-img/images_arm64-v8a_source.prop_template
index 7c31def..1a18cf8 100644
--- a/sys-img/images_arm64-v8a_source.prop_template
+++ b/sys-img/images_arm64-v8a_source.prop_template
@@ -1,6 +1,6 @@
Pkg.Desc=Android SDK Platform ${PLATFORM_VERSION}
Pkg.UserSrc=false
-Pkg.Revision=4
+Pkg.Revision=1
AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION}
AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME}
SystemImage.Abi=${TARGET_CPU_ABI}
diff --git a/sys-img/images_armeabi-v7a_source.prop_template b/sys-img/images_armeabi-v7a_source.prop_template
index 36fd33e..9c7a332 100644
--- a/sys-img/images_armeabi-v7a_source.prop_template
+++ b/sys-img/images_armeabi-v7a_source.prop_template
@@ -1,6 +1,6 @@
Pkg.Desc=Android SDK Platform ${PLATFORM_VERSION}
Pkg.UserSrc=false
-Pkg.Revision=4
+Pkg.Revision=1
AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION}
AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME}
SystemImage.Abi=armeabi-v7a
diff --git a/sys-img/images_armeabi_source.prop_template b/sys-img/images_armeabi_source.prop_template
index fec8836..91e9d21 100644
--- a/sys-img/images_armeabi_source.prop_template
+++ b/sys-img/images_armeabi_source.prop_template
@@ -1,6 +1,6 @@
Pkg.Desc=Android SDK Platform ${PLATFORM_VERSION}
Pkg.UserSrc=false
-Pkg.Revision=4
+Pkg.Revision=1
AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION}
AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME}
SystemImage.Abi=armeabi
diff --git a/sys-img/images_x86_64_source.prop_template b/sys-img/images_x86_64_source.prop_template
index 7c31def..1a18cf8 100644
--- a/sys-img/images_x86_64_source.prop_template
+++ b/sys-img/images_x86_64_source.prop_template
@@ -1,6 +1,6 @@
Pkg.Desc=Android SDK Platform ${PLATFORM_VERSION}
Pkg.UserSrc=false
-Pkg.Revision=4
+Pkg.Revision=1
AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION}
AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME}
SystemImage.Abi=${TARGET_CPU_ABI}
diff --git a/sys-img/images_x86_source.prop_template b/sys-img/images_x86_source.prop_template
index 7c31def..1a18cf8 100644
--- a/sys-img/images_x86_source.prop_template
+++ b/sys-img/images_x86_source.prop_template
@@ -1,6 +1,6 @@
Pkg.Desc=Android SDK Platform ${PLATFORM_VERSION}
Pkg.UserSrc=false
-Pkg.Revision=4
+Pkg.Revision=1
AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION}
AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME}
SystemImage.Abi=${TARGET_CPU_ABI}