Merge "SDK Addon multi-sys-img support, part 2." into lmp-dev
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java
index a48a081..a1afc39 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java
@@ -67,7 +67,7 @@
try {
iam.startActivity(null, null, intent, null, null, null, 0,
- 0, null, null, null);
+ 0, null, null);
} catch (RemoteException e) {
System.err.println("** Failed talking with activity manager!");
return MonkeyEvent.INJECT_ERROR_REMOTE_EXCEPTION;
diff --git a/ndk/platforms/android-14/samples/native-media/AndroidManifest.xml b/ndk/platforms/android-14/samples/native-media/AndroidManifest.xml
index 07668cf..acecd4e 100644
--- a/ndk/platforms/android-14/samples/native-media/AndroidManifest.xml
+++ b/ndk/platforms/android-14/samples/native-media/AndroidManifest.xml
@@ -2,6 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nativemedia">
+ <!-- INTERNET is needed to use a URI-based media player, depending on the URI -->
+ <uses-permission android:name="android.permission.INTERNET"></uses-permission>
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
+
<uses-feature android:glEsVersion="0x00020000" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
@@ -17,7 +21,4 @@
<uses-sdk android:minSdkVersion="14" />
- <!-- INTERNET is needed to use a URI-based media player, depending on the URI -->
- <uses-permission android:name="android.permission.INTERNET"></uses-permission>
-
</manifest>
diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml
index 0fe694d..60287d5 100644
--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -998,6 +998,24 @@
</intent-filter>
</activity>
+ <activity android:name=".app.ActionBarNavigation"
+ android:label="@string/action_bar_navigation"
+ android:enabled="@bool/atLeastJellyBean"
+ android:taskAffinity=":bar_navigation"
+ android:launchMode="singleTask">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".app.ActionBarNavigationTarget"
+ android:label="@string/action_bar_navigation_target"
+ android:enabled="@bool/atLeastJellyBean"
+ android:parentActivityName=".app.ActionBarNavigation"
+ android:taskAffinity=":bar_navigation">
+ </activity>
+
<activity android:name=".app.PrintBitmap"
android:label="@string/print_bitmap"
android:enabled="@bool/atLeastKitKat">
@@ -1348,6 +1366,12 @@
</intent-filter>
</service>
+ <provider android:name=".os.MmsFileProvider"
+ android:authorities="com.example.android.apis.os.MmsFileProvider"
+ android:enabled="@bool/atLeastLRelease"
+ android:permission="android.permission.MODIFY_PHONE_STATE"
+ android:exported="true"/>
+
<!-- ************************************* -->
<!-- ANDROID.ANIMATION PACKAGE SAMPLES -->
<!-- ************************************* -->
diff --git a/samples/ApiDemos/res/layout/action_bar_navigation.xml b/samples/ApiDemos/res/layout/action_bar_navigation.xml
new file mode 100644
index 0000000..8154950
--- /dev/null
+++ b/samples/ApiDemos/res/layout/action_bar_navigation.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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:padding="4dip"
+ android:gravity="center_horizontal"
+ android:layout_width="match_parent" android:layout_height="match_parent">
+
+ <TextView
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:layout_marginTop="16dp" android:layout_marginBottom="16dp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/action_bar_navigation_msg"/>
+
+ <TextView android:id="@+id/launchedfrom"
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:layout_weight="0" android:layout_marginBottom="32dp"
+ android:textAppearance="?android:attr/textAppearanceMedium"/>
+
+ <Button android:id="@+id/newactivity"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:onClick="onNewActivity"
+ android:text="@string/btn_newactivity">
+ <requestFocus />
+ </Button>
+
+ <Button android:id="@+id/newdoc"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:onClick="onNewDocument"
+ android:text="@string/btn_newdoc">
+ <requestFocus />
+ </Button>
+
+</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/action_bar_navigation_target.xml b/samples/ApiDemos/res/layout/action_bar_navigation_target.xml
new file mode 100644
index 0000000..1f8f063
--- /dev/null
+++ b/samples/ApiDemos/res/layout/action_bar_navigation_target.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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:padding="4dip"
+ android:gravity="center_horizontal"
+ android:layout_width="match_parent" android:layout_height="match_parent">
+
+ <TextView
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:layout_marginTop="16dp" android:layout_marginBottom="16dp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/action_bar_navigation_target_msg"/>
+
+</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/alert_dialog.xml b/samples/ApiDemos/res/layout/alert_dialog.xml
index 9855605..deb712a 100644
--- a/samples/ApiDemos/res/layout/alert_dialog.xml
+++ b/samples/ApiDemos/res/layout/alert_dialog.xml
@@ -38,6 +38,9 @@
<Button android:id="@+id/progress_button"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:text="@string/alert_dialog_progress_button"/>
+ <Button android:id="@+id/progress_spinner_button"
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:text="@string/alert_dialog_progress_spinner_button"/>
<Button android:id="@+id/radio_button"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:text="@string/alert_dialog_single_choice"/>
@@ -56,5 +59,11 @@
<Button android:id="@+id/two_buttons_holo_light"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:text="@string/alert_dialog_two_buttons_holo_light"/>
+ <Button android:id="@+id/two_buttons_default_light"
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:text="@string/alert_dialog_two_buttons_default_light"/>
+ <Button android:id="@+id/two_buttons_default_dark"
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:text="@string/alert_dialog_two_buttons_default_dark"/>
</LinearLayout>
</ScrollView>
diff --git a/samples/ApiDemos/res/layout/alert_dialog_text_entry.xml b/samples/ApiDemos/res/layout/alert_dialog_text_entry.xml
index 1f4d093..61bd3f5 100644
--- a/samples/ApiDemos/res/layout/alert_dialog_text_entry.xml
+++ b/samples/ApiDemos/res/layout/alert_dialog_text_entry.xml
@@ -17,14 +17,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:paddingStart="24dp"
+ android:paddingEnd="24dp"
android:orientation="vertical">
<TextView
android:id="@+id/username_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:layout_marginLeft="20dip"
- android:layout_marginRight="20dip"
android:text="@string/alert_dialog_username"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium" />
@@ -33,8 +33,6 @@
android:id="@+id/username_edit"
android:layout_height="wrap_content"
android:layout_width="match_parent"
- android:layout_marginLeft="20dip"
- android:layout_marginRight="20dip"
android:scrollHorizontally="true"
android:autoText="false"
android:capitalize="none"
@@ -45,8 +43,6 @@
android:id="@+id/password_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:layout_marginLeft="20dip"
- android:layout_marginRight="20dip"
android:text="@string/alert_dialog_password"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium" />
@@ -55,8 +51,6 @@
android:id="@+id/password_edit"
android:layout_height="wrap_content"
android:layout_width="match_parent"
- android:layout_marginLeft="20dip"
- android:layout_marginRight="20dip"
android:scrollHorizontally="true"
android:autoText="false"
android:capitalize="none"
diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml
index 8fd47a7..58daf39 100644
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -522,13 +522,16 @@
<string name="alert_dialog_two_buttons">OK Cancel dialog with a message</string>
<string name="alert_dialog_two_buttons_old_school">OK Cancel dialog with traditional theme</string>
<string name="alert_dialog_two_buttons_holo_light">OK Cancel dialog with Holo Light theme</string>
+ <string name="alert_dialog_two_buttons_default_light">OK Cancel dialog with DeviceDefault Light theme</string>
+ <string name="alert_dialog_two_buttons_default_dark">OK Cancel dialog with DeviceDefault theme</string>
<string name="alert_dialog_two_buttons2">OK Cancel dialog with a long message</string>
<string name="alert_dialog_two_buttons2ultra">OK Cancel dialog with ultra long message</string>
<string name="alert_dialog_select_button">List dialog</string>
<string name="alert_dialog_single_choice">Single choice list</string>
<string name="alert_dialog_multi_choice">Repeat alarm</string>
<string name="alert_dialog_multi_choice_cursor">Send Call to VoiceMail</string>
- <string name="alert_dialog_progress_button">Progress dialog</string>
+ <string name="alert_dialog_progress_button">Progress bar dialog</string>
+ <string name="alert_dialog_progress_spinner_button">Progress spinner dialog</string>
<string name="alert_dialog_text_entry">Text Entry dialog</string>
<string name="alert_dialog_username">Name:</string>
<string name="alert_dialog_password">Password:</string>
@@ -787,10 +790,6 @@
<string name="require_encryption">Require encryption</string>
<string name="activate_encryption">Activate encryption</string>
- <string name="trust_agent_category">Trust Agent Features</string>
- <string name="set_trust_agent_component_name">Enabled Component Name</string>
- <string name="set_trust_agent_feature_list">Enabled Features (comma-separated)</string>
-
<!-- Strings used by DeviceAdminSample controller code -->
<string name="password_sufficient">Current password meets policy requirements</string>
<string name="password_insufficient">Current password does not meet policy requirements</string>
@@ -886,6 +885,19 @@
<string name="btn_toggle_tabs">Toggle tab mode</string>
<string name="btn_remove_all_tabs">Remove all tabs</string>
+ <string name="action_bar_navigation">App/Action Bar/Action Bar Navigation</string>
+ <string name="action_bar_navigation_msg">Demonstrates various ways to navigate in
+ applications involving the action bar. This activity has been launched as the
+ root of the app\'s task.</string>
+ <string name="btn_newactivity">New in-task activity</string>
+ <string name="btn_newdoc">New document</string>
+
+ <string name="action_bar_navigation_target">App Nav Child</string>
+ <string name="action_bar_navigation_target_msg">This is a sub-activity launched by the
+ application. It may be in either the app\'s main task or another task. Press
+ up on the action bar to navigate up in the app\'s hierarchy, regardless of where
+ this activity appears.</string>
+
<!-- ================================= -->
<!-- app/print print examples strings -->
<!-- ================================= -->
diff --git a/samples/ApiDemos/res/values/styles.xml b/samples/ApiDemos/res/values/styles.xml
index 0fa0cc1..bca6101 100644
--- a/samples/ApiDemos/res/values/styles.xml
+++ b/samples/ApiDemos/res/values/styles.xml
@@ -125,7 +125,7 @@
<item name="android:windowExitTransition">@transition/explode</item>
<item name="android:windowSharedElementEnterTransition">@transition/move_image</item>
<item name="android:windowSharedElementExitTransition">@transition/move_image</item>
- <item name="android:windowAllowExitTransitionOverlap">true</item>
+ <item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowAllowEnterTransitionOverlap">false</item>
</style>
diff --git a/samples/ApiDemos/res/xml/device_admin_general.xml b/samples/ApiDemos/res/xml/device_admin_general.xml
index 1d0084e..cfd0048 100644
--- a/samples/ApiDemos/res/xml/device_admin_general.xml
+++ b/samples/ApiDemos/res/xml/device_admin_general.xml
@@ -57,19 +57,4 @@
</PreferenceCategory>
- <PreferenceCategory
- android:title="@string/trust_agent_category" >
-
- <EditTextPreference
- android:key="key_trust_agent_component"
- android:title="@string/set_trust_agent_component_name"
- android:dialogTitle="@string/set_trust_agent_component_name" />
-
- <EditTextPreference
- android:key="key_trust_agent_features"
- android:title="@string/set_trust_agent_feature_list"
- android:dialogTitle="@string/set_trust_agent_feature_list" />
-
- </PreferenceCategory>
-
</PreferenceScreen>
diff --git a/samples/ApiDemos/src/com/example/android/apis/ApiDemos.java b/samples/ApiDemos/src/com/example/android/apis/ApiDemos.java
index ffce027..fd0492c 100644
--- a/samples/ApiDemos/src/com/example/android/apis/ApiDemos.java
+++ b/samples/ApiDemos/src/com/example/android/apis/ApiDemos.java
@@ -143,7 +143,8 @@
protected void onListItemClick(ListView l, View v, int position, long id) {
Map<String, Object> map = (Map<String, Object>)l.getItemAtPosition(position);
- Intent intent = (Intent) map.get("intent");
+ Intent intent = new Intent((Intent) map.get("intent"));
+ intent.addCategory(Intent.CATEGORY_SAMPLE_CODE);
startActivity(intent);
}
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/animation/ActivityTransition.java b/samples/ApiDemos/src/com/example/android/apis/animation/ActivityTransition.java
index b295826..c969742 100644
--- a/samples/ApiDemos/src/com/example/android/apis/animation/ActivityTransition.java
+++ b/samples/ApiDemos/src/com/example/android/apis/animation/ActivityTransition.java
@@ -19,7 +19,7 @@
import android.app.Activity;
import android.app.ActivityOptions;
-import android.app.SharedElementListener;
+import android.app.SharedElementCallback;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
@@ -104,9 +104,9 @@
mHero = null;
if (name != null) {
mHero = (ImageView) findViewById(getIdForKey(name));
- setEnterSharedElementListener(new SharedElementListener() {
+ setEnterSharedElementCallback(new SharedElementCallback() {
@Override
- public void remapSharedElements(List<String> names,
+ public void onMapSharedElements(List<String> names,
Map<String, View> sharedElements) {
sharedElements.put("hero", mHero);
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ActionBarNavigation.java b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarNavigation.java
new file mode 100644
index 0000000..c22b5d3
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarNavigation.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010 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.apis.app;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.Window;
+import android.widget.TextView;
+import android.widget.Toast;
+import com.example.android.apis.R;
+
+/**
+ * This demonstrates implementing common navigation flows with the action bar.
+ */
+public class ActionBarNavigation extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Turn on the up affordance.
+ final ActionBar bar = getActionBar();
+ bar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
+
+ setContentView(R.layout.action_bar_navigation);
+ TextView text = (TextView)findViewById(R.id.launchedfrom);
+ if (getIntent().hasCategory(Intent.CATEGORY_SAMPLE_CODE)) {
+ text.setText("This was launched from ApiDemos");
+ } else {
+ text.setText("This was created from up navigation");
+ }
+ }
+
+ public void onNewActivity(View button) {
+ Intent intent = new Intent(this, ActionBarNavigationTarget.class);
+ startActivity(intent);
+ }
+
+ public void onNewDocument(View button) {
+ Intent intent = new Intent(this, ActionBarNavigationTarget.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
+ startActivity(intent);
+ }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ActionBarNavigationTarget.java b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarNavigationTarget.java
new file mode 100644
index 0000000..9ddc2a2
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarNavigationTarget.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 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.apis.app;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.Window;
+import android.widget.Toast;
+import com.example.android.apis.R;
+
+/**
+ * Target launch activity for demonstrations from {@link ActionBarNavigation}.
+ */
+public class ActionBarNavigationTarget extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.action_bar_navigation_target);
+
+ // Turn on the up affordance.
+ final ActionBar bar = getActionBar();
+ bar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
+ }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java b/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java
index a22753a..1517cad 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java
@@ -67,9 +67,13 @@
private static final int DIALOG_YES_NO_ULTRA_LONG_MESSAGE = 9;
private static final int DIALOG_YES_NO_OLD_SCHOOL_MESSAGE = 10;
private static final int DIALOG_YES_NO_HOLO_LIGHT_MESSAGE = 11;
+ private static final int DIALOG_YES_NO_DEFAULT_LIGHT_MESSAGE = 12;
+ private static final int DIALOG_YES_NO_DEFAULT_DARK_MESSAGE = 13;
+ private static final int DIALOG_PROGRESS_SPINNER = 14;
private static final int MAX_PROGRESS = 100;
-
+
+ private ProgressDialog mProgressSpinnerDialog;
private ProgressDialog mProgressDialog;
private int mProgress;
private Handler mProgressHandler;
@@ -79,7 +83,6 @@
switch (id) {
case DIALOG_YES_NO_MESSAGE:
return new AlertDialog.Builder(AlertDialogSamples.this)
- .setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(R.string.alert_dialog_two_buttons_title)
.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
@@ -120,9 +123,32 @@
}
})
.create();
+ case DIALOG_YES_NO_DEFAULT_LIGHT_MESSAGE:
+ return new AlertDialog.Builder(AlertDialogSamples.this, AlertDialog.THEME_DEVICE_DEFAULT_LIGHT)
+ .setTitle(R.string.alert_dialog_two_buttons_title)
+ .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ }
+ })
+ .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ }
+ })
+ .create();
+ case DIALOG_YES_NO_DEFAULT_DARK_MESSAGE:
+ return new AlertDialog.Builder(AlertDialogSamples.this, AlertDialog.THEME_DEVICE_DEFAULT_DARK)
+ .setTitle(R.string.alert_dialog_two_buttons_title)
+ .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ }
+ })
+ .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ }
+ })
+ .create();
case DIALOG_YES_NO_LONG_MESSAGE:
return new AlertDialog.Builder(AlertDialogSamples.this)
- .setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(R.string.alert_dialog_two_buttons_msg)
.setMessage(R.string.alert_dialog_two_buttons2_msg)
.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
@@ -146,7 +172,6 @@
.create();
case DIALOG_YES_NO_ULTRA_LONG_MESSAGE:
return new AlertDialog.Builder(AlertDialogSamples.this)
- .setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(R.string.alert_dialog_two_buttons_msg)
.setMessage(R.string.alert_dialog_two_buttons2ultra_msg)
.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
@@ -184,7 +209,6 @@
.create();
case DIALOG_PROGRESS:
mProgressDialog = new ProgressDialog(AlertDialogSamples.this);
- mProgressDialog.setIconAttribute(android.R.attr.alertDialogIcon);
mProgressDialog.setTitle(R.string.select_dialog);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setMax(MAX_PROGRESS);
@@ -203,9 +227,13 @@
}
});
return mProgressDialog;
+ case DIALOG_PROGRESS_SPINNER:
+ mProgressSpinnerDialog = new ProgressDialog(AlertDialogSamples.this);
+ mProgressSpinnerDialog.setTitle(R.string.select_dialog);
+ mProgressSpinnerDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
+ return mProgressSpinnerDialog;
case DIALOG_SINGLE_CHOICE:
return new AlertDialog.Builder(AlertDialogSamples.this)
- .setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(R.string.alert_dialog_single_choice)
.setSingleChoiceItems(R.array.select_dialog_items2, 0, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
@@ -228,7 +256,6 @@
.create();
case DIALOG_MULTIPLE_CHOICE:
return new AlertDialog.Builder(AlertDialogSamples.this)
- .setIcon(R.drawable.ic_popup_reminder)
.setTitle(R.string.alert_dialog_multi_choice)
.setMultiChoiceItems(R.array.select_dialog_items3,
new boolean[]{false, true, false, true, false, false, false},
@@ -254,35 +281,33 @@
}
})
.create();
- case DIALOG_MULTIPLE_CHOICE_CURSOR:
- String[] projection = new String[] {
- ContactsContract.Contacts._ID,
+ case DIALOG_MULTIPLE_CHOICE_CURSOR:
+ String[] projection = new String[] {
+ ContactsContract.Contacts._ID,
+ ContactsContract.Contacts.DISPLAY_NAME,
+ ContactsContract.Contacts.SEND_TO_VOICEMAIL
+ };
+ Cursor cursor = managedQuery(ContactsContract.Contacts.CONTENT_URI,
+ projection, null, null, null);
+ return new AlertDialog.Builder(AlertDialogSamples.this)
+ .setTitle(R.string.alert_dialog_multi_choice_cursor)
+ .setMultiChoiceItems(cursor,
+ ContactsContract.Contacts.SEND_TO_VOICEMAIL,
ContactsContract.Contacts.DISPLAY_NAME,
- ContactsContract.Contacts.SEND_TO_VOICEMAIL
- };
- Cursor cursor = managedQuery(ContactsContract.Contacts.CONTENT_URI,
- projection, null, null, null);
- return new AlertDialog.Builder(AlertDialogSamples.this)
- .setIcon(R.drawable.ic_popup_reminder)
- .setTitle(R.string.alert_dialog_multi_choice_cursor)
- .setMultiChoiceItems(cursor,
- ContactsContract.Contacts.SEND_TO_VOICEMAIL,
- ContactsContract.Contacts.DISPLAY_NAME,
- new DialogInterface.OnMultiChoiceClickListener() {
- public void onClick(DialogInterface dialog, int whichButton,
- boolean isChecked) {
- Toast.makeText(AlertDialogSamples.this,
- "Readonly Demo Only - Data will not be updated",
- Toast.LENGTH_SHORT).show();
- }
- })
- .create();
+ new DialogInterface.OnMultiChoiceClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton,
+ boolean isChecked) {
+ Toast.makeText(AlertDialogSamples.this,
+ "Readonly Demo Only - Data will not be updated",
+ Toast.LENGTH_SHORT).show();
+ }
+ })
+ .create();
case DIALOG_TEXT_ENTRY:
// This example shows how to add a custom layout to an AlertDialog
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null);
return new AlertDialog.Builder(AlertDialogSamples.this)
- .setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(R.string.alert_dialog_text_entry)
.setView(textEntryView)
.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
@@ -357,6 +382,14 @@
mProgressHandler.sendEmptyMessage(0);
}
});
+
+ /* Display a custom progress bar */
+ Button progressSpinnerButton = (Button) findViewById(R.id.progress_spinner_button);
+ progressSpinnerButton.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ showDialog(DIALOG_PROGRESS_SPINNER);
+ }
+ });
/* Display a radio button group */
Button radioButton = (Button) findViewById(R.id.radio_button);
@@ -405,6 +438,22 @@
showDialog(DIALOG_YES_NO_HOLO_LIGHT_MESSAGE);
}
});
+
+ /* Two points, in the light default theme */
+ Button twoButtonsDefaultLightTitle = (Button) findViewById(R.id.two_buttons_default_light);
+ twoButtonsDefaultLightTitle.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ showDialog(DIALOG_YES_NO_DEFAULT_LIGHT_MESSAGE);
+ }
+ });
+
+ /* Two points, in the dark default theme */
+ Button twoButtonsDefaultDarkTitle = (Button) findViewById(R.id.two_buttons_default_dark);
+ twoButtonsDefaultDarkTitle.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ showDialog(DIALOG_YES_NO_DEFAULT_DARK_MESSAGE);
+ }
+ });
mProgressHandler = new Handler() {
@Override
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.java b/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.java
index c3e1ed2..82df903 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.java
@@ -26,7 +26,6 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
@@ -42,8 +41,6 @@
import android.util.Log;
import android.widget.Toast;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
/**
@@ -74,8 +71,6 @@
private static final String KEY_DISABLE_NOTIFICATIONS = "key_disable_notifications";
private static final String KEY_DISABLE_UNREDACTED = "key_disable_unredacted";
private static final String KEY_DISABLE_TRUST_AGENTS = "key_disable_trust_agents";
- private static final String KEY_TRUST_AGENT_COMPONENT = "key_trust_agent_component";
- private static final String KEY_TRUST_AGENT_FEATURES = "key_trust_agent_features";
private static final String KEY_DISABLE_KEYGUARD_WIDGETS = "key_disable_keyguard_widgets";
private static final String KEY_DISABLE_KEYGUARD_SECURE_CAMERA
= "key_disable_keyguard_secure_camera";
@@ -279,8 +274,6 @@
private CheckBoxPreference mDisableKeyguardNotificationCheckbox;
private CheckBoxPreference mDisableKeyguardTrustAgentCheckbox;
private CheckBoxPreference mDisableKeyguardUnredactedCheckbox;
- private EditTextPreference mTrustAgentComponent;
- private EditTextPreference mTrustAgentFeatures;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -311,14 +304,6 @@
mDisableKeyguardTrustAgentCheckbox =
(CheckBoxPreference) findPreference(KEY_DISABLE_TRUST_AGENTS);
mDisableKeyguardTrustAgentCheckbox.setOnPreferenceChangeListener(this);
-
- mTrustAgentComponent =
- (EditTextPreference) findPreference(KEY_TRUST_AGENT_COMPONENT);
- mTrustAgentComponent.setOnPreferenceChangeListener(this);
-
- mTrustAgentFeatures =
- (EditTextPreference) findPreference(KEY_TRUST_AGENT_FEATURES);
- mTrustAgentFeatures.setOnPreferenceChangeListener(this);
}
// At onResume time, reload UI with current values as required
@@ -355,8 +340,8 @@
if (super.onPreferenceChange(preference, newValue)) {
return true;
}
+ boolean value = (Boolean) newValue;
if (preference == mEnableCheckbox) {
- boolean value = (Boolean) newValue;
if (value != mAdminActive) {
if (value) {
// Launch the activity to have the user enable our admin.
@@ -374,7 +359,6 @@
}
}
} else if (preference == mDisableCameraCheckbox) {
- boolean value = (Boolean) newValue;
mDPM.setCameraDisabled(mDeviceAdminSample, value);
// Delay update because the change is only applied after exiting this method.
postReloadSummaries();
@@ -382,39 +366,20 @@
|| preference == mDisableKeyguardSecureCameraCheckbox
|| preference == mDisableKeyguardNotificationCheckbox
|| preference == mDisableKeyguardUnredactedCheckbox
- || preference == mDisableKeyguardTrustAgentCheckbox
- || preference == mTrustAgentComponent
- || preference == mTrustAgentFeatures) {
- postUpdateDpmDisableFeatures();
+ || preference == mDisableKeyguardTrustAgentCheckbox) {
+ // Delay update because the change is only applied after exiting this method.
+ getView().post(new Runnable() {
+ @Override
+ public void run() {
+ mDPM.setKeyguardDisabledFeatures(mDeviceAdminSample,
+ createKeyguardDisabledFlag());
+ }
+ });
postReloadSummaries();
}
return true;
}
- private void postUpdateDpmDisableFeatures() {
- getView().post(new Runnable() {
- @Override
- public void run() {
- mDPM.setKeyguardDisabledFeatures(mDeviceAdminSample,
- createKeyguardDisabledFlag());
- String component = mTrustAgentComponent.getText();
- if (component != null) {
- ComponentName agent = ComponentName.unflattenFromString(component);
- if (agent != null) {
- String featureString = mTrustAgentFeatures.getText();
- if (featureString != null) {
- List<String> features = Arrays.asList(featureString.split(","));
- mDPM.setTrustAgentFeaturesEnabled(mDeviceAdminSample, agent,
- features);
- }
- } else {
- Log.w(TAG, "Invalid component: " + component);
- }
- }
- }
- });
- }
-
@Override
protected void reloadSummaries() {
super.reloadSummaries();
@@ -451,17 +416,6 @@
R.string.keyguard_trust_agents_disabled
: R.string.keyguard_trust_agents_enabled);
mDisableKeyguardTrustAgentCheckbox.setSummary(keyguardEnableTrustAgentSummary);
-
- final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
- final boolean trustDisabled =
- (disabled & DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS) != 0;
- String component = prefs.getString(mTrustAgentComponent.getKey(), null);
- mTrustAgentComponent.setSummary(component);
- mTrustAgentComponent.setEnabled(trustDisabled);
-
- String features = prefs.getString(mTrustAgentFeatures.getKey(), null);
- mTrustAgentFeatures.setSummary(features);
- mTrustAgentFeatures.setEnabled(trustDisabled);
}
/** Updates the device capabilities area (dis/enabling) as the admin is (de)activated */
@@ -472,8 +426,6 @@
mDisableKeyguardNotificationCheckbox.setEnabled(enabled);
mDisableKeyguardUnredactedCheckbox.setEnabled(enabled);
mDisableKeyguardTrustAgentCheckbox.setEnabled(enabled);
- mTrustAgentComponent.setEnabled(enabled);
- mTrustAgentFeatures.setEnabled(enabled);
}
}
@@ -1062,6 +1014,14 @@
}
@Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction() == ACTION_DEVICE_ADMIN_DISABLE_REQUESTED) {
+ abortBroadcast();
+ }
+ super.onReceive(context, intent);
+ }
+
+ @Override
public void onEnabled(Context context, Intent intent) {
showToast(context, context.getString(R.string.admin_receiver_status_enabled));
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/media/projection/MediaProjectionDemo.java b/samples/ApiDemos/src/com/example/android/apis/media/projection/MediaProjectionDemo.java
index e4ba329..c593daf 100644
--- a/samples/ApiDemos/src/com/example/android/apis/media/projection/MediaProjectionDemo.java
+++ b/samples/ApiDemos/src/com/example/android/apis/media/projection/MediaProjectionDemo.java
@@ -125,7 +125,8 @@
return;
}
if (mMediaProjection == null) {
- startActivityForResult(mProjectionManager.getScreenCaptureIntent(), PERMISSION_CODE);
+ startActivityForResult(mProjectionManager.createScreenCaptureIntent(),
+ PERMISSION_CODE);
return;
}
mVirtualDisplay = createVirtualDisplay();
diff --git a/samples/ApiDemos/src/com/example/android/apis/os/MmsFileProvider.java b/samples/ApiDemos/src/com/example/android/apis/os/MmsFileProvider.java
new file mode 100644
index 0000000..c5446d9
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/os/MmsFileProvider.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.example.android.apis.os;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import android.content.ContentProvider;
+import android.content.ContentValues;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.ParcelFileDescriptor;
+import android.text.TextUtils;
+
+/**
+ * A very simple content provider that can serve mms files from our cache directory so that
+ * SmsManager#sendMultimdeiaMessage and SmsManager#downloadMultimediaMessage can read/write
+ * the content of the MMS messages to send/download.
+ */
+public class MmsFileProvider extends ContentProvider {
+ @Override
+ public boolean onCreate() {
+ return true;
+ }
+
+ @Override
+ public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
+ String sortOrder) {
+ // Don't support queries.
+ return null;
+ }
+
+ @Override
+ public Uri insert(Uri uri, ContentValues values) {
+ // Don't support inserts.
+ return null;
+ }
+
+ @Override
+ public int delete(Uri uri, String selection, String[] selectionArgs) {
+ // Don't support deletes.
+ return 0;
+ }
+
+ @Override
+ public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
+ // Don't support updates.
+ return 0;
+ }
+
+ @Override
+ public String getType(Uri uri) {
+ // For this sample, assume all files have no type.
+ return null;
+ }
+
+ @Override
+ public ParcelFileDescriptor openFile(Uri uri, String fileMode) throws FileNotFoundException {
+ File file = new File(getContext().getCacheDir(), uri.getPath());
+ int mode = (TextUtils.equals(fileMode, "r") ? ParcelFileDescriptor.MODE_READ_ONLY :
+ ParcelFileDescriptor.MODE_WRITE_ONLY
+ |ParcelFileDescriptor.MODE_TRUNCATE
+ |ParcelFileDescriptor.MODE_CREATE);
+ return ParcelFileDescriptor.open(file, mode);
+ }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/os/MmsMessagingDemo.java b/samples/ApiDemos/src/com/example/android/apis/os/MmsMessagingDemo.java
index 7c7fae5..40209fc 100644
--- a/samples/ApiDemos/src/com/example/android/apis/os/MmsMessagingDemo.java
+++ b/samples/ApiDemos/src/com/example/android/apis/os/MmsMessagingDemo.java
@@ -32,14 +32,18 @@
import android.app.Activity;
import android.app.PendingIntent;
+import android.app.PendingIntent.CanceledException;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
+import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
+import android.os.ParcelFileDescriptor;
import android.telephony.PhoneNumberUtils;
import android.telephony.SmsManager;
import android.telephony.TelephonyManager;
@@ -54,6 +58,13 @@
import com.example.android.apis.R;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Random;
+
public class MmsMessagingDemo extends Activity {
private static final String TAG = "MmsMessagingDemo";
@@ -68,6 +79,9 @@
private EditText mTextInput;
private TextView mSendStatusView;
private Button mSendButton;
+ private File mSendFile;
+ private File mDownloadFile;
+ private Random mRandom = new Random();
private BroadcastReceiver mSentReceiver = new BroadcastReceiver() {
@Override
@@ -144,15 +158,49 @@
Log.d(TAG, "Sending");
mSendStatusView.setText(getResources().getString(R.string.mms_status_sending));
mSendButton.setEnabled(false);
+ final String fileName = "send." + String.valueOf(Math.abs(mRandom.nextLong())) + ".dat";
+ mSendFile = new File(getCacheDir(), fileName);
+
// Making RPC call in non-UI thread
AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
@Override
public void run() {
final byte[] pdu = buildPdu(MmsMessagingDemo.this, recipients, subject, text);
+ Uri writerUri = (new Uri.Builder())
+ .authority("com.example.android.apis.os.MmsFileProvider")
+ .path(fileName)
+ .scheme(ContentResolver.SCHEME_CONTENT)
+ .build();
final PendingIntent pendingIntent = PendingIntent.getBroadcast(
MmsMessagingDemo.this, 0, new Intent(ACTION_MMS_SENT), 0);
- SmsManager.getDefault().sendMultimediaMessage(
- pdu, null/*locationUrl*/, null/*configOverrides*/, pendingIntent);
+ FileOutputStream writer = null;
+ Uri contentUri = null;
+ try {
+ writer = new FileOutputStream(mSendFile);
+ writer.write(pdu);
+ contentUri = writerUri;
+ } catch (final IOException e) {
+ Log.e(TAG, "Error writing send file", e);
+ } finally {
+ if (writer != null) {
+ try {
+ writer.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ if (contentUri != null) {
+ SmsManager.getDefault().sendMultimediaMessage(contentUri,
+ null/*locationUrl*/, null/*configOverrides*/, pendingIntent);
+ } else {
+ Log.e(TAG, "Error writing sending Mms");
+ try {
+ pendingIntent.send(SmsManager.MMS_ERROR_IO_ERROR);
+ } catch (CanceledException ex) {
+ Log.e(TAG, "Mms pending intent cancelled?", ex);
+ }
+ }
}
});
}
@@ -164,22 +212,30 @@
mRecipientsInput.setText("");
mSubjectInput.setText("");
mTextInput.setText("");
+ final String fileName = "download." + String.valueOf(Math.abs(mRandom.nextLong())) + ".dat";
+ mDownloadFile = new File(getCacheDir(), fileName);
// Making RPC call in non-UI thread
AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
@Override
public void run() {
+ Uri contentUri = (new Uri.Builder())
+ .authority("com.example.android.apis.os.MmsFileProvider")
+ .path(fileName)
+ .scheme(ContentResolver.SCHEME_CONTENT)
+ .build();
final PendingIntent pendingIntent = PendingIntent.getBroadcast(
MmsMessagingDemo.this, 0, new Intent(ACTION_MMS_RECEIVED), 0);
- SmsManager.getDefault().downloadMultimediaMessage(locationUrl,
+ SmsManager.getDefault().downloadMultimediaMessage(locationUrl, contentUri,
null/*configOverrides*/, pendingIntent);
}
});
}
private void handleSentResult(int code, Intent intent) {
+ mSendFile.delete();
int status = R.string.mms_status_failed;
if (code == Activity.RESULT_OK) {
- final byte[] response = intent.getByteArrayExtra(SmsManager.MMS_EXTRA_DATA);
+ final byte[] response = intent.getByteArrayExtra(SmsManager.EXTRA_MMS_DATA);
if (response != null) {
final GenericPdu pdu = new PduParser(response).parse();
if (pdu instanceof SendConf) {
@@ -198,6 +254,8 @@
} else {
Log.e(TAG, "MMS not sent, error=" + code);
}
+
+ mSendFile = null;
mSendStatusView.setText(status);
mSendButton.setEnabled(true);
}
@@ -216,24 +274,36 @@
private void handleReceivedResult(Context context, int code, Intent intent) {
int status = R.string.mms_status_failed;
if (code == Activity.RESULT_OK) {
- final byte[] response = intent.getByteArrayExtra(SmsManager.MMS_EXTRA_DATA);
- if (response != null) {
- final GenericPdu pdu = new PduParser(response).parse();
- if (pdu instanceof RetrieveConf) {
- final RetrieveConf retrieveConf = (RetrieveConf) pdu;
- mRecipientsInput.setText(getRecipients(context, retrieveConf));
- mSubjectInput.setText(getSubject(retrieveConf));
- mTextInput.setText(getMessageText(retrieveConf));
- status = R.string.mms_status_downloaded;
+ try {
+ final int nBytes = (int) mDownloadFile.length();
+ FileInputStream reader = new FileInputStream(mDownloadFile);
+ final byte[] response = new byte[nBytes];
+ final int read = reader.read(response, 0, nBytes);
+ if (read == nBytes) {
+ final GenericPdu pdu = new PduParser(response).parse();
+ if (pdu instanceof RetrieveConf) {
+ final RetrieveConf retrieveConf = (RetrieveConf) pdu;
+ mRecipientsInput.setText(getRecipients(context, retrieveConf));
+ mSubjectInput.setText(getSubject(retrieveConf));
+ mTextInput.setText(getMessageText(retrieveConf));
+ status = R.string.mms_status_downloaded;
+ } else {
+ Log.e(TAG, "MMS received, invalid response");
+ }
} else {
- Log.e(TAG, "MMS received, invalid response");
+ Log.e(TAG, "MMS received, empty response");
}
- } else {
- Log.e(TAG, "MMS received, empty response");
+ } catch (FileNotFoundException e) {
+ Log.e(TAG, "MMS received, file not found exception", e);
+ } catch (IOException e) {
+ Log.e(TAG, "MMS received, io exception", e);
+ } finally {
+ mDownloadFile.delete();
}
} else {
Log.e(TAG, "MMS not received, error=" + code);
}
+ mDownloadFile = null;
mSendStatusView.setText(status);
mSendButton.setEnabled(true);
}
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/Shakespeare.java b/samples/Support4Demos/src/com/example/android/supportv4/Shakespeare.java
index 17608d4..d6d4a3c 100644
--- a/samples/Support4Demos/src/com/example/android/supportv4/Shakespeare.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/Shakespeare.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 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.
+ */
package com.example.android.supportv4;
public final class Shakespeare {
diff --git a/samples/Support7Demos/AndroidManifest.xml b/samples/Support7Demos/AndroidManifest.xml
index 14076c3..4077bb1 100644
--- a/samples/Support7Demos/AndroidManifest.xml
+++ b/samples/Support7Demos/AndroidManifest.xml
@@ -176,6 +176,16 @@
</intent-filter>
</activity>
+ <activity android:name=".app.ActionBarWithDrawerLayout"
+ android:label="@string/action_bar_with_navigation_drawer"
+ android:theme="@style/Theme.AppCompat"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
<!-- RecyclerView samples -->
<activity android:name=".widget.RecyclerViewActivity"
android:label="@string/recycler_view"
diff --git a/samples/Support7Demos/res/layout/action_bar_drawer_layout.xml b/samples/Support7Demos/res/layout/action_bar_drawer_layout.xml
new file mode 100644
index 0000000..a68fdb4
--- /dev/null
+++ b/samples/Support7Demos/res/layout/action_bar_drawer_layout.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+
+<!--
+ A DrawerLayout is indended to be used as the top-level content view
+ using match_parent for both width and height to consume the full space available.
+-->
+<android.support.v4.widget.DrawerLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/drawer_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <!-- As the main content view, the view below consumes the entire
+ space available using match_parent in both dimensions. -->
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:scrollbarStyle="outsideOverlay">
+ <TextView android:id="@+id/content_text"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/drawer_layout_summary"
+ android:textAppearance="?android:attr/textAppearanceMedium"/>
+ </ScrollView>
+ <!-- android:layout_gravity="start" tells DrawerLayout to treat
+ this as a sliding drawer on the starting side, which is
+ left for left-to-right locales. The drawer is given a fixed
+ width in dp and extends the full height of the container. A
+ solid background is used for contrast with the content view. -->
+ <ListView android:id="@+id/start_drawer"
+ android:layout_width="300dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="start"
+ android:background="#ff333333"/>
+</android.support.v4.widget.DrawerLayout>
diff --git a/samples/Support7Demos/res/values/strings.xml b/samples/Support7Demos/res/values/strings.xml
index 04dad5d..14569a5 100644
--- a/samples/Support7Demos/res/values/strings.xml
+++ b/samples/Support7Demos/res/values/strings.xml
@@ -54,6 +54,7 @@
<string name="action_bar_tabs">AppCompat/Action Bar/Action Bar Tabs</string>
<string name="action_bar_settings_action_provider">AppCompat/Action Bar/Settings Action Provider</string>
<string name="action_bar_settings_action_provider_no_handling">Handling in onOptionsItemSelected avoided</string>
+ <string name="action_bar_with_navigation_drawer">AppCompat/Action Bar/Navigation Drawer Toggle</string>
<string name="action_bar_search">Search</string>
<string name="action_bar_add">Add</string>
@@ -91,6 +92,36 @@
<string name="action_bar_fragment_has_options_menu">Set has options menu to true</string>
<string name="action_bar_fragment_menu_visibility">Set menu visibility to true</string>
+ <!-- actionbar w/ drawer layout -->
+ <string name="drawer_layout_support">Widget/Drawer layout</string>
+
+ <string name="drawer_layout_summary">This activity illustrates the use of sliding drawers. The
+ drawer may be pulled out from the starting edge, which is left on left-to-right locales,
+ with an edge swipe. If this demo is running on Ice Cream Sandwich or newer you may tap the
+ icon at the starting side of the action bar to open the drawer as well.
+ </string>
+
+ <!-- Title of the navigation drawer, used by accessibility to announce state changes. -->
+ <string name="drawer_title">Navigation</string>
+
+ <!-- Description of the icon that opens the navigation drawer, used by accessibility. -->
+ <string name="drawer_open">Open navigation drawer</string>
+
+ <!-- Description of the icon that closes the navigation drawer, used by accessibility. -->
+ <string name="drawer_close">Close navigation drawer</string>
+
+ <string name="sliding_pane_layout_support">Widget/Sliding pane layout</string>
+
+ <string name="sliding_pane_layout_summary">This activity illustrates the use of sliding panes.
+ The content pane may be slid to one side on narrow devices to reveal the left pane used to
+ select content. Sliding panes can be used to fit a UI intended for wider screens in a
+ smaller space. Tapping the Action Bar\'s Up button at the left side of the bar will navigate
+ up in the hierarchy, represented by the left pane. If you rotate the device to landscape
+ mode, on most devices you will see that both panes fit together side by side with no sliding
+ necessary.
+ </string>
+
+
<string name="sample_media_route_provider_remote">Remote Playback (Simulated)</string>
<string name="sample_media_route_activity_local">Local Playback</string>
<string name="sample_media_route_activity_presentation">Local Playback on Presentation Display</string>
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/Shakespeare.java b/samples/Support7Demos/src/com/example/android/supportv7/Shakespeare.java
new file mode 100644
index 0000000..3b67bec
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/Shakespeare.java
@@ -0,0 +1,239 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.example.android.supportv7;
+
+public final class Shakespeare {
+ /**
+ * Our data, part 1.
+ */
+ public static final String[] TITLES =
+ {
+ "Henry IV (1)",
+ "Henry V",
+ "Henry VIII",
+ "Richard II",
+ "Richard III",
+ "Merchant of Venice",
+ "Othello",
+ "King Lear"
+ };
+
+ /**
+ * Our data, part 2.
+ */
+ public static final String[] DIALOGUE =
+ {
+ "So shaken as we are, so wan with care," +
+ "Find we a time for frighted peace to pant," +
+ "And breathe short-winded accents of new broils" +
+ "To be commenced in strands afar remote." +
+ "No more the thirsty entrance of this soil" +
+ "Shall daub her lips with her own children's blood;" +
+ "Nor more shall trenching war channel her fields," +
+ "Nor bruise her flowerets with the armed hoofs" +
+ "Of hostile paces: those opposed eyes," +
+ "Which, like the meteors of a troubled heaven," +
+ "All of one nature, of one substance bred," +
+ "Did lately meet in the intestine shock" +
+ "And furious close of civil butchery" +
+ "Shall now, in mutual well-beseeming ranks," +
+ "March all one way and be no more opposed" +
+ "Against acquaintance, kindred and allies:" +
+ "The edge of war, like an ill-sheathed knife," +
+ "No more shall cut his master. Therefore, friends," +
+ "As far as to the sepulchre of Christ," +
+ "Whose soldier now, under whose blessed cross" +
+ "We are impressed and engaged to fight," +
+ "Forthwith a power of English shall we levy;" +
+ "Whose arms were moulded in their mothers' womb" +
+ "To chase these pagans in those holy fields" +
+ "Over whose acres walk'd those blessed feet" +
+ "Which fourteen hundred years ago were nail'd" +
+ "For our advantage on the bitter cross." +
+ "But this our purpose now is twelve month old," +
+ "And bootless 'tis to tell you we will go:" +
+ "Therefore we meet not now. Then let me hear" +
+ "Of you, my gentle cousin Westmoreland," +
+ "What yesternight our council did decree" +
+ "In forwarding this dear expedience.",
+
+ "Hear him but reason in divinity," +
+ "And all-admiring with an inward wish" +
+ "You would desire the king were made a prelate:" +
+ "Hear him debate of commonwealth affairs," +
+ "You would say it hath been all in all his study:" +
+ "List his discourse of war, and you shall hear" +
+ "A fearful battle render'd you in music:" +
+ "Turn him to any cause of policy," +
+ "The Gordian knot of it he will unloose," +
+ "Familiar as his garter: that, when he speaks," +
+ "The air, a charter'd libertine, is still," +
+ "And the mute wonder lurketh in men's ears," +
+ "To steal his sweet and honey'd sentences;" +
+ "So that the art and practic part of life" +
+ "Must be the mistress to this theoric:" +
+ "Which is a wonder how his grace should glean it," +
+ "Since his addiction was to courses vain," +
+ "His companies unletter'd, rude and shallow," +
+ "His hours fill'd up with riots, banquets, sports," +
+ "And never noted in him any study," +
+ "Any retirement, any sequestration" +
+ "From open haunts and popularity.",
+
+ "I come no more to make you laugh: things now," +
+ "That bear a weighty and a serious brow," +
+ "Sad, high, and working, full of state and woe," +
+ "Such noble scenes as draw the eye to flow," +
+ "We now present. Those that can pity, here" +
+ "May, if they think it well, let fall a tear;" +
+ "The subject will deserve it. Such as give" +
+ "Their money out of hope they may believe," +
+ "May here find truth too. Those that come to see" +
+ "Only a show or two, and so agree" +
+ "The play may pass, if they be still and willing," +
+ "I'll undertake may see away their shilling" +
+ "Richly in two short hours. Only they" +
+ "That come to hear a merry bawdy play," +
+ "A noise of targets, or to see a fellow" +
+ "In a long motley coat guarded with yellow," +
+ "Will be deceived; for, gentle hearers, know," +
+ "To rank our chosen truth with such a show" +
+ "As fool and fight is, beside forfeiting" +
+ "Our own brains, and the opinion that we bring," +
+ "To make that only true we now intend," +
+ "Will leave us never an understanding friend." +
+ "Therefore, for goodness' sake, and as you are known" +
+ "The first and happiest hearers of the town," +
+ "Be sad, as we would make ye: think ye see" +
+ "The very persons of our noble story" +
+ "As they were living; think you see them great," +
+ "And follow'd with the general throng and sweat" +
+ "Of thousand friends; then in a moment, see" +
+ "How soon this mightiness meets misery:" +
+ "And, if you can be merry then, I'll say" +
+ "A man may weep upon his wedding-day.",
+
+ "First, heaven be the record to my speech!" +
+ "In the devotion of a subject's love," +
+ "Tendering the precious safety of my prince," +
+ "And free from other misbegotten hate," +
+ "Come I appellant to this princely presence." +
+ "Now, Thomas Mowbray, do I turn to thee," +
+ "And mark my greeting well; for what I speak" +
+ "My body shall make good upon this earth," +
+ "Or my divine soul answer it in heaven." +
+ "Thou art a traitor and a miscreant," +
+ "Too good to be so and too bad to live," +
+ "Since the more fair and crystal is the sky," +
+ "The uglier seem the clouds that in it fly." +
+ "Once more, the more to aggravate the note," +
+ "With a foul traitor's name stuff I thy throat;" +
+ "And wish, so please my sovereign, ere I move," +
+ "What my tongue speaks my right drawn sword may prove.",
+
+ "Now is the winter of our discontent" +
+ "Made glorious summer by this sun of York;" +
+ "And all the clouds that lour'd upon our house" +
+ "In the deep bosom of the ocean buried." +
+ "Now are our brows bound with victorious wreaths;" +
+ "Our bruised arms hung up for monuments;" +
+ "Our stern alarums changed to merry meetings," +
+ "Our dreadful marches to delightful measures." +
+ "Grim-visaged war hath smooth'd his wrinkled front;" +
+ "And now, instead of mounting barded steeds" +
+ "To fright the souls of fearful adversaries," +
+ "He capers nimbly in a lady's chamber" +
+ "To the lascivious pleasing of a lute." +
+ "But I, that am not shaped for sportive tricks," +
+ "Nor made to court an amorous looking-glass;" +
+ "I, that am rudely stamp'd, and want love's majesty" +
+ "To strut before a wanton ambling nymph;" +
+ "I, that am curtail'd of this fair proportion," +
+ "Cheated of feature by dissembling nature," +
+ "Deformed, unfinish'd, sent before my time" +
+ "Into this breathing world, scarce half made up," +
+ "And that so lamely and unfashionable" +
+ "That dogs bark at me as I halt by them;" +
+ "Why, I, in this weak piping time of peace," +
+ "Have no delight to pass away the time," +
+ "Unless to spy my shadow in the sun" +
+ "And descant on mine own deformity:" +
+ "And therefore, since I cannot prove a lover," +
+ "To entertain these fair well-spoken days," +
+ "I am determined to prove a villain" +
+ "And hate the idle pleasures of these days." +
+ "Plots have I laid, inductions dangerous," +
+ "By drunken prophecies, libels and dreams," +
+ "To set my brother Clarence and the king" +
+ "In deadly hate the one against the other:" +
+ "And if King Edward be as true and just" +
+ "As I am subtle, false and treacherous," +
+ "This day should Clarence closely be mew'd up," +
+ "About a prophecy, which says that 'G'" +
+ "Of Edward's heirs the murderer shall be." +
+ "Dive, thoughts, down to my soul: here" +
+ "Clarence comes.",
+
+ "To bait fish withal: if it will feed nothing else," +
+ "it will feed my revenge. He hath disgraced me, and" +
+ "hindered me half a million; laughed at my losses," +
+ "mocked at my gains, scorned my nation, thwarted my" +
+ "bargains, cooled my friends, heated mine" +
+ "enemies; and what's his reason? I am a Jew. Hath" +
+ "not a Jew eyes? hath not a Jew hands, organs," +
+ "dimensions, senses, affections, passions? fed with" +
+ "the same food, hurt with the same weapons, subject" +
+ "to the same diseases, healed by the same means," +
+ "warmed and cooled by the same winter and summer, as" +
+ "a Christian is? If you prick us, do we not bleed?" +
+ "if you tickle us, do we not laugh? if you poison" +
+ "us, do we not die? and if you wrong us, shall we not" +
+ "revenge? If we are like you in the rest, we will" +
+ "resemble you in that. If a Jew wrong a Christian," +
+ "what is his humility? Revenge. If a Christian" +
+ "wrong a Jew, what should his sufferance be by" +
+ "Christian example? Why, revenge. The villany you" +
+ "teach me, I will execute, and it shall go hard but I" +
+ "will better the instruction.",
+
+ "Virtue! a fig! 'tis in ourselves that we are thus" +
+ "or thus. Our bodies are our gardens, to the which" +
+ "our wills are gardeners: so that if we will plant" +
+ "nettles, or sow lettuce, set hyssop and weed up" +
+ "thyme, supply it with one gender of herbs, or" +
+ "distract it with many, either to have it sterile" +
+ "with idleness, or manured with industry, why, the" +
+ "power and corrigible authority of this lies in our" +
+ "wills. If the balance of our lives had not one" +
+ "scale of reason to poise another of sensuality, the" +
+ "blood and baseness of our natures would conduct us" +
+ "to most preposterous conclusions: but we have" +
+ "reason to cool our raging motions, our carnal" +
+ "stings, our unbitted lusts, whereof I take this that" +
+ "you call love to be a sect or scion.",
+
+ "Blow, winds, and crack your cheeks! rage! blow!" +
+ "You cataracts and hurricanoes, spout" +
+ "Till you have drench'd our steeples, drown'd the cocks!" +
+ "You sulphurous and thought-executing fires," +
+ "Vaunt-couriers to oak-cleaving thunderbolts," +
+ "Singe my white head! And thou, all-shaking thunder," +
+ "Smite flat the thick rotundity o' the world!" +
+ "Crack nature's moulds, an germens spill at once," +
+ "That make ingrateful man!"
+ };
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarWithDrawerLayout.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarWithDrawerLayout.java
new file mode 100644
index 0000000..3519a38
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarWithDrawerLayout.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 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.
+ */
+package com.example.android.supportv7.app;
+
+import com.example.android.supportv7.Shakespeare;
+
+import android.support.v7.app.ActionBarActivity;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.ActionBarDrawerToggle;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import com.example.android.supportv7.R;
+
+public class ActionBarWithDrawerLayout extends ActionBarActivity {
+ private DrawerLayout mDrawerLayout;
+ private ListView mDrawer;
+ private TextView mContent;
+
+ private ActionBarHelper mActionBar;
+
+ private ActionBarDrawerToggle mDrawerToggle;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.action_bar_drawer_layout);
+ mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
+ mDrawer = (ListView) findViewById(R.id.start_drawer);
+ mContent = (TextView) findViewById(R.id.content_text);
+
+ mDrawerLayout.setDrawerListener(new DemoDrawerListener());
+
+ // The drawer title must be set in order to announce state changes when
+ // accessibility is turned on. This is typically a simple description,
+ // e.g. "Navigation".
+ mDrawerLayout.setDrawerTitle(GravityCompat.START, getString(R.string.drawer_title));
+
+ mDrawer.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
+ Shakespeare.TITLES));
+ mDrawer.setOnItemClickListener(new DrawerItemClickListener());
+
+ mActionBar = createActionBarHelper();
+ mActionBar.init();
+
+ // ActionBarDrawerToggle provides convenient helpers for tying together the
+ // prescribed interactions between a top-level sliding drawer and the action bar.
+ mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
+ R.string.drawer_open, R.string.drawer_close);
+ }
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+
+ // Sync the toggle state after onRestoreInstanceState has occurred.
+ mDrawerToggle.syncState();
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ /*
+ * The action bar home/up action should open or close the drawer.
+ * mDrawerToggle will take care of this.
+ */
+ if (mDrawerToggle.onOptionsItemSelected(item)) {
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ mDrawerToggle.onConfigurationChanged(newConfig);
+ }
+
+ /**
+ * This list item click listener implements very simple view switching by changing
+ * the primary content text. The drawer is closed when a selection is made.
+ */
+ private class DrawerItemClickListener implements ListView.OnItemClickListener {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ mContent.setText(Shakespeare.DIALOGUE[position]);
+ mActionBar.setTitle(Shakespeare.TITLES[position]);
+ mDrawerLayout.closeDrawer(mDrawer);
+ }
+ }
+
+ /**
+ * A drawer listener can be used to respond to drawer events such as becoming
+ * fully opened or closed. You should always prefer to perform expensive operations
+ * such as drastic relayout when no animation is currently in progress, either before
+ * or after the drawer animates.
+ *
+ * When using ActionBarDrawerToggle, all DrawerLayout listener methods should be forwarded
+ * if the ActionBarDrawerToggle is not used as the DrawerLayout listener directly.
+ */
+ private class DemoDrawerListener implements DrawerLayout.DrawerListener {
+ @Override
+ public void onDrawerOpened(View drawerView) {
+ mDrawerToggle.onDrawerOpened(drawerView);
+ mActionBar.onDrawerOpened();
+ }
+
+ @Override
+ public void onDrawerClosed(View drawerView) {
+ mDrawerToggle.onDrawerClosed(drawerView);
+ mActionBar.onDrawerClosed();
+ }
+
+ @Override
+ public void onDrawerSlide(View drawerView, float slideOffset) {
+ mDrawerToggle.onDrawerSlide(drawerView, slideOffset);
+ }
+
+ @Override
+ public void onDrawerStateChanged(int newState) {
+ mDrawerToggle.onDrawerStateChanged(newState);
+ }
+ }
+
+ /**
+ * Create a compatible helper that will manipulate the action bar if available.
+ */
+ private ActionBarHelper createActionBarHelper() {
+ return new ActionBarHelper();
+ }
+
+ /**
+ * Action bar helper for use on ICS and newer devices.
+ */
+ private class ActionBarHelper {
+ private final ActionBar mActionBar;
+ private CharSequence mDrawerTitle;
+ private CharSequence mTitle;
+
+ ActionBarHelper() {
+ mActionBar = getSupportActionBar();
+ }
+
+ public void init() {
+ mActionBar.setDisplayHomeAsUpEnabled(true);
+ mActionBar.setDisplayShowHomeEnabled(false);
+ mTitle = mDrawerTitle = getTitle();
+ }
+
+ /**
+ * When the drawer is closed we restore the action bar state reflecting
+ * the specific contents in view.
+ */
+ public void onDrawerClosed() {
+ mActionBar.setTitle(mTitle);
+ }
+
+ /**
+ * When the drawer is open we set the action bar to a generic title.
+ * The action bar should only contain data relevant at the top level of
+ * the nav hierarchy represented by the drawer, as the rest of your content
+ * will be dimmed down and non-interactive.
+ */
+ public void onDrawerOpened() {
+ mActionBar.setTitle(mDrawerTitle);
+ }
+
+ public void setTitle(CharSequence title) {
+ mTitle = title;
+ }
+ }
+}
diff --git a/samples/samples_source.prop_template b/samples/samples_source.prop_template
index d3cdfd5..3d4fac5 100644
--- a/samples/samples_source.prop_template
+++ b/samples/samples_source.prop_template
@@ -1,4 +1,4 @@
Pkg.UserSrc=false
-Pkg.Revision=1
+Pkg.Revision=3
AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION}
AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME}
diff --git a/samples/wearable/AgendaData/Application/build.gradle b/samples/wearable/AgendaData/Application/build.gradle
index 19aeb47..8d1d619 100644
--- a/samples/wearable/AgendaData/Application/build.gradle
+++ b/samples/wearable/AgendaData/Application/build.gradle
@@ -20,7 +20,7 @@
}
dependencies {
- compile 'com.google.android.gms:play-services:5.0.+@aar'
+ compile 'com.google.android.gms:play-services:5.0.+'
compile "com.android.support:support-v4:20.0.+"
wearApp project(':Wearable')
}
diff --git a/samples/wearable/DataLayer/Application/build.gradle b/samples/wearable/DataLayer/Application/build.gradle
index 19aeb47..8d1d619 100644
--- a/samples/wearable/DataLayer/Application/build.gradle
+++ b/samples/wearable/DataLayer/Application/build.gradle
@@ -20,7 +20,7 @@
}
dependencies {
- compile 'com.google.android.gms:play-services:5.0.+@aar'
+ compile 'com.google.android.gms:play-services:5.0.+'
compile "com.android.support:support-v4:20.0.+"
wearApp project(':Wearable')
}
diff --git a/samples/wearable/DataLayer/Wearable/src/main/AndroidManifest.xml b/samples/wearable/DataLayer/Wearable/src/main/AndroidManifest.xml
index 8344b90..0b34917 100644
--- a/samples/wearable/DataLayer/Wearable/src/main/AndroidManifest.xml
+++ b/samples/wearable/DataLayer/Wearable/src/main/AndroidManifest.xml
@@ -38,7 +38,6 @@
<activity
android:name=".MainActivity"
- android:screenOrientation="portrait"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
diff --git a/samples/wearable/DelayedConfirmation/Application/build.gradle b/samples/wearable/DelayedConfirmation/Application/build.gradle
index 8b84c5d..f04fad5 100644
--- a/samples/wearable/DelayedConfirmation/Application/build.gradle
+++ b/samples/wearable/DelayedConfirmation/Application/build.gradle
@@ -20,6 +20,6 @@
}
dependencies {
- compile 'com.google.android.gms:play-services:5.0.+@aar'
+ compile 'com.google.android.gms:play-services:5.0.+'
wearApp project(':Wearable')
}
diff --git a/samples/wearable/FindMyPhone/Application/build.gradle b/samples/wearable/FindMyPhone/Application/build.gradle
index 19aeb47..8d1d619 100644
--- a/samples/wearable/FindMyPhone/Application/build.gradle
+++ b/samples/wearable/FindMyPhone/Application/build.gradle
@@ -20,7 +20,7 @@
}
dependencies {
- compile 'com.google.android.gms:play-services:5.0.+@aar'
+ compile 'com.google.android.gms:play-services:5.0.+'
compile "com.android.support:support-v4:20.0.+"
wearApp project(':Wearable')
}
diff --git a/samples/wearable/FindMyPhone/Application/src/main/AndroidManifest.xml b/samples/wearable/FindMyPhone/Application/src/main/AndroidManifest.xml
index 9df37e3..79999ba 100644
--- a/samples/wearable/FindMyPhone/Application/src/main/AndroidManifest.xml
+++ b/samples/wearable/FindMyPhone/Application/src/main/AndroidManifest.xml
@@ -17,6 +17,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.wearable.findphone">
+ <uses-permission android:name="android.permission.VIBRATE" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
diff --git a/samples/wearable/Geofencing/Application/build.gradle b/samples/wearable/Geofencing/Application/build.gradle
index 19aeb47..8d1d619 100644
--- a/samples/wearable/Geofencing/Application/build.gradle
+++ b/samples/wearable/Geofencing/Application/build.gradle
@@ -20,7 +20,7 @@
}
dependencies {
- compile 'com.google.android.gms:play-services:5.0.+@aar'
+ compile 'com.google.android.gms:play-services:5.0.+'
compile "com.android.support:support-v4:20.0.+"
wearApp project(':Wearable')
}
diff --git a/samples/wearable/Quiz/Application/build.gradle b/samples/wearable/Quiz/Application/build.gradle
index e7ea534..a138acb 100644
--- a/samples/wearable/Quiz/Application/build.gradle
+++ b/samples/wearable/Quiz/Application/build.gradle
@@ -20,7 +20,7 @@
}
dependencies {
- compile 'com.google.android.gms:play-services:5.0.+@aar'
+ compile 'com.google.android.gms:play-services:5.0.+'
compile "com.android.support:support-v13:20.0.+"
wearApp project(':Wearable')
}
diff --git a/samples/wearable/SynchronizedNotifications/Application/build.gradle b/samples/wearable/SynchronizedNotifications/Application/build.gradle
index f78fa06..3352038 100644
--- a/samples/wearable/SynchronizedNotifications/Application/build.gradle
+++ b/samples/wearable/SynchronizedNotifications/Application/build.gradle
@@ -21,7 +21,7 @@
}
dependencies {
- compile 'com.google.android.gms:play-services:5.0.+@aar'
+ compile 'com.google.android.gms:play-services:5.0.+'
compile 'com.android.support:support-v13:20.0.+'
compile project(':Common')
wearApp project(':Wearable')
diff --git a/samples/wearable/SynchronizedNotifications/Wearable/build.gradle b/samples/wearable/SynchronizedNotifications/Wearable/build.gradle
index c82a8de..2b47312 100644
--- a/samples/wearable/SynchronizedNotifications/Wearable/build.gradle
+++ b/samples/wearable/SynchronizedNotifications/Wearable/build.gradle
@@ -21,7 +21,7 @@
}
dependencies {
- compile 'com.google.android.gms:play-services:5.0.+@aar'
+ compile 'com.google.android.gms:play-services-wearable:+'
compile 'com.android.support:support-v13:20.0.+'
compile 'com.google.android.support:wearable:1.0.+'
compile project(':Common')
diff --git a/scripts/gdb/dalvik.gdb b/scripts/gdb/dalvik.gdb
index cab0951..6ee8d1d 100644
--- a/scripts/gdb/dalvik.gdb
+++ b/scripts/gdb/dalvik.gdb
@@ -49,3 +49,62 @@
frame. If omitted r5 will be used as the default (as the case in the
interpreter and JIT'ed code).
end
+
+# ART debugging. ART uses SIGSEGV signals for internal purposes. To allow
+# gdb to debug programs using ART we need to treat this signal specially. We
+# also set a breakpoint in a libart.so function to stop when the program
+# hits an unexpected breakpoint
+set $art_debug_enabled = 0
+define art-on
+ if $art_debug_enabled == 0
+ # deal with SIGSEGV signals
+ handle SIGSEGV noprint nostop pass
+
+ # set a breakpoint and record its number
+ set breakpoint pending on
+ break art_sigsegv_fault
+ set $art_bpnum = $bpnum
+ commands $art_bpnum
+ silent
+ printf "Caught SIGSEGV in user program\n"
+ end
+ set breakpoint pending auto
+
+ printf "ART debugging mode is enabled.\n"
+ set $art_debug_enabled = 1
+ else
+ printf "ART debugging mode is already enabled.\n"
+ end
+end
+
+document art-on
+ Enter ART debugging mode. In ART debugging mode, SIGSEGV signals are ignored
+ by gdb unless they are not handled by ART itself. A breakpoint is
+ set to stop the program when an unexpected SIGSEGV signal is
+ encountered.
+
+ To switch ART debugging mode off, use "art-off"
+end
+
+define art-off
+ if $art_debug_enabled == 1
+ # restore SIGSEGV to its default
+ handle SIGSEGV print stop pass
+
+ # delete our breakpoint
+ delete $art_bpnum
+
+ set $art_debug_enabled = 0
+ printf "ART debugging mode is disabled.\n"
+ end
+end
+
+document art-off
+ Leave ART debugging mode. Signal handling is restored to default settings.
+
+ Use the command "art-on" to enable ART debugging mode.
+end
+
+# switch on ART debugging
+art-on
+