Add AppShortcuts sample
Demonstrates use of the App Shortcuts feature introduced in API 25.
Change-Id: I52060546d54ed081c9bea4a33b690044c013ccd3
diff --git a/build.gradle b/build.gradle
index 969de2d..6d1225d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -118,6 +118,7 @@
"wearable/wear/WearDrawers",
"ui/window/DragAndDropAcrossApps",
"wearable/wear/WearNotifications",
+"system/AppShortcuts",
]
List<String> taskNames = [
diff --git a/system/AppShortcuts/app/build.gradle b/system/AppShortcuts/app/build.gradle
new file mode 100644
index 0000000..e7b94e7
--- /dev/null
+++ b/system/AppShortcuts/app/build.gradle
@@ -0,0 +1,27 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 25
+ buildToolsVersion "25 rc1"
+
+ defaultConfig {
+ applicationId "com.example.android.shortcutsample"
+ minSdkVersion 25
+ targetSdkVersion 25
+ jackOptions {
+ enabled true
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
+ }
+ }
+}
diff --git a/system/AppShortcuts/app/src/main/AndroidManifest.xml b/system/AppShortcuts/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..9dfc7a3
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/AndroidManifest.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.appshortcuts">
+
+ <uses-sdk android:minSdkVersion="25" />
+
+ <uses-permission android:name="android.permission.INTERNET" />
+
+ <application
+ android:label="@string/app_name"
+ android:icon="@drawable/app"
+ android:resizeableActivity="true">
+
+ <activity android:name="com.example.android.appshortcuts.Main">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ <meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts"/>
+ </activity>
+ <receiver android:name="com.example.android.appshortcuts.MyReceiver">
+ <intent-filter>
+ <action android:name="android.intent.action.LOCALE_CHANGED" />
+ </intent-filter>
+ </receiver>
+ </application>
+</manifest>
diff --git a/system/AppShortcuts/app/src/main/java/com/example/android/appshortcuts/Main.java b/system/AppShortcuts/app/src/main/java/com/example/android/appshortcuts/Main.java
new file mode 100644
index 0000000..22b29b5
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/java/com/example/android/appshortcuts/Main.java
@@ -0,0 +1,249 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+package com.example.android.appshortcuts;
+
+import android.app.AlertDialog;
+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;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.view.inputmethod.EditorInfo;
+import android.widget.BaseAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Main extends ListActivity implements OnClickListener {
+ static final String TAG = "ShortcutSample";
+
+ private static final String ID_ADD_WEBSITE = "add_website";
+
+ private static final String ACTION_ADD_WEBSITE =
+ "com.example.android.shortcutsample.ADD_WEBSITE";
+
+ private MyAdapter mAdapter;
+
+ private ShortcutHelper mHelper;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.main);
+
+ mHelper = new ShortcutHelper(this);
+
+ mHelper.maybeRestoreAllDynamicShortcuts();
+
+ mHelper.refreshShortcuts(/*force=*/ false);
+
+ if (ACTION_ADD_WEBSITE.equals(getIntent().getAction())) {
+ // Invoked via the manifest shortcut.
+ addWebSite();
+ }
+
+ mAdapter = new MyAdapter(this.getApplicationContext());
+ setListAdapter(mAdapter);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ refreshList();
+ }
+
+ /**
+ * Handle the add button.
+ */
+ public void onAddPressed(View v) {
+ addWebSite();
+ }
+
+ private void addWebSite() {
+ Log.i(TAG, "addWebSite");
+
+ // This is important. This allows the launcher to build a prediction model.
+ mHelper.reportShortcutUsed(ID_ADD_WEBSITE);
+
+ final EditText editUri = new EditText(this);
+
+ editUri.setHint("http://www.android.com/");
+ editUri.setInputType(EditorInfo.TYPE_TEXT_VARIATION_URI);
+
+ new AlertDialog.Builder(this)
+ .setTitle("Add new website")
+ .setMessage("Type URL of a website")
+ .setView(editUri)
+ .setPositiveButton("Add", (dialog, whichButton) -> {
+ final String url = editUri.getText().toString().trim();
+ if (url.length() > 0) {
+ 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());
+ }
+
+ @Override
+ public void onClick(View v) {
+ final ShortcutInfo shortcut = (ShortcutInfo) ((View) v.getParent()).getTag();
+
+ switch (v.getId()) {
+ case R.id.disable:
+ if (shortcut.isEnabled()) {
+ mHelper.disableShortcut(shortcut);
+ } else {
+ mHelper.enableShortcut(shortcut);
+ }
+ refreshList();
+ break;
+ case R.id.remove:
+ mHelper.removeShortcut(shortcut);
+ refreshList();
+ break;
+ }
+ }
+
+ private static final List<ShortcutInfo> EMPTY_LIST = new ArrayList<>();
+
+ private String getType(ShortcutInfo shortcut) {
+ final StringBuilder sb = new StringBuilder();
+ String sep = "";
+ if (shortcut.isDynamic()) {
+ sb.append(sep);
+ sb.append("Dynamic");
+ sep = ", ";
+ }
+ if (shortcut.isPinned()) {
+ sb.append(sep);
+ sb.append("Pinned");
+ sep = ", ";
+ }
+ if (!shortcut.isEnabled()) {
+ sb.append(sep);
+ sb.append("Disabled");
+ sep = ", ";
+ }
+ return sb.toString();
+ }
+
+ private class MyAdapter extends BaseAdapter {
+ private final Context mContext;
+ private final LayoutInflater mInflater;
+ private List<ShortcutInfo> mList = EMPTY_LIST;
+
+ public MyAdapter(Context context) {
+ mContext = context;
+ mInflater = mContext.getSystemService(LayoutInflater.class);
+ }
+
+ @Override
+ public int getCount() {
+ return mList.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ return mList.get(position);
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public boolean hasStableIds() {
+ return false;
+ }
+
+ @Override
+ public boolean areAllItemsEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnabled(int position) {
+ return true;
+ }
+
+ public void setShortcuts(List<ShortcutInfo> list) {
+ mList = list;
+ notifyDataSetChanged();
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ final View view;
+ if (convertView != null) {
+ view = convertView;
+ } else {
+ view = mInflater.inflate(R.layout.list_item, null);
+ }
+
+ bindView(view, position, mList.get(position));
+
+ return view;
+ }
+
+ public void bindView(View view, int position, ShortcutInfo shortcut) {
+ view.setTag(shortcut);
+
+ final TextView line1 = (TextView) view.findViewById(R.id.line1);
+ final TextView line2 = (TextView) view.findViewById(R.id.line2);
+
+ line1.setText(shortcut.getLongLabel());
+
+ line2.setText(getType(shortcut));
+
+ final Button remove = (Button) view.findViewById(R.id.remove);
+ final Button disable = (Button) view.findViewById(R.id.disable);
+
+ disable.setText(
+ shortcut.isEnabled() ? R.string.disable_shortcut : R.string.enable_shortcut);
+
+ remove.setOnClickListener(Main.this);
+ disable.setOnClickListener(Main.this);
+ }
+ }
+}
diff --git a/system/AppShortcuts/app/src/main/java/com/example/android/appshortcuts/MyReceiver.java b/system/AppShortcuts/app/src/main/java/com/example/android/appshortcuts/MyReceiver.java
new file mode 100644
index 0000000..adb9532
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/java/com/example/android/appshortcuts/MyReceiver.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+package com.example.android.appshortcuts;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+public class MyReceiver extends BroadcastReceiver {
+ private static final String TAG = Main.TAG;
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.i(TAG, "onReceive: " + intent);
+ if (Intent.ACTION_LOCALE_CHANGED.equals(intent.getAction())) {
+ // Refresh all shortcut to update the labels.
+ // (Right now shortcut labels don't contain localized strings though.)
+ new ShortcutHelper(context).refreshShortcuts(/*force=*/ true);
+ }
+ }
+}
diff --git a/system/AppShortcuts/app/src/main/java/com/example/android/appshortcuts/ShortcutHelper.java b/system/AppShortcuts/app/src/main/java/com/example/android/appshortcuts/ShortcutHelper.java
new file mode 100644
index 0000000..31f6196
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/java/com/example/android/appshortcuts/ShortcutHelper.java
@@ -0,0 +1,242 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+package com.example.android.appshortcuts;
+
+import android.content.Context;
+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;
+import java.util.List;
+import java.util.function.BooleanSupplier;
+
+public class ShortcutHelper {
+ private static final String TAG = Main.TAG;
+
+ private static final String EXTRA_LAST_REFRESH =
+ "com.example.android.shortcutsample.EXTRA_LAST_REFRESH";
+
+ private static final long REFRESH_INTERVAL_MS = 60 * 60 * 1000;
+
+ private final Context mContext;
+
+ private final ShortcutManager mShortcutManager;
+
+ public ShortcutHelper(Context context) {
+ mContext = context;
+ mShortcutManager = mContext.getSystemService(ShortcutManager.class);
+ }
+
+ public void maybeRestoreAllDynamicShortcuts() {
+ if (mShortcutManager.getDynamicShortcuts().size() == 0) {
+ // NOTE: If this application is always supposed to have dynamic shortcuts, then publish
+ // them here.
+ // Note when an application is "restored" on a new device, all dynamic shortcuts
+ // will *not* be restored but the pinned shortcuts *will*.
+ }
+ }
+
+ public void reportShortcutUsed(String id) {
+ mShortcutManager.reportShortcutUsed(id);
+ }
+
+ /**
+ * Use this when interacting with ShortcutManager to show consistent error messages.
+ */
+ private void callShortcutManager(BooleanSupplier r) {
+ try {
+ if (!r.getAsBoolean()) {
+ Utils.showToast(mContext, "Call to ShortcutManager is rate-limited");
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "Caught Exception", e);
+ Utils.showToast(mContext, "Error while calling ShortcutManager: " + e.toString());
+ }
+ }
+
+ /**
+ * Return all mutable shortcuts from this app self.
+ */
+ public List<ShortcutInfo> getShortcuts() {
+ // Load mutable dynamic shortcuts and pinned shortcuts and put them into a single list
+ // removing duplicates.
+
+ final List<ShortcutInfo> ret = new ArrayList<>();
+ final HashSet<String> seenKeys = new HashSet<>();
+
+ // Check existing shortcuts shortcuts
+ for (ShortcutInfo shortcut : mShortcutManager.getDynamicShortcuts()) {
+ if (!shortcut.isImmutable()) {
+ ret.add(shortcut);
+ seenKeys.add(shortcut.getId());
+ }
+ }
+ for (ShortcutInfo shortcut : mShortcutManager.getPinnedShortcuts()) {
+ if (!shortcut.isImmutable() && !seenKeys.contains(shortcut.getId())) {
+ ret.add(shortcut);
+ seenKeys.add(shortcut.getId());
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * Called when the activity starts. Looks for shortcuts that have been pushed and refreshes
+ * them (but the refresh part isn't implemented yet...).
+ */
+ public void refreshShortcuts(boolean force) {
+ new AsyncTask<Void, Void, Void>() {
+ @Override
+ protected Void doInBackground(Void... params) {
+ Log.i(TAG, "refreshingShortcuts...");
+
+ final long now = System.currentTimeMillis();
+ final long staleThreshold = force ? now : now - REFRESH_INTERVAL_MS;
+
+ // Check all existing dynamic and pinned shortcut, and if their last refresh
+ // time is older than a certain threshold, update them.
+
+ final List<ShortcutInfo> updateList = new ArrayList<>();
+
+ for (ShortcutInfo shortcut : getShortcuts()) {
+ if (shortcut.isImmutable()) {
+ continue;
+ }
+
+ final PersistableBundle extras = shortcut.getExtras();
+ if (extras != null && extras.getLong(EXTRA_LAST_REFRESH) >= staleThreshold) {
+ // Shortcut still fresh.
+ continue;
+ }
+ Log.i(TAG, "Refreshing shortcut: " + shortcut.getId());
+
+ final ShortcutInfo.Builder b = new ShortcutInfo.Builder(
+ mContext, shortcut.getId());
+
+ setSiteInformation(b, shortcut.getIntent().getData());
+ setExtras(b);
+
+ updateList.add(b.build());
+ }
+ // Call update.
+ if (updateList.size() > 0) {
+ callShortcutManager(() -> mShortcutManager.updateShortcuts(updateList));
+ }
+
+ return null;
+ }
+ }.execute();
+ }
+
+ private ShortcutInfo createShortcutForUrl(String urlAsString) {
+ Log.i(TAG, "createShortcutForUrl: " + urlAsString);
+
+ final ShortcutInfo.Builder b = new ShortcutInfo.Builder(mContext, urlAsString);
+
+ final Uri uri = Uri.parse(urlAsString);
+ b.setIntent(new Intent(Intent.ACTION_VIEW, uri));
+
+ setSiteInformation(b, uri);
+ setExtras(b);
+
+ return b.build();
+ }
+
+ private ShortcutInfo.Builder setSiteInformation(ShortcutInfo.Builder b, Uri uri) {
+ // TODO Get the actual site <title> and use it.
+ // TODO Set the current locale to accept-language to get localized title.
+ b.setShortLabel(uri.getHost());
+ b.setLongLabel(uri.toString());
+
+ Bitmap bmp = fetchFavicon(uri);
+ if (bmp != null) {
+ b.setIcon(Icon.createWithBitmap(bmp));
+ } else {
+ b.setIcon(Icon.createWithResource(mContext, R.drawable.link));
+ }
+
+ return b;
+ }
+
+ private ShortcutInfo.Builder setExtras(ShortcutInfo.Builder b) {
+ final PersistableBundle extras = new PersistableBundle();
+ extras.putLong(EXTRA_LAST_REFRESH, System.currentTimeMillis());
+ b.setExtras(extras);
+ return b;
+ }
+
+ private String normalizeUrl(String urlAsString) {
+ if (urlAsString.startsWith("http://") || urlAsString.startsWith("https://")) {
+ return urlAsString;
+ } else {
+ return "http://" + urlAsString;
+ }
+ }
+
+ public void addWebSiteShortcut(String urlAsString) {
+ final String uriFinal = urlAsString;
+ callShortcutManager(() -> {
+ final ShortcutInfo shortcut = createShortcutForUrl(normalizeUrl(uriFinal));
+ return mShortcutManager.addDynamicShortcuts(Arrays.asList(shortcut));
+ });
+ }
+
+ public void removeShortcut(ShortcutInfo shortcut) {
+ mShortcutManager.removeDynamicShortcuts(Arrays.asList(shortcut.getId()));
+ }
+
+ public void disableShortcut(ShortcutInfo shortcut) {
+ mShortcutManager.disableShortcuts(Arrays.asList(shortcut.getId()));
+ }
+
+ 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/system/AppShortcuts/app/src/main/java/com/example/android/appshortcuts/Utils.java b/system/AppShortcuts/app/src/main/java/com/example/android/appshortcuts/Utils.java
new file mode 100644
index 0000000..5852734
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/java/com/example/android/appshortcuts/Utils.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+package com.example.android.appshortcuts;
+
+import android.content.Context;
+import android.os.Handler;
+import android.os.Looper;
+import android.widget.Toast;
+
+public class Utils {
+ private Utils() {
+ }
+
+ public static void showToast(Context context, String message) {
+ new Handler(Looper.getMainLooper()).post(() -> {
+ Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
+ });
+ }
+}
diff --git a/system/AppShortcuts/app/src/main/res/drawable-nodpi/add.png b/system/AppShortcuts/app/src/main/res/drawable-nodpi/add.png
new file mode 100644
index 0000000..86a2ebd
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/res/drawable-nodpi/add.png
Binary files differ
diff --git a/system/AppShortcuts/app/src/main/res/drawable-nodpi/app.png b/system/AppShortcuts/app/src/main/res/drawable-nodpi/app.png
new file mode 100644
index 0000000..39ca2f9
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/res/drawable-nodpi/app.png
Binary files differ
diff --git a/system/AppShortcuts/app/src/main/res/drawable-nodpi/link.png b/system/AppShortcuts/app/src/main/res/drawable-nodpi/link.png
new file mode 100644
index 0000000..c4297c4
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/res/drawable-nodpi/link.png
Binary files differ
diff --git a/system/AppShortcuts/app/src/main/res/layout/list_item.xml b/system/AppShortcuts/app/src/main/res/layout/list_item.xml
new file mode 100644
index 0000000..f7129a8
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/res/layout/list_item.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+>
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_gravity="center_vertical"
+ android:orientation="vertical"
+ android:paddingLeft="8dip"
+ >
+ <TextView
+ android:id="@+id/line1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="#000000"
+ android:textSize="16sp"
+ />
+ <TextView
+ android:id="@+id/line2"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="#444444"
+ />
+ </LinearLayout>
+ <Button
+ android:id="@+id/remove"
+ android:text="@string/remove_shortcut"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:visibility="visible"
+ style="@android:style/Widget.Material.Button.Borderless"/>
+ <Button
+ android:id="@+id/disable"
+ android:text="@string/disable_shortcut"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:visibility="visible"
+ style="@android:style/Widget.Material.Button.Borderless"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/system/AppShortcuts/app/src/main/res/layout/main.xml b/system/AppShortcuts/app/src/main/res/layout/main.xml
new file mode 100644
index 0000000..2d87c07
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/res/layout/main.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+ <Button
+ android:id="@+id/add"
+ android:text="@string/add_new_website"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:onClick="onAddPressed"/>
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="#444444"
+ android:text="@string/existing_shortcuts"
+ />
+ <ListView
+ android:id="@android:id/list"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:enabled="true"
+ />
+</LinearLayout>
+
+
diff --git a/system/AppShortcuts/app/src/main/res/values-ja/strings.xml b/system/AppShortcuts/app/src/main/res/values-ja/strings.xml
new file mode 100644
index 0000000..d35d334
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/res/values-ja/strings.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_name">アプリのショートカットサンプル</string>
+ <string name="add_new_website">ウェブサイト追加</string>
+ <string name="add_new_website_short">追加</string>
+ <string name="existing_shortcuts">既存のショートカット:</string>
+ <string name="remove_shortcut">削除</string>
+ <string name="disable_shortcut">無効</string>
+ <string name="enable_shortcut">有効</string>
+</resources>
diff --git a/system/AppShortcuts/app/src/main/res/values/strings.xml b/system/AppShortcuts/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..269bd93
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/res/values/strings.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_name">App Shortcuts Sample</string>
+ <string name="add_new_website">Add New Website</string>
+ <string name="add_new_website_short">Add Website</string>
+ <string name="existing_shortcuts">Existing shortcuts:</string>
+ <string name="remove_shortcut">Remove</string>
+ <string name="disable_shortcut">Disable</string>
+ <string name="enable_shortcut">Enable</string>
+</resources>
diff --git a/system/AppShortcuts/app/src/main/res/xml/shortcuts.xml b/system/AppShortcuts/app/src/main/res/xml/shortcuts.xml
new file mode 100644
index 0000000..1430f43
--- /dev/null
+++ b/system/AppShortcuts/app/src/main/res/xml/shortcuts.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" >
+ <shortcut
+ android:shortcutId="add_website"
+ android:icon="@drawable/add"
+ android:shortcutShortLabel="@string/add_new_website_short"
+ android:shortcutLongLabel="@string/add_new_website"
+ >
+ <intent
+ android:action="com.example.android.appshortcuts.ADD_WEBSITE"
+ android:targetPackage="com.example.android.appshortcuts"
+ android:targetClass="com.example.android.appshortcuts.Main"
+ />
+ </shortcut>
+</shortcuts>
diff --git a/system/AppShortcuts/build.gradle b/system/AppShortcuts/build.gradle
new file mode 100644
index 0000000..26d9e21
--- /dev/null
+++ b/system/AppShortcuts/build.gradle
@@ -0,0 +1,26 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.2.1'
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+// BEGIN_EXCLUDE
+import com.example.android.samples.build.SampleGenPlugin
+apply plugin: SampleGenPlugin
+
+samplegen {
+ pathToBuild "../../../../build"
+ pathToSamplesCommon "../../common"
+}
+apply from: "../../../../build/build.gradle"
+// END_EXCLUDE
diff --git a/system/AppShortcuts/buildSrc/build.gradle b/system/AppShortcuts/buildSrc/build.gradle
new file mode 100644
index 0000000..8c294c2
--- /dev/null
+++ b/system/AppShortcuts/buildSrc/build.gradle
@@ -0,0 +1,15 @@
+repositories {
+ mavenCentral()
+}
+dependencies {
+ compile 'org.freemarker:freemarker:2.3.20'
+}
+
+sourceSets {
+ main {
+ groovy {
+ srcDir new File(rootDir, "../../../../../build/buildSrc/src/main/groovy")
+ }
+ }
+}
+
diff --git a/system/AppShortcuts/gradle/wrapper/gradle-wrapper.jar b/system/AppShortcuts/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..13372ae
--- /dev/null
+++ b/system/AppShortcuts/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/system/AppShortcuts/gradle/wrapper/gradle-wrapper.properties b/system/AppShortcuts/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..e46bcab
--- /dev/null
+++ b/system/AppShortcuts/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Oct 17 16:40:13 PDT 2016
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
diff --git a/system/AppShortcuts/gradlew b/system/AppShortcuts/gradlew
new file mode 100755
index 0000000..9d82f78
--- /dev/null
+++ b/system/AppShortcuts/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/system/AppShortcuts/gradlew.bat b/system/AppShortcuts/gradlew.bat
new file mode 100644
index 0000000..aec9973
--- /dev/null
+++ b/system/AppShortcuts/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/system/AppShortcuts/screenshots/screenshot1.png b/system/AppShortcuts/screenshots/screenshot1.png
new file mode 100644
index 0000000..0cdaa9b
--- /dev/null
+++ b/system/AppShortcuts/screenshots/screenshot1.png
Binary files differ
diff --git a/system/AppShortcuts/settings.gradle b/system/AppShortcuts/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/system/AppShortcuts/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/system/AppShortcuts/template-params.xml b/system/AppShortcuts/template-params.xml
new file mode 100644
index 0000000..ba19eba
--- /dev/null
+++ b/system/AppShortcuts/template-params.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2014 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.
+-->
+<sample>
+ <name>AppShortcuts</name>
+ <group>System</group>
+ <package>com.example.android.appshortcuts</package>
+
+ <minSdk>25</minSdk>
+
+ <strings>
+ <intro>
+ <![CDATA[
+ This sample demonstrates how to use the Launcher Shortcuts API introduced in API 25.
+ This API allows an application to define a set of Intents which are displayed as
+ when a user long-presses on the app's launcher icon. Examples are given for
+ registering both links both statically in XML, as well as dynamically at runtime.
+ ]]>
+ </intro>
+ </strings>
+
+ <template src="base-build" />
+
+ <metadata>
+ <status>PUBLISHED</status>
+ <categories>System</categories>
+ <technologies>Android</technologies>
+ <languages>Java</languages>
+ <solutions>Mobile</solutions>
+ <level>INTERMEDIATE</level>
+ <icon>screenshots/web-icon.png</icon>
+ <screenshots>
+ <img>screenshots/screenshot-1.png</img>
+ </screenshots>
+ <api_refs>
+ <android>android.content.pm.ShortcutManager</android>
+ </api_refs>
+
+ <description>
+<![CDATA[
+This sample demonstrates how to use the Launcher Shortcuts API introduced in Android 7.1 (API 25).
+This API allows an application to define a set of Intents which are displayed as when a user
+long-presses on the app's launcher icon. Examples are given for registering both links both
+statically in XML, as well as dynamically at runtime.
+]]>
+ </description>
+
+ <intro>
+<![CDATA[
+You can use the shortcuts feature in Android 7.1 (API 25) to bring users from the launcher
+directly to key actions within your app. Users simply long-press your app's launcher icon
+to reveal the app's shortcuts, then tap on a shortcut to jump to the associated action.
+These shortcuts are a great way to engage users, and they let you surface the functionality
+of your app even before users launch your app.
+
+Each shortcut references an intent, each of which launches a specific action or task, and
+you can create a shortcut for any action that you can express as an intent. For example, you
+can create intents for sending a new text message, making a reservation, playing a video,
+continuing a game, loading a map location, and much more.
+
+You can create shortcuts for your app statically by adding them to a resource file in the APK,
+or you can add them dynamically at runtime. Static shortcuts are ideal for common actions,
+and dynamic shortcuts let you highlight actions based on users' preferences, behavior, location,
+and so on. This sample demonstrates both types of shortcuts.
+
+You can offer up to five shortcuts in each of your apps.
+
+After your app adds shortcuts, they're available on any launcher that supports them, such as the
+Pixel launcher (the default launcher on Pixel devices), the Now launcher (the default launcher on
+Nexus devices), and other launchers that provide support.
+
+For more information on creating shortcuts, see the [Shortcuts to App Actions][1] developer guide.
+
+[1]: https://developer.android.com/preview/shortcuts.html
+]]>
+ </intro>
+ </metadata>
+</sample>