Merge "Clear binder identity before reaching into keyguard settings"
diff --git a/api/current.txt b/api/current.txt
index d29bd78..bd9937e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -14924,6 +14924,7 @@
public class AudioRecord {
ctor public AudioRecord(int, int, int, int, int) throws java.lang.IllegalArgumentException;
+ method public void addOnAudioRecordRoutingListener(android.media.OnAudioRecordRoutingListener, android.os.Handler);
method public int getAudioFormat();
method public int getAudioSessionId();
method public int getAudioSource();
@@ -14933,7 +14934,9 @@
method public int getNativeFrameCount() throws java.lang.IllegalStateException;
method public int getNotificationMarkerPosition();
method public int getPositionNotificationPeriod();
+ method public android.media.AudioDeviceInfo getPreferredInputDevice();
method public int getRecordingState();
+ method public android.media.AudioDeviceInfo getRoutedDevice();
method public int getSampleRate();
method public int getState();
method public int read(byte[], int, int);
@@ -14944,8 +14947,10 @@
method public int read(java.nio.ByteBuffer, int);
method public int read(java.nio.ByteBuffer, int, int);
method public void release();
+ method public void removeOnAudioRecordRoutingListener(android.media.OnAudioRecordRoutingListener);
method public int setNotificationMarkerPosition(int);
method public int setPositionNotificationPeriod(int);
+ method public boolean setPreferredInputDevice(android.media.AudioDeviceInfo);
method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener);
method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener, android.os.Handler);
method public void startRecording() throws java.lang.IllegalStateException;
@@ -14986,6 +14991,7 @@
ctor public AudioTrack(int, int, int, int, int, int) throws java.lang.IllegalArgumentException;
ctor public AudioTrack(int, int, int, int, int, int, int) throws java.lang.IllegalArgumentException;
ctor public AudioTrack(android.media.AudioAttributes, android.media.AudioFormat, int, int, int) throws java.lang.IllegalArgumentException;
+ method public void addOnAudioTrackRoutingListener(android.media.OnAudioTrackRoutingListener, android.os.Handler);
method public int attachAuxEffect(int);
method public void flush();
method public int getAudioFormat();
@@ -15004,6 +15010,7 @@
method public android.media.PlaybackSettings getPlaybackSettings();
method public int getPositionNotificationPeriod();
method public android.media.AudioDeviceInfo getPreferredOutputDevice();
+ method public android.media.AudioDeviceInfo getRoutedDevice();
method public int getSampleRate();
method public int getState();
method public int getStreamType();
@@ -15012,6 +15019,7 @@
method public void play() throws java.lang.IllegalStateException;
method public void release();
method public int reloadStaticData();
+ method public void removeOnAudioTrackRoutingListener(android.media.OnAudioTrackRoutingListener);
method public int setAuxEffectSendLevel(float);
method public int setLoopPoints(int, int, int);
method public int setNotificationMarkerPosition(int);
@@ -16425,6 +16433,14 @@
field public static final int AUDIO_STRETCH_MODE_VOICE = 1; // 0x1
}
+ public abstract interface OnAudioRecordRoutingListener {
+ method public abstract void onAudioRecordRouting(android.media.AudioRecord);
+ }
+
+ public abstract interface OnAudioTrackRoutingListener {
+ method public abstract void onAudioTrackRouting(android.media.AudioTrack);
+ }
+
public final class Rating implements android.os.Parcelable {
method public int describeContents();
method public float getPercentRating();
@@ -30657,6 +30673,7 @@
method public android.os.Bundle getConfigForSubId(int);
method public void reloadCarrierConfigForSubId(int);
field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
+ field public static final java.lang.String BOOL_APN_EXPAND = "bool_apn_expand";
field public static final java.lang.String BOOL_CARRIER_VOLTE_AVAILABLE = "bool_carrier_volte_available";
field public static final java.lang.String BOOL_CARRIER_VOLTE_PROVISIONED = "bool_carrier_volte_provisioned";
field public static final java.lang.String BOOL_CARRIER_VOLTE_TTY_SUPPORTED = "bool_carrier_volte_tty_supported";
diff --git a/api/system-current.txt b/api/system-current.txt
index d6242ae..fd9b67b 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -16135,6 +16135,7 @@
public class AudioRecord {
ctor public AudioRecord(int, int, int, int, int) throws java.lang.IllegalArgumentException;
ctor public AudioRecord(android.media.AudioAttributes, android.media.AudioFormat, int, int) throws java.lang.IllegalArgumentException;
+ method public void addOnAudioRecordRoutingListener(android.media.OnAudioRecordRoutingListener, android.os.Handler);
method public int getAudioFormat();
method public int getAudioSessionId();
method public int getAudioSource();
@@ -16144,7 +16145,9 @@
method public int getNativeFrameCount() throws java.lang.IllegalStateException;
method public int getNotificationMarkerPosition();
method public int getPositionNotificationPeriod();
+ method public android.media.AudioDeviceInfo getPreferredInputDevice();
method public int getRecordingState();
+ method public android.media.AudioDeviceInfo getRoutedDevice();
method public int getSampleRate();
method public int getState();
method public int read(byte[], int, int);
@@ -16155,8 +16158,10 @@
method public int read(java.nio.ByteBuffer, int);
method public int read(java.nio.ByteBuffer, int, int);
method public void release();
+ method public void removeOnAudioRecordRoutingListener(android.media.OnAudioRecordRoutingListener);
method public int setNotificationMarkerPosition(int);
method public int setPositionNotificationPeriod(int);
+ method public boolean setPreferredInputDevice(android.media.AudioDeviceInfo);
method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener);
method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener, android.os.Handler);
method public void startRecording() throws java.lang.IllegalStateException;
@@ -16199,6 +16204,7 @@
ctor public AudioTrack(int, int, int, int, int, int) throws java.lang.IllegalArgumentException;
ctor public AudioTrack(int, int, int, int, int, int, int) throws java.lang.IllegalArgumentException;
ctor public AudioTrack(android.media.AudioAttributes, android.media.AudioFormat, int, int, int) throws java.lang.IllegalArgumentException;
+ method public void addOnAudioTrackRoutingListener(android.media.OnAudioTrackRoutingListener, android.os.Handler);
method public int attachAuxEffect(int);
method public void flush();
method public int getAudioFormat();
@@ -16217,6 +16223,7 @@
method public android.media.PlaybackSettings getPlaybackSettings();
method public int getPositionNotificationPeriod();
method public android.media.AudioDeviceInfo getPreferredOutputDevice();
+ method public android.media.AudioDeviceInfo getRoutedDevice();
method public int getSampleRate();
method public int getState();
method public int getStreamType();
@@ -16225,6 +16232,7 @@
method public void play() throws java.lang.IllegalStateException;
method public void release();
method public int reloadStaticData();
+ method public void removeOnAudioTrackRoutingListener(android.media.OnAudioTrackRoutingListener);
method public int setAuxEffectSendLevel(float);
method public int setLoopPoints(int, int, int);
method public int setNotificationMarkerPosition(int);
@@ -17641,6 +17649,14 @@
field public static final int AUDIO_STRETCH_MODE_VOICE = 1; // 0x1
}
+ public abstract interface OnAudioRecordRoutingListener {
+ method public abstract void onAudioRecordRouting(android.media.AudioRecord);
+ }
+
+ public abstract interface OnAudioTrackRoutingListener {
+ method public abstract void onAudioTrackRouting(android.media.AudioTrack);
+ }
+
public final class Rating implements android.os.Parcelable {
method public int describeContents();
method public float getPercentRating();
@@ -32811,6 +32827,7 @@
method public void reloadCarrierConfigForSubId(int);
method public void updateConfigForPhoneId(int, java.lang.String);
field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
+ field public static final java.lang.String BOOL_APN_EXPAND = "bool_apn_expand";
field public static final java.lang.String BOOL_CARRIER_VOLTE_AVAILABLE = "bool_carrier_volte_available";
field public static final java.lang.String BOOL_CARRIER_VOLTE_PROVISIONED = "bool_carrier_volte_provisioned";
field public static final java.lang.String BOOL_CARRIER_VOLTE_TTY_SUPPORTED = "bool_carrier_volte_tty_supported";
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 2418e82..79e560f 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -792,7 +792,6 @@
// mService is null, handle that case
}
} catch (RemoteException e) {Log.e(TAG, "", e);}
- if (DBG) Log.d(TAG, "" + hashCode() + ": getState() : mService = null. Returning STATE_OFF");
return STATE_OFF;
}
diff --git a/core/java/android/service/chooser/ChooserTarget.java b/core/java/android/service/chooser/ChooserTarget.java
index d21cc3c..f0ca276 100644
--- a/core/java/android/service/chooser/ChooserTarget.java
+++ b/core/java/android/service/chooser/ChooserTarget.java
@@ -78,7 +78,8 @@
* <p>The creator of a target may supply a ranking score. This score is assumed to be relative
* to the other targets supplied by the same
* {@link ChooserTargetService#onGetChooserTargets(ComponentName, IntentFilter) query}.
- * Scores should be in the range from 0.0f (unlikely match) to 1.0f (very relevant match).</p>
+ * Scores should be in the range from 0.0f (unlikely match) to 1.0f (very relevant match).
+ * Scores for a set of targets do not need to sum to 1.</p>
*
* <p>Before being sent, the PendingIntent supplied will be
* {@link Intent#fillIn(Intent, int) filled in} by the Intent originally supplied
@@ -113,7 +114,8 @@
* <p>The creator of a target may supply a ranking score. This score is assumed to be relative
* to the other targets supplied by the same
* {@link ChooserTargetService#onGetChooserTargets(ComponentName, IntentFilter) query}.
- * Scores should be in the range from 0.0f (unlikely match) to 1.0f (very relevant match).</p>
+ * Scores should be in the range from 0.0f (unlikely match) to 1.0f (very relevant match).
+ * Scores for a set of targets do not need to sum to 1.</p>
*
* <p>Before being sent, the IntentSender supplied will be
* {@link Intent#fillIn(Intent, int) filled in} by the Intent originally supplied
@@ -144,6 +146,32 @@
mIntentSender = intentSender;
}
+ /**
+ * Construct a deep link target for presentation by a chooser UI.
+ *
+ * <p>A target is composed of a title and an icon for presentation to the user.
+ * The UI presenting this target may truncate the title if it is too long to be presented
+ * in the available space, as well as crop, resize or overlay the supplied icon.</p>
+ *
+ * <p>The creator of a target may supply a ranking score. This score is assumed to be relative
+ * to the other targets supplied by the same
+ * {@link ChooserTargetService#onGetChooserTargets(ComponentName, IntentFilter) query}.
+ * Scores should be in the range from 0.0f (unlikely match) to 1.0f (very relevant match).
+ * Scores for a set of targets do not need to sum to 1.</p>
+ *
+ * <p>Before being sent, the Intent supplied will be
+ * {@link Intent#fillIn(Intent, int) filled in} by the Intent originally supplied
+ * to the chooser.</p>
+ *
+ * <p>Take care not to place custom {@link android.os.Parcelable} types into
+ * the Intent as extras, as the system will not be able to unparcel it to merge
+ * additional extras.</p>
+ *
+ * @param title title of this target that will be shown to a user
+ * @param icon icon to represent this target
+ * @param score ranking score for this target between 0.0f and 1.0f, inclusive
+ * @param intent Intent to fill in and send if the user chooses this target
+ */
public ChooserTarget(CharSequence title, Bitmap icon, float score, Intent intent) {
mTitle = title;
mIcon = icon;
@@ -358,6 +386,10 @@
}
dest.writeFloat(mScore);
IntentSender.writeIntentSenderOrNullToParcel(mIntentSender, dest);
+ dest.writeInt(mIntent != null ? 1 : 0);
+ if (mIntent != null) {
+ mIntent.writeToParcel(dest, 0);
+ }
}
public static final Creator<ChooserTarget> CREATOR
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 8403e77..a6c39e6 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -401,6 +401,11 @@
}
@Override
+ public boolean shouldGetResolvedFilter() {
+ return true;
+ }
+
+ @Override
public int getCount() {
int count = super.getCount();
if (mServiceTargets != null) {
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 3cd69a1..7f51d92 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -1062,7 +1062,7 @@
} else {
currentResolveList = mOrigResolveList = mPm.queryIntentActivities(mIntent,
PackageManager.MATCH_DEFAULT_ONLY
- | (mFilterLastUsed ? PackageManager.GET_RESOLVED_FILTER : 0)
+ | (shouldGetResolvedFilter() ? PackageManager.GET_RESOLVED_FILTER : 0)
| (shouldGetActivityMetadata() ? PackageManager.GET_META_DATA : 0)
);
// Filter out any activities that the launched uid does not
@@ -1188,6 +1188,10 @@
// This space for rent
}
+ public boolean shouldGetResolvedFilter() {
+ return mFilterLastUsed;
+ }
+
private void processGroup(List<ResolveInfo> rList, int start, int end, ResolveInfo ro,
CharSequence roLabel) {
// Process labels from start to i
diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp
index 23b0d50..d86f71a 100644
--- a/core/jni/android_media_AudioRecord.cpp
+++ b/core/jni/android_media_AudioRecord.cpp
@@ -584,6 +584,13 @@
return frameCount * channelCount * audio_bytes_per_sample(format);
}
+static jboolean android_media_AudioRecord_setInputDevice(
+ JNIEnv *env, jobject thiz, jint device_id) {
+
+// sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz);
+// return lpRecorder->setInputDevice(device_id) == NO_ERROR;
+ return false;
+}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
@@ -616,6 +623,7 @@
"()I", (void *)android_media_AudioRecord_get_pos_update_period},
{"native_get_min_buff_size",
"(III)I", (void *)android_media_AudioRecord_get_min_buff_size},
+ {"native_setInputDevice", "(I)Z", (void *)android_media_AudioRecord_setInputDevice},
};
// field names found in android/media/AudioRecord.java
diff --git a/docs/html/google/play-services/index.jd b/docs/html/google/play-services/index.jd
index e31290a..d674f7f 100644
--- a/docs/html/google/play-services/index.jd
+++ b/docs/html/google/play-services/index.jd
@@ -88,7 +88,7 @@
<li><a href="https://developers.google.com/maps/documentation/android/wear"
class="external-link">Google Maps on Android Wear developer guide</a>
</li>
- <li><a href="https://github.com/googlemaps/android-samples"
+ <li><a href="https://github.com/googlemaps/android-samples/tree/master/BasicWearMap"
class="external-link">Google Maps on Android Wear sample</a>
</li>
<li><a href="https://developers.google.com/maps/documentation/android/releases"
diff --git a/docs/html/guide/topics/resources/string-resource.jd b/docs/html/guide/topics/resources/string-resource.jd
index cbfa82e..743e692 100644
--- a/docs/html/guide/topics/resources/string-resource.jd
+++ b/docs/html/guide/topics/resources/string-resource.jd
@@ -401,19 +401,35 @@
format and style your string resources.</p>
-<h3>Escaping apostrophes and quotes</h3>
+<h3 id="escaping_quotes">Escaping apostrophes and quotes</h3>
-<p>If you have an apostrophe or a quote in your string, you must either escape it or enclose the
-whole string in the other type of enclosing quotes. For example, here are some stings that
-do and don't work:</p>
+<p>
+ If you have an apostrophe (<code>'</code>) in your string, you must either
+ escape it with a backslash (<code>\'</code>) or enclose the string in
+ double-quotes (<code>""</code>). For example, here are some strings that do
+ and don't work:
+</p>
<pre>
-<string name="good_example">"This'll work"</string>
-<string name="good_example_2">This\'ll also work</string>
+<string name="good_example">This\'ll work</string>
+<string name="good_example_2">"This'll also work"</string>
<string name="bad_example">This doesn't work</string>
-<string name="bad_example_2">XML encodings don&apos;t work</string>
+ <!-- Causes a compile error -->
</pre>
+<p>
+ If you have a double-quote in your string, you must escape it
+ (<code>\"</code>). Surrounding the string with single-quotes does
+ <em>not</em> work.
+</p>
+
+<pre>
+<string name="good_example">This is a \"good string\".</string>
+<string name="bad_example">This is a "bad string".</string>
+ <!-- Quotes are stripped; displays as: This is a bad string. -->
+<string name="bad_example_2">'This is another "bad string".'</string>
+ <!-- Causes a compile error -->
+</pre>
<h3>Formatting strings</h3>
diff --git a/docs/html/reference/com/google/android/gms/fitness/data/Field.html b/docs/html/reference/com/google/android/gms/fitness/data/Field.html
index 91bf861..0f97e7e 100644
--- a/docs/html/reference/com/google/android/gms/fitness/data/Field.html
+++ b/docs/html/reference/com/google/android/gms/fitness/data/Field.html
@@ -151,7 +151,7 @@
<a name="top"></a>
-<!-- dialog to prompt lang pref change when loaded from hardcoded URL
+<!-- dialog to prompt lang pref change when loaded from hardcoded URL
<div id="langMessage" style="display:none">
<div>
<div class="lang en">
@@ -201,7 +201,7 @@
<div id="header-wrapper">
<div id="header">
-
+
<div class="wrap" id="header-wrap">
@@ -245,8 +245,8 @@
</ul>
-
-
+
+
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
@@ -267,8 +267,8 @@
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
-
-
+
+
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
@@ -286,8 +286,8 @@
loadLangPref();
//-->
</script>
-
-
+
+
<br class="clearfix" />
</div><!-- end 'mid' -->
<div class="bottom"></div>
@@ -401,10 +401,10 @@
</li>
<li><a href="/google/index.html">Google Services</a>
</li>
-
+
<li><a href="/samples/index.html">Samples</a>
</li>
-
+
</ul>
</li>
<li class="distribute last">
@@ -424,14 +424,14 @@
</div><!-- end header-wrap.wrap -->
</div><!-- end header -->
-
+
<!-- Secondary x-nav -->
<div id="nav-x">
<div class="wrap" style="position:relative;z-index:1">
-
-
-
+
+
+
<ul class="nav-x col-9 develop" style="width:100%">
<li class="training"><a href="/training/index.html"
@@ -469,17 +469,17 @@
<li class="google"><a href="/google/index.html"
>Google Services</a>
</li>
-
+
<li class="samples"><a href="/samples/index.html"
>Samples</a>
</li>
-
+
</ul>
</div>
</div>
<!-- /Sendondary x-nav DEVELOP -->
-
+
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
@@ -492,7 +492,7 @@
<a class="logo" href="#top"></a>
<a class="top" href="#top"></a>
<ul class="breadcrumb">
-
+
<li class="current">Field</li>
</ul>
</div>
@@ -502,7 +502,7 @@
-
+
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
@@ -759,12 +759,12 @@
</script>
-
+
</div>
<script type="text/javascript">
showGoogleRefTree();
-
+
</script>
</div> <!-- end side-nav -->
<script>
@@ -774,7 +774,7 @@
</script>
-
+
@@ -784,21 +784,21 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<div class="sum-details-links">
@@ -810,22 +810,22 @@
<a href="#constants">Constants</a>
-
+
| <a href="#inhconstants">Inherited Constants</a>
-
+
| <a href="#lfields">Fields</a>
-
+
| <a href="#pubmethods">Methods</a>
-
+
@@ -835,9 +835,9 @@
</div><!-- end sum-details-links -->
<div class="api-level">
-
-
-
+
+
+
</div>
</div><!-- end api-info-block -->
@@ -847,31 +847,31 @@
<div id="jd-header">
public
-
- final
-
+
+ final
+
class
<h1 itemprop="name">Field</h1>
-
+
extends Object<br/>
-
-
-
-
-
-
- implements
-
- Parcelable
-
-
-
-
+
+
+
+
+ implements
+
+ Parcelable
+
+
+
+
+
+
</div><!-- end header -->
@@ -883,18 +883,18 @@
<tr>
-
+
<td colspan="2" class="jd-inheritance-class-cell">java.lang.Object</td>
</tr>
-
+
<tr>
-
+
<td class="jd-inheritance-space"> ↳</td>
-
+
<td colspan="1" class="jd-inheritance-class-cell">com.google.android.gms.fitness.data.Field</td>
</tr>
-
+
</table>
@@ -962,31 +962,31 @@
<table id="constants" class="jd-sumtable"><tr><th colspan="12">Constants</th></tr>
-
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol">int</td>
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FORMAT_FLOAT">FORMAT_FLOAT</a></td>
<td class="jd-descrcol" width="100%">
Format constant indicating the field holds float values.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol">int</td>
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FORMAT_INT32">FORMAT_INT32</a></td>
<td class="jd-descrcol" width="100%">
Format constant indicating the field holds integer values.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol">int</td>
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FORMAT_MAP">FORMAT_MAP</a></td>
@@ -1305,33 +1305,33 @@
</div>
<div id="inherited-constants-android.os.Parcelable-summary" style="display: none;">
<table class="jd-sumtable-expando">
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol">int</td>
<td class="jd-linkcol">CONTENTS_FILE_DESCRIPTOR</td>
<td class="jd-descrcol" width="100%">
-
-
-
+
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol">int</td>
<td class="jd-linkcol">PARCELABLE_WRITE_RETURN_VALUE</td>
<td class="jd-descrcol" width="100%">
-
-
-
+
+
+
</td>
</tr>
-
-
+
+
</table>
</div>
</div>
@@ -1347,7 +1347,7 @@
<table id="lfields" class="jd-sumtable"><tr><th colspan="12">Fields</th></tr>
-
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1357,13 +1357,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_ACCURACY">FIELD_ACCURACY</a></td>
<td class="jd-descrcol" width="100%">
The accuracy of an accompanied value (such as location).
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1373,13 +1373,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_ACTIVITY">FIELD_ACTIVITY</a></td>
<td class="jd-descrcol" width="100%">
An activity type of <code><a href="/reference/com/google/android/gms/fitness/FitnessActivities.html">FitnessActivities</a></code>, encoded as an integer for efficiency.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1389,13 +1389,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_ALTITUDE">FIELD_ALTITUDE</a></td>
<td class="jd-descrcol" width="100%">
An altitude of a location represented as a float, in meters above sea level.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1405,13 +1405,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_AVERAGE">FIELD_AVERAGE</a></td>
<td class="jd-descrcol" width="100%">
An average value.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1421,13 +1421,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_BPM">FIELD_BPM</a></td>
<td class="jd-descrcol" width="100%">
A heart rate in beats per minute.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1437,13 +1437,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_CALORIES">FIELD_CALORIES</a></td>
<td class="jd-descrcol" width="100%">
Calories in kcal.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1469,13 +1469,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_CONFIDENCE">FIELD_CONFIDENCE</a></td>
<td class="jd-descrcol" width="100%">
The confidence of an accompanied value, specified as a value between 0.0 and 100.0.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1485,13 +1485,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_DISTANCE">FIELD_DISTANCE</a></td>
<td class="jd-descrcol" width="100%">
A distance in meters.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1501,13 +1501,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_DURATION">FIELD_DURATION</a></td>
<td class="jd-descrcol" width="100%">
A duration in milliseconds.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1533,13 +1533,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_HEIGHT">FIELD_HEIGHT</a></td>
<td class="jd-descrcol" width="100%">
A height in meters.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1549,13 +1549,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_HIGH_LATITUDE">FIELD_HIGH_LATITUDE</a></td>
<td class="jd-descrcol" width="100%">
A high latitude of a location bounding box represented as a float, in degrees.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1565,13 +1565,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_HIGH_LONGITUDE">FIELD_HIGH_LONGITUDE</a></td>
<td class="jd-descrcol" width="100%">
A high longitude of a location bounding box represented as a float, in degrees.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1581,13 +1581,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_LATITUDE">FIELD_LATITUDE</a></td>
<td class="jd-descrcol" width="100%">
A latitude of a location represented as a float, in degrees.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1597,13 +1597,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_LONGITUDE">FIELD_LONGITUDE</a></td>
<td class="jd-descrcol" width="100%">
A longitude of a location represented as a float, in degrees.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1613,13 +1613,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_LOW_LATITUDE">FIELD_LOW_LATITUDE</a></td>
<td class="jd-descrcol" width="100%">
A low latitude of a location bounding box represented as a float, in degrees.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1629,13 +1629,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_LOW_LONGITUDE">FIELD_LOW_LONGITUDE</a></td>
<td class="jd-descrcol" width="100%">
A low longitude of a location bounding box represented as a float, in degrees.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1645,13 +1645,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_MAX">FIELD_MAX</a></td>
<td class="jd-descrcol" width="100%">
A maximum value.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1677,13 +1677,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_MIN">FIELD_MIN</a></td>
<td class="jd-descrcol" width="100%">
A minimum value.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1725,13 +1725,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_PERCENTAGE">FIELD_PERCENTAGE</a></td>
<td class="jd-descrcol" width="100%">
A percentage value, between 0 and 100.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1741,13 +1741,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_REVOLUTIONS">FIELD_REVOLUTIONS</a></td>
<td class="jd-descrcol" width="100%">
A count of revolutions.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1757,13 +1757,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_RPM">FIELD_RPM</a></td>
<td class="jd-descrcol" width="100%">
Revolutions per minute or rate per minute.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1773,13 +1773,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_SPEED">FIELD_SPEED</a></td>
<td class="jd-descrcol" width="100%">
A speed in meter/sec.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1789,13 +1789,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_STEPS">FIELD_STEPS</a></td>
<td class="jd-descrcol" width="100%">
A count of steps.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1805,13 +1805,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_WATTS">FIELD_WATTS</a></td>
<td class="jd-descrcol" width="100%">
Power in watts.
-
-
+
+
</td>
</tr>
-
-
+
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
public
@@ -1821,13 +1821,13 @@
<td class="jd-linkcol"><a href="/reference/com/google/android/gms/fitness/data/Field.html#FIELD_WEIGHT">FIELD_WEIGHT</a></td>
<td class="jd-descrcol" width="100%">
A weight in kilograms.
-
-
+
+
</td>
</tr>
-
-
+
+
</table>
@@ -1846,129 +1846,129 @@
-
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
-
-
-
+
+
+
+
+
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="/reference/com/google/android/gms/fitness/data/Field.html#describeContents()">describeContents</a></span>()</nobr>
-
+
</td></tr>
-
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
-
-
-
+
+
+
+
+
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="/reference/com/google/android/gms/fitness/data/Field.html#equals(java.lang.Object)">equals</a></span>(Object that)</nobr>
-
+
</td></tr>
-
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
-
-
-
+
+
+
+
+
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="/reference/com/google/android/gms/fitness/data/Field.html#getFormat()">getFormat</a></span>()</nobr>
-
+
<div class="jd-descrdiv">
Returns the format of the field, as one of the format constant values.
-
-
+
+
</div>
-
+
</td></tr>
-
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
-
-
-
+
+
+
+
+
String</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="/reference/com/google/android/gms/fitness/data/Field.html#getName()">getName</a></span>()</nobr>
-
+
<div class="jd-descrdiv">
Returns the name of the field.
-
-
+
+
</div>
-
+
</td></tr>
-
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
-
-
-
+
+
+
+
+
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="/reference/com/google/android/gms/fitness/data/Field.html#hashCode()">hashCode</a></span>()</nobr>
-
+
</td></tr>
-
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
-
-
-
+
+
+
+
+
String</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="/reference/com/google/android/gms/fitness/data/Field.html#toString()">toString</a></span>()</nobr>
-
+
</td></tr>
-
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
-
-
-
+
+
+
+
+
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="/reference/com/google/android/gms/fitness/data/Field.html#writeToParcel(android.os.Parcel, int)">writeToParcel</a></span>(Parcel dest, int flags)</nobr>
-
+
</td></tr>
@@ -2003,182 +2003,182 @@
</div>
<div id="inherited-methods-java.lang.Object-summary" style="display: none;">
<table class="jd-sumtable-expando">
-
-
+
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
-
-
-
+
+
+
+
+
Object</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">clone</span>()</nobr>
-
+
</td></tr>
-
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
-
-
-
+
+
+
+
+
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">equals</span>(Object arg0)</nobr>
-
+
</td></tr>
-
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
-
-
-
+
+
+
+
+
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">finalize</span>()</nobr>
-
+
</td></tr>
-
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
+
+
final
-
-
+
+
Class<?></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">getClass</span>()</nobr>
-
+
</td></tr>
-
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
-
-
-
+
+
+
+
+
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">hashCode</span>()</nobr>
-
+
</td></tr>
-
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
+
+
final
-
-
+
+
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">notify</span>()</nobr>
-
+
</td></tr>
-
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
+
+
final
-
-
+
+
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">notifyAll</span>()</nobr>
-
+
</td></tr>
-
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
-
-
-
+
+
+
+
+
String</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">toString</span>()</nobr>
-
+
</td></tr>
-
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
+
+
final
-
-
+
+
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>()</nobr>
-
+
</td></tr>
-
+
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
+
+
final
-
-
+
+
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>(long arg0, int arg1)</nobr>
-
+
</td></tr>
-
+
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
-
-
+
+
final
-
-
+
+
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>(long arg0)</nobr>
-
+
</td></tr>
@@ -2205,7 +2205,7 @@
</div>
<div id="inherited-methods-android.os.Parcelable-summary" style="display: none;">
<table class="jd-sumtable-expando">
-
+
@@ -2232,6 +2232,7 @@
+
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
@@ -3196,40 +3197,40 @@
<A NAME="NUTRIENT_TOTAL_FAT"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
String
</span>
NUTRIENT_TOTAL_FAT
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>Total fat in grams.
</p></div>
-
+
<div class="jd-tagdata">
<span class="jd-tagtitle">Constant Value: </span>
<span>
-
+
"fat.total"
-
+
</span>
</div>
-
+
</div>
</div>
@@ -3237,40 +3238,40 @@
<A NAME="NUTRIENT_TRANS_FAT"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
String
</span>
NUTRIENT_TRANS_FAT
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>Trans fat in grams.
</p></div>
-
+
<div class="jd-tagdata">
<span class="jd-tagtitle">Constant Value: </span>
<span>
-
+
"fat.trans"
-
+
</span>
</div>
-
+
</div>
</div>
@@ -3321,31 +3322,31 @@
<A NAME="NUTRIENT_VITAMIN_C"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
String
</span>
NUTRIENT_VITAMIN_C
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>Vitamin C amount in milligrams.
</p></div>
-
+
<div class="jd-tagdata">
<span class="jd-tagtitle">Constant Value: </span>
<span>
@@ -3372,31 +3373,31 @@
<A NAME="FIELD_ACCURACY"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_ACCURACY
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>The accuracy of an accompanied value (such as location).
</p></div>
-
+
</div>
</div>
@@ -3404,33 +3405,33 @@
<A NAME="FIELD_ACTIVITY"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_ACTIVITY
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>An activity type of <code><a href="/reference/com/google/android/gms/fitness/FitnessActivities.html">FitnessActivities</a></code>, encoded as an integer for efficiency. The
activity value should be stored using <code><a href="/reference/com/google/android/gms/fitness/data/Value.html#setActivity(java.lang.String)">setActivity(String)</a></code>,
and read using <code><a href="/reference/com/google/android/gms/fitness/data/Value.html#asActivity()">asActivity()</a></code>
</p></div>
-
+
</div>
</div>
@@ -3438,32 +3439,32 @@
<A NAME="FIELD_ALTITUDE"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_ALTITUDE
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>An altitude of a location represented as a float, in meters above sea level.
Some location samples don't have an altitude value so this field might not be set.
</p></div>
-
+
</div>
</div>
@@ -3471,31 +3472,31 @@
<A NAME="FIELD_AVERAGE"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_AVERAGE
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>An average value.
</p></div>
-
+
</div>
</div>
@@ -3503,31 +3504,31 @@
<A NAME="FIELD_BPM"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_BPM
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A heart rate in beats per minute.
</p></div>
-
+
</div>
</div>
@@ -3535,31 +3536,31 @@
<A NAME="FIELD_CALORIES"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_CALORIES
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>Calories in kcal.
</p></div>
-
+
</div>
</div>
@@ -3599,31 +3600,31 @@
<A NAME="FIELD_CONFIDENCE"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_CONFIDENCE
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>The confidence of an accompanied value, specified as a value between 0.0 and 100.0.
</p></div>
-
+
</div>
</div>
@@ -3631,31 +3632,31 @@
<A NAME="FIELD_DISTANCE"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_DISTANCE
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A distance in meters.
</p></div>
-
+
</div>
</div>
@@ -3663,31 +3664,31 @@
<A NAME="FIELD_DURATION"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_DURATION
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A duration in milliseconds.
</p></div>
-
+
</div>
</div>
@@ -3727,31 +3728,31 @@
<A NAME="FIELD_HEIGHT"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_HEIGHT
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A height in meters.
</p></div>
-
+
</div>
</div>
@@ -3759,31 +3760,31 @@
<A NAME="FIELD_HIGH_LATITUDE"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_HIGH_LATITUDE
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A high latitude of a location bounding box represented as a float, in degrees.
</p></div>
-
+
</div>
</div>
@@ -3791,31 +3792,31 @@
<A NAME="FIELD_HIGH_LONGITUDE"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_HIGH_LONGITUDE
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A high longitude of a location bounding box represented as a float, in degrees.
</p></div>
-
+
</div>
</div>
@@ -3823,31 +3824,31 @@
<A NAME="FIELD_LATITUDE"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_LATITUDE
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A latitude of a location represented as a float, in degrees.
</p></div>
-
+
</div>
</div>
@@ -3855,31 +3856,31 @@
<A NAME="FIELD_LONGITUDE"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_LONGITUDE
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A longitude of a location represented as a float, in degrees.
</p></div>
-
+
</div>
</div>
@@ -3887,31 +3888,31 @@
<A NAME="FIELD_LOW_LATITUDE"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_LOW_LATITUDE
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A low latitude of a location bounding box represented as a float, in degrees.
</p></div>
-
+
</div>
</div>
@@ -3919,31 +3920,31 @@
<A NAME="FIELD_LOW_LONGITUDE"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_LOW_LONGITUDE
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A low longitude of a location bounding box represented as a float, in degrees.
</p></div>
-
+
</div>
</div>
@@ -3951,31 +3952,31 @@
<A NAME="FIELD_MAX"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_MAX
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A maximum value.
</p></div>
-
+
</div>
</div>
@@ -4015,31 +4016,31 @@
<A NAME="FIELD_MIN"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_MIN
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A minimum value.
</p></div>
-
+
</div>
</div>
@@ -4113,31 +4114,31 @@
<A NAME="FIELD_PERCENTAGE"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_PERCENTAGE
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A percentage value, between 0 and 100.
</p></div>
-
+
</div>
</div>
@@ -4145,31 +4146,31 @@
<A NAME="FIELD_REVOLUTIONS"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_REVOLUTIONS
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A count of revolutions.
</p></div>
-
+
</div>
</div>
@@ -4177,31 +4178,31 @@
<A NAME="FIELD_RPM"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_RPM
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>Revolutions per minute or rate per minute.
</p></div>
-
+
</div>
</div>
@@ -4209,31 +4210,31 @@
<A NAME="FIELD_SPEED"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_SPEED
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A speed in meter/sec.
</p></div>
-
+
</div>
</div>
@@ -4241,31 +4242,31 @@
<A NAME="FIELD_STEPS"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_STEPS
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A count of steps.
</p></div>
-
+
</div>
</div>
@@ -4273,31 +4274,31 @@
<A NAME="FIELD_WATTS"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_WATTS
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>Power in watts.
</p></div>
-
+
</div>
</div>
@@ -4305,31 +4306,31 @@
<A NAME="FIELD_WEIGHT"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
- static
- final
+ public
+ static
+ final
<a href="/reference/com/google/android/gms/fitness/data/Field.html">Field</a>
</span>
FIELD_WEIGHT
</h4>
<div class="api-level">
-
-
-
+
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>A weight in kilograms.
</p></div>
-
+
</div>
</div>
@@ -4354,14 +4355,14 @@
<A NAME="describeContents()"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
-
-
-
-
+ public
+
+
+
+
int
</span>
<span class="sympad">describeContents</span>
@@ -4369,15 +4370,15 @@
</h4>
<div class="api-level">
<div></div>
-
-
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p></p></div>
</div>
@@ -4386,14 +4387,14 @@
<A NAME="equals(java.lang.Object)"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
-
-
-
-
+ public
+
+
+
+
boolean
</span>
<span class="sympad">equals</span>
@@ -4401,15 +4402,15 @@
</h4>
<div class="api-level">
<div></div>
-
-
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p></p></div>
</div>
@@ -4418,14 +4419,14 @@
<A NAME="getFormat()"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
-
-
-
-
+ public
+
+
+
+
int
</span>
<span class="sympad">getFormat</span>
@@ -4433,15 +4434,15 @@
</h4>
<div class="api-level">
<div></div>
-
-
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>Returns the format of the field, as one of the format constant values.
</p></div>
@@ -4451,14 +4452,14 @@
<A NAME="getName()"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
-
-
-
-
+ public
+
+
+
+
String
</span>
<span class="sympad">getName</span>
@@ -4466,15 +4467,15 @@
</h4>
<div class="api-level">
<div></div>
-
-
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p>Returns the name of the field.
</p></div>
@@ -4484,14 +4485,14 @@
<A NAME="hashCode()"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
-
-
-
-
+ public
+
+
+
+
int
</span>
<span class="sympad">hashCode</span>
@@ -4499,15 +4500,15 @@
</h4>
<div class="api-level">
<div></div>
-
-
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p></p></div>
</div>
@@ -4516,14 +4517,14 @@
<A NAME="toString()"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
-
-
-
-
+ public
+
+
+
+
String
</span>
<span class="sympad">toString</span>
@@ -4531,15 +4532,15 @@
</h4>
<div class="api-level">
<div></div>
-
-
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p></p></div>
</div>
@@ -4548,14 +4549,14 @@
<A NAME="writeToParcel(android.os.Parcel, int)"></A>
-<div class="jd-details api apilevel-">
+<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
- public
-
-
-
-
+ public
+
+
+
+
void
</span>
<span class="sympad">writeToParcel</span>
@@ -4563,15 +4564,15 @@
</h4>
<div class="api-level">
<div></div>
-
-
+
+
</div>
<div class="jd-details-descr">
-
-
-
+
+
+
<div class="jd-tagdata jd-tagdescr"><p></p></div>
</div>
@@ -4589,17 +4590,17 @@
<A NAME="navbar_top"></A>
<div id="footer" class="wrap" >
-
+
<div id="copyright">
-
+
Except as noted, this content is licensed under <a
- href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
+ href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
For details and restrictions, see the <a href="/license.html">
Content License</a>.
</div>
<div id="build_info">
-
+
<script src="/timestamp.js" type="text/javascript"></script>
<script>document.write(BUILD_TIMESTAMP)</script>
@@ -4607,7 +4608,7 @@
<div id="footerlinks">
-
+
<p>
<a href="/about/index.html">About Android</a> |
<a href="/legal.html">Legal</a> |
@@ -4620,7 +4621,7 @@
</div><!-- end doc-content -->
-</div> <!-- end body-content -->
+</div> <!-- end body-content -->
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java
index 8bbfb51..eba94a3 100644
--- a/media/java/android/media/AudioRecord.java
+++ b/media/java/android/media/AudioRecord.java
@@ -20,6 +20,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
import java.nio.ByteBuffer;
+import java.util.Collection;
import java.util.Iterator;
import android.annotation.IntDef;
@@ -32,6 +33,7 @@
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.util.ArrayMap;
import android.util.Log;
/**
@@ -113,6 +115,11 @@
*/
private static final int NATIVE_EVENT_NEW_POS = 3;
+ /**
+ * Event id denotes when the routing changes.
+ */
+ private final static int NATIVE_EVENT_ROUTING_CHANGE = 1000;
+
private final static String TAG = "android.media.AudioRecord";
/** @hide */
@@ -1127,7 +1134,7 @@
* Sets the listener the AudioRecord notifies when a previously set marker is reached or
* for each periodic record head position update.
* Use this method to receive AudioRecord events in the Handler associated with another
- * thread than the one in which you created the AudioTrack instance.
+ * thread than the one in which you created the AudioRecord instance.
* @param listener
* @param handler the Handler that will receive the event notification messages.
*/
@@ -1168,6 +1175,115 @@
}
+ //--------------------------------------------------------------------------
+ // (Re)Routing Info
+ //--------------------
+ /**
+ * Returns an {@link AudioDeviceInfo} identifying the current routing of this AudioRecord.
+ */
+ public AudioDeviceInfo getRoutedDevice() {
+ return null;
+ }
+
+ /**
+ * The message sent to apps when the routing of this AudioRecord changes if they provide
+ * a {#link Handler} object to addOnAudioRecordRoutingListener().
+ */
+ private ArrayMap<OnAudioRecordRoutingListener, NativeRoutingEventHandlerDelegate>
+ mRoutingChangeListeners =
+ new ArrayMap<OnAudioRecordRoutingListener, NativeRoutingEventHandlerDelegate>();
+
+ /**
+ * Adds an {@link OnAudioRecordRoutingListener} to receive notifications of routing changes
+ * on this AudioRecord.
+ */
+ public void addOnAudioRecordRoutingListener(OnAudioRecordRoutingListener listener,
+ android.os.Handler handler) {
+ if (listener != null && !mRoutingChangeListeners.containsKey(listener)) {
+ synchronized (mRoutingChangeListeners) {
+ mRoutingChangeListeners.put(
+ listener, new NativeRoutingEventHandlerDelegate(this, listener, handler));
+ }
+ }
+ }
+
+ /**
+ * Removes an {@link OnAudioRecordRoutingListener} which has been previously added
+ * to receive notifications of changes to the set of connected audio devices.
+ */
+ public void removeOnAudioRecordRoutingListener(OnAudioRecordRoutingListener listener) {
+ synchronized (mRoutingChangeListeners) {
+ if (mRoutingChangeListeners.containsKey(listener)) {
+ mRoutingChangeListeners.remove(listener);
+ }
+ }
+ }
+
+ /**
+ * Helper class to handle the forwarding of native events to the appropriate listener
+ * (potentially) handled in a different thread
+ */
+ private class NativeRoutingEventHandlerDelegate {
+ private final Handler mHandler;
+
+ NativeRoutingEventHandlerDelegate(final AudioRecord record,
+ final OnAudioRecordRoutingListener listener,
+ Handler handler) {
+ // find the looper for our new event handler
+ Looper looper;
+ if (handler != null) {
+ looper = handler.getLooper();
+ } else {
+ // no given handler, use the looper the AudioRecord was created in
+ looper = mInitializationLooper;
+ }
+
+ // construct the event handler with this looper
+ if (looper != null) {
+ // implement the event handler delegate
+ mHandler = new Handler(looper) {
+ @Override
+ public void handleMessage(Message msg) {
+ if (record == null) {
+ return;
+ }
+ switch(msg.what) {
+ case NATIVE_EVENT_ROUTING_CHANGE:
+ if (listener != null) {
+ listener.onAudioRecordRouting(record);
+ }
+ break;
+ default:
+ loge("Unknown native event type: " + msg.what);
+ break;
+ }
+ }
+ };
+ } else {
+ mHandler = null;
+ }
+ }
+
+ Handler getHandler() {
+ return mHandler;
+ }
+ }
+ /**
+ * Sends device list change notification to all listeners.
+ */
+ private void broadcastRoutingChange() {
+ Collection<NativeRoutingEventHandlerDelegate> values;
+ synchronized (mRoutingChangeListeners) {
+ values = mRoutingChangeListeners.values();
+ }
+ for(NativeRoutingEventHandlerDelegate delegate : values) {
+ Handler handler = delegate.getHandler();
+ if (handler != null) {
+ handler.sendEmptyMessage(NATIVE_EVENT_ROUTING_CHANGE);
+ }
+ }
+ }
+
/**
* Sets the period at which the listener is called, if set with
* {@link #setRecordPositionUpdateListener(OnRecordPositionUpdateListener)} or
@@ -1184,6 +1300,39 @@
}
+ //--------------------------------------------------------------------------
+ // Explicit Routing
+ //--------------------
+ private AudioDeviceInfo mPreferredDevice = null;
+
+ /**
+ * Specifies an audio device (via an {@link AudioDeviceInfo} object) to route
+ * the input to this AudioRecord.
+ * @param deviceSpec The {@link AudioDeviceInfo} specifying the audio source.
+ * If deviceSpec is null, default routing is restored.
+ * @return true if successful, false if the specified {@link AudioDeviceInfo} is non-null and
+ * does not correspond to a valid audio input device.
+ */
+ public boolean setPreferredInputDevice(AudioDeviceInfo deviceInfo) {
+ // Do some validation....
+ if (deviceInfo != null && !deviceInfo.isSource()) {
+ return false;
+ }
+
+ mPreferredDevice = deviceInfo;
+ int preferredDeviceId = mPreferredDevice != null ? deviceInfo.getId() : 0;
+
+ return native_setInputDevice(preferredDeviceId);
+ }
+
+ /**
+ * Returns the selected input specified by {@link #setPreferredInputDevice}. Note that this
+ * is not guarenteed to correspond to the actual device being used for recording.
+ */
+ public AudioDeviceInfo getPreferredInputDevice() {
+ return mPreferredDevice;
+ }
+
//---------------------------------------------------------
// Interface definitions
//--------------------
@@ -1314,6 +1463,8 @@
static private native final int native_get_min_buff_size(
int sampleRateInHz, int channelCount, int audioFormat);
+ private native final boolean native_setInputDevice(int deviceId);
+
//---------------------------------------------------------
// Utility methods
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index 093ff26..d27e6e4 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -23,6 +23,7 @@
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.NioUtils;
+import java.util.Collection;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -37,6 +38,7 @@
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.util.ArrayMap;
import android.util.Log;
import com.android.internal.app.IAppOpsService;
@@ -176,6 +178,12 @@
*/
private static final int NATIVE_EVENT_NEW_POS = 4;
+ /**
+ * Event id denotes when the routing changes.
+ */
+ private final static int NATIVE_EVENT_ROUTING_CHANGE = 1000;
+
+
private final static String TAG = "android.media.AudioTrack";
@@ -224,7 +232,7 @@
/**
* Handler for events coming from the native code.
*/
- private NativeEventHandlerDelegate mEventHandlerDelegate;
+ private NativePositionEventHandlerDelegate mEventHandlerDelegate;
/**
* Looper associated with the thread that creates the AudioTrack instance.
*/
@@ -1243,7 +1251,7 @@
public void setPlaybackPositionUpdateListener(OnPlaybackPositionUpdateListener listener,
Handler handler) {
if (listener != null) {
- mEventHandlerDelegate = new NativeEventHandlerDelegate(this, listener, handler);
+ mEventHandlerDelegate = new NativePositionEventHandlerDelegate(this, listener, handler);
} else {
mEventHandlerDelegate = null;
}
@@ -2082,33 +2090,93 @@
private AudioDeviceInfo mPreferredDevice = null;
/**
- * Specifies an audio device (via and {@link AudioDeviceInfo} object) to route
+ * Specifies an audio device (via an {@link AudioDeviceInfo} object) to route
* the output from this AudioTrack.
- * @param deviceSpec The {@link AudioDeviceInfo} specifying the physical audio device.
+ * @param deviceSpec The {@link AudioDeviceInfo} specifying the audio sink.
* If deviceSpec is null, default routing is restored.
* @return true if succesful, false if the specified {@link AudioDeviceInfo} is non-null and
* does not correspond to a valid audio output device.
*/
- public boolean setPreferredOutputDevice(AudioDeviceInfo deviceSpec) {
+ public boolean setPreferredOutputDevice(AudioDeviceInfo deviceInfo) {
// Do some validation....
- if (deviceSpec != null && !deviceSpec.isSink()) {
+ if (deviceInfo != null && !deviceInfo.isSink()) {
return false;
}
- mPreferredDevice = deviceSpec;
- int routingDeviceId = mPreferredDevice != null ? deviceSpec.getId() : 0;
+ mPreferredDevice = deviceInfo;
+ int preferredDeviceId = mPreferredDevice != null ? deviceInfo.getId() : 0;
- return native_setOutputDevice(routingDeviceId);
+ return native_setOutputDevice(preferredDeviceId);
}
/**
* Returns the selected output specified by {@link #setPreferredOutputDevice}. Note that this
- * is not guarenteed to correspond to the actual device being used for playback.
+ * is not guaranteed to correspond to the actual device being used for playback.
*/
public AudioDeviceInfo getPreferredOutputDevice() {
return mPreferredDevice;
}
+ //--------------------------------------------------------------------------
+ // (Re)Routing Info
+ //--------------------
+ /**
+ * Returns an {@link AudioDeviceInfo} identifying the current routing of this AudioTrack.
+ */
+ public AudioDeviceInfo getRoutedDevice() {
+ return null;
+ }
+
+ /**
+ * The message sent to apps when the routing of this AudioTrack changes if they provide
+ * a {#link Handler} object to addOnAudioTrackRoutingListener().
+ */
+ private ArrayMap<OnAudioTrackRoutingListener, NativeRoutingEventHandlerDelegate>
+ mRoutingChangeListeners =
+ new ArrayMap<OnAudioTrackRoutingListener, NativeRoutingEventHandlerDelegate>();
+
+ /**
+ * Adds an {@link OnAudioTrackRoutingListener} to receive notifications of routing changes
+ * on this AudioTrack.
+ */
+ public void addOnAudioTrackRoutingListener(OnAudioTrackRoutingListener listener,
+ android.os.Handler handler) {
+ if (listener != null && !mRoutingChangeListeners.containsKey(listener)) {
+ synchronized (mRoutingChangeListeners) {
+ mRoutingChangeListeners.put(
+ listener, new NativeRoutingEventHandlerDelegate(this, listener, handler));
+ }
+ }
+ }
+
+ /**
+ * Removes an {@link OnAudioTrackRoutingListener} which has been previously added
+ * to receive notifications of changes to the set of connected audio devices.
+ */
+ public void removeOnAudioTrackRoutingListener(OnAudioTrackRoutingListener listener) {
+ synchronized (mRoutingChangeListeners) {
+ if (mRoutingChangeListeners.containsKey(listener)) {
+ mRoutingChangeListeners.remove(listener);
+ }
+ }
+ }
+
+ /**
+ * Sends device list change notification to all listeners.
+ */
+ private void broadcastRoutingChange() {
+ Collection<NativeRoutingEventHandlerDelegate> values;
+ synchronized (mRoutingChangeListeners) {
+ values = mRoutingChangeListeners.values();
+ }
+ for(NativeRoutingEventHandlerDelegate delegate : values) {
+ Handler handler = delegate.getHandler();
+ if (handler != null) {
+ handler.sendEmptyMessage(NATIVE_EVENT_ROUTING_CHANGE);
+ }
+ }
+ }
+
//---------------------------------------------------------
// Interface definitions
//--------------------
@@ -2137,10 +2205,10 @@
* Helper class to handle the forwarding of native events to the appropriate listener
* (potentially) handled in a different thread
*/
- private class NativeEventHandlerDelegate {
+ private class NativePositionEventHandlerDelegate {
private final Handler mHandler;
- NativeEventHandlerDelegate(final AudioTrack track,
+ NativePositionEventHandlerDelegate(final AudioTrack track,
final OnPlaybackPositionUpdateListener listener,
Handler handler) {
// find the looper for our new event handler
@@ -2188,6 +2256,55 @@
}
}
+ /**
+ * Helper class to handle the forwarding of native events to the appropriate listener
+ * (potentially) handled in a different thread
+ */
+ private class NativeRoutingEventHandlerDelegate {
+ private final Handler mHandler;
+
+ NativeRoutingEventHandlerDelegate(final AudioTrack track,
+ final OnAudioTrackRoutingListener listener,
+ Handler handler) {
+ // find the looper for our new event handler
+ Looper looper;
+ if (handler != null) {
+ looper = handler.getLooper();
+ } else {
+ // no given handler, use the looper the AudioTrack was created in
+ looper = mInitializationLooper;
+ }
+
+ // construct the event handler with this looper
+ if (looper != null) {
+ // implement the event handler delegate
+ mHandler = new Handler(looper) {
+ @Override
+ public void handleMessage(Message msg) {
+ if (track == null) {
+ return;
+ }
+ switch(msg.what) {
+ case NATIVE_EVENT_ROUTING_CHANGE:
+ if (listener != null) {
+ listener.onAudioTrackRouting(track);
+ }
+ break;
+ default:
+ loge("Unknown native event type: " + msg.what);
+ break;
+ }
+ }
+ };
+ } else {
+ mHandler = null;
+ }
+ }
+
+ Handler getHandler() {
+ return mHandler;
+ }
+ }
//---------------------------------------------------------
// Java methods called from the native side
@@ -2201,7 +2318,7 @@
return;
}
- NativeEventHandlerDelegate delegate = track.mEventHandlerDelegate;
+ NativePositionEventHandlerDelegate delegate = track.mEventHandlerDelegate;
if (delegate != null) {
Handler handler = delegate.getHandler();
if (handler != null) {
diff --git a/media/java/android/media/OnAudioRecordRoutingListener.java b/media/java/android/media/OnAudioRecordRoutingListener.java
new file mode 100644
index 0000000..8ff41c5
--- /dev/null
+++ b/media/java/android/media/OnAudioRecordRoutingListener.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2015 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 android.media;
+
+/**
+ * OnAudioDeviceConnectionListener defines the interface for notification listeners in the
+ * {@link AudioDevicesManager}
+ */
+public interface OnAudioRecordRoutingListener {
+ /**
+ * Called when the routing of an AudioRecord changes from either and explicit or
+ * policy rerouting.
+ */
+ public void onAudioRecordRouting(AudioRecord audioRecord);
+}
diff --git a/media/java/android/media/OnAudioTrackRoutingListener.java b/media/java/android/media/OnAudioTrackRoutingListener.java
new file mode 100644
index 0000000..18c72ef
--- /dev/null
+++ b/media/java/android/media/OnAudioTrackRoutingListener.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2015 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 android.media;
+
+/**
+ * OnAudioDeviceConnectionListener defines the interface for notification listeners in the
+ * {@link AudioDevicesManager}
+ */
+public interface OnAudioTrackRoutingListener {
+ /**
+ * Called when the routing of an AudioTrack changes from either and explicit or
+ * policy rerouting.
+ */
+ public void onAudioTrackRouting(AudioTrack audioTrack);
+}
diff --git a/packages/SettingsLib/src/com/android/settingslib/deviceinfo/StorageMeasurement.java b/packages/SettingsLib/src/com/android/settingslib/deviceinfo/StorageMeasurement.java
new file mode 100644
index 0000000..e0af29d
--- /dev/null
+++ b/packages/SettingsLib/src/com/android/settingslib/deviceinfo/StorageMeasurement.java
@@ -0,0 +1,441 @@
+/*
+ * Copyright (C) 2011 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.android.settingslib.deviceinfo;
+
+import android.app.ActivityManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageStatsObserver;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageStats;
+import android.content.pm.UserInfo;
+import android.os.Environment;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.IBinder;
+import android.os.Looper;
+import android.os.Message;
+import android.os.UserHandle;
+import android.os.UserManager;
+import android.os.storage.StorageVolume;
+import android.os.storage.VolumeInfo;
+import android.util.Log;
+import android.util.SparseLongArray;
+
+import com.android.internal.app.IMediaContainerService;
+import com.android.internal.util.ArrayUtils;
+import com.google.android.collect.Sets;
+
+import java.io.File;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * Utility for measuring the disk usage of internal storage or a physical
+ * {@link StorageVolume}. Connects with a remote {@link IMediaContainerService}
+ * and delivers results to {@link MeasurementReceiver}.
+ */
+public class StorageMeasurement {
+ private static final String TAG = "StorageMeasurement";
+
+ private static final boolean LOCAL_LOGV = true;
+ static final boolean LOGV = LOCAL_LOGV && Log.isLoggable(TAG, Log.VERBOSE);
+
+ private static final String DEFAULT_CONTAINER_PACKAGE = "com.android.defcontainer";
+
+ public static final ComponentName DEFAULT_CONTAINER_COMPONENT = new ComponentName(
+ DEFAULT_CONTAINER_PACKAGE, "com.android.defcontainer.DefaultContainerService");
+
+ /** Media types to measure on external storage. */
+ private static final Set<String> sMeasureMediaTypes = Sets.newHashSet(
+ Environment.DIRECTORY_DCIM, Environment.DIRECTORY_MOVIES,
+ Environment.DIRECTORY_PICTURES, Environment.DIRECTORY_MUSIC,
+ Environment.DIRECTORY_ALARMS, Environment.DIRECTORY_NOTIFICATIONS,
+ Environment.DIRECTORY_RINGTONES, Environment.DIRECTORY_PODCASTS,
+ Environment.DIRECTORY_DOWNLOADS, Environment.DIRECTORY_ANDROID);
+
+ public static class MeasurementDetails {
+ /**
+ * Total apps disk usage.
+ * <p>
+ * When measuring internal storage, this value includes the code size of
+ * all apps (regardless of install status for current user), and
+ * internal disk used by the current user's apps. When the device
+ * emulates external storage, this value also includes emulated storage
+ * used by the current user's apps.
+ * <p>
+ * When measuring a physical {@link StorageVolume}, this value includes
+ * usage by all apps on that volume.
+ */
+ public long appsSize;
+
+ /**
+ * Total cache disk usage by apps.
+ */
+ public long cacheSize;
+
+ /**
+ * Total media disk usage, categorized by types such as
+ * {@link Environment#DIRECTORY_MUSIC}.
+ * <p>
+ * When measuring internal storage, this reflects media on emulated
+ * storage for the current user.
+ * <p>
+ * When measuring a physical {@link StorageVolume}, this reflects media
+ * on that volume.
+ */
+ public HashMap<String, Long> mediaSize = new HashMap<>();
+
+ /**
+ * Misc external disk usage for the current user, unaccounted in
+ * {@link #mediaSize}.
+ */
+ public long miscSize;
+
+ /**
+ * Total disk usage for users, which is only meaningful for emulated
+ * internal storage. Key is {@link UserHandle}.
+ */
+ public SparseLongArray usersSize = new SparseLongArray();
+ }
+
+ public interface MeasurementReceiver {
+ public void onDetailsChanged(MeasurementDetails details);
+ }
+
+ private WeakReference<MeasurementReceiver> mReceiver;
+
+ private final Context mContext;
+
+ private final VolumeInfo mVolume;
+ private final VolumeInfo mSharedVolume;
+
+ private final MainHandler mMainHandler;
+ private final MeasurementHandler mMeasurementHandler;
+
+ public StorageMeasurement(Context context, VolumeInfo volume, VolumeInfo sharedVolume) {
+ mContext = context.getApplicationContext();
+
+ mVolume = volume;
+ mSharedVolume = sharedVolume;
+
+ // Start the thread that will measure the disk usage.
+ final HandlerThread handlerThread = new HandlerThread("MemoryMeasurement");
+ handlerThread.start();
+
+ mMainHandler = new MainHandler();
+ mMeasurementHandler = new MeasurementHandler(handlerThread.getLooper());
+ }
+
+ public void setReceiver(MeasurementReceiver receiver) {
+ if (mReceiver == null || mReceiver.get() == null) {
+ mReceiver = new WeakReference<MeasurementReceiver>(receiver);
+ }
+ }
+
+ public void forceMeasure() {
+ invalidate();
+ measure();
+ }
+
+ public void measure() {
+ if (!mMeasurementHandler.hasMessages(MeasurementHandler.MSG_MEASURE)) {
+ mMeasurementHandler.sendEmptyMessage(MeasurementHandler.MSG_MEASURE);
+ }
+ }
+
+ public void onDestroy() {
+ mReceiver = null;
+ mMeasurementHandler.removeMessages(MeasurementHandler.MSG_MEASURE);
+ mMeasurementHandler.sendEmptyMessage(MeasurementHandler.MSG_DISCONNECT);
+ }
+
+ private void invalidate() {
+ mMeasurementHandler.sendEmptyMessage(MeasurementHandler.MSG_INVALIDATE);
+ }
+
+ private static class StatsObserver extends IPackageStatsObserver.Stub {
+ private final boolean mIsPrivate;
+ private final MeasurementDetails mDetails;
+ private final int mCurrentUser;
+ private final Message mFinished;
+
+ private int mRemaining;
+
+ public StatsObserver(boolean isPrivate, MeasurementDetails details, int currentUser,
+ Message finished, int remaining) {
+ mIsPrivate = isPrivate;
+ mDetails = details;
+ mCurrentUser = currentUser;
+ mFinished = finished;
+ mRemaining = remaining;
+ }
+
+ @Override
+ public void onGetStatsCompleted(PackageStats stats, boolean succeeded) {
+ synchronized (mDetails) {
+ if (succeeded) {
+ addStatsLocked(stats);
+ }
+ if (--mRemaining == 0) {
+ mFinished.sendToTarget();
+ }
+ }
+ }
+
+ private void addStatsLocked(PackageStats stats) {
+ if (mIsPrivate) {
+ long codeSize = stats.codeSize;
+ long dataSize = stats.dataSize;
+ long cacheSize = stats.cacheSize;
+ if (Environment.isExternalStorageEmulated()) {
+ // Include emulated storage when measuring internal. OBB is
+ // shared on emulated storage, so treat as code.
+ codeSize += stats.externalCodeSize + stats.externalObbSize;
+ dataSize += stats.externalDataSize + stats.externalMediaSize;
+ cacheSize += stats.externalCacheSize;
+ }
+
+ // Count code and data for current user
+ if (stats.userHandle == mCurrentUser) {
+ mDetails.appsSize += codeSize;
+ mDetails.appsSize += dataSize;
+ }
+
+ // User summary only includes data (code is only counted once
+ // for the current user)
+ addValue(mDetails.usersSize, stats.userHandle, dataSize);
+
+ // Include cache for all users
+ mDetails.cacheSize += cacheSize;
+
+ } else {
+ // Physical storage; only count external sizes
+ mDetails.appsSize += stats.externalCodeSize + stats.externalDataSize
+ + stats.externalMediaSize + stats.externalObbSize;
+ mDetails.cacheSize += stats.externalCacheSize;
+ }
+ }
+ }
+
+ private class MainHandler extends Handler {
+ @Override
+ public void handleMessage(Message msg) {
+ final MeasurementDetails details = (MeasurementDetails) msg.obj;
+ final MeasurementReceiver receiver = (mReceiver != null) ? mReceiver.get() : null;
+ if (receiver != null) {
+ receiver.onDetailsChanged(details);
+ }
+ }
+ }
+
+ private class MeasurementHandler extends Handler {
+ public static final int MSG_MEASURE = 1;
+ public static final int MSG_CONNECTED = 2;
+ public static final int MSG_DISCONNECT = 3;
+ public static final int MSG_COMPLETED = 4;
+ public static final int MSG_INVALIDATE = 5;
+
+ private Object mLock = new Object();
+
+ private IMediaContainerService mDefaultContainer;
+
+ private volatile boolean mBound = false;
+
+ private MeasurementDetails mCached;
+
+ private final ServiceConnection mDefContainerConn = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ final IMediaContainerService imcs = IMediaContainerService.Stub.asInterface(
+ service);
+ mDefaultContainer = imcs;
+ mBound = true;
+ sendMessage(obtainMessage(MSG_CONNECTED, imcs));
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ mBound = false;
+ removeMessages(MSG_CONNECTED);
+ }
+ };
+
+ public MeasurementHandler(Looper looper) {
+ super(looper);
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case MSG_MEASURE: {
+ if (mCached != null) {
+ mMainHandler.obtainMessage(0, mCached).sendToTarget();
+ break;
+ }
+
+ synchronized (mLock) {
+ if (mBound) {
+ removeMessages(MSG_DISCONNECT);
+ sendMessage(obtainMessage(MSG_CONNECTED, mDefaultContainer));
+ } else {
+ Intent service = new Intent().setComponent(DEFAULT_CONTAINER_COMPONENT);
+ mContext.bindServiceAsUser(service, mDefContainerConn,
+ Context.BIND_AUTO_CREATE, UserHandle.OWNER);
+ }
+ }
+ break;
+ }
+ case MSG_CONNECTED: {
+ final IMediaContainerService imcs = (IMediaContainerService) msg.obj;
+ measureExactStorage(imcs);
+ break;
+ }
+ case MSG_DISCONNECT: {
+ synchronized (mLock) {
+ if (mBound) {
+ mBound = false;
+ mContext.unbindService(mDefContainerConn);
+ }
+ }
+ break;
+ }
+ case MSG_COMPLETED: {
+ mCached = (MeasurementDetails) msg.obj;
+ mMainHandler.obtainMessage(0, mCached).sendToTarget();
+ break;
+ }
+ case MSG_INVALIDATE: {
+ mCached = null;
+ break;
+ }
+ }
+ }
+ }
+
+ private void measureExactStorage(IMediaContainerService imcs) {
+ final UserManager userManager = mContext.getSystemService(UserManager.class);
+ final PackageManager packageManager = mContext.getPackageManager();
+
+ final List<UserInfo> users = userManager.getUsers();
+ final int currentUser = ActivityManager.getCurrentUser();
+
+ final MeasurementDetails details = new MeasurementDetails();
+ final Message finished = mMeasurementHandler.obtainMessage(MeasurementHandler.MSG_COMPLETED,
+ details);
+
+ if (mSharedVolume != null && mSharedVolume.isMountedReadable()) {
+ final File basePath = mSharedVolume.getPathForUser(currentUser);
+
+ // Measure media types for emulated storage, or for primary physical
+ // external volume
+ for (String type : sMeasureMediaTypes) {
+ final File path = new File(basePath, type);
+ final long size = getDirectorySize(imcs, path);
+ details.mediaSize.put(type, size);
+ }
+
+ // Measure misc files not counted under media
+ details.miscSize = measureMisc(imcs, basePath);
+
+ if (mSharedVolume.getType() == VolumeInfo.TYPE_EMULATED) {
+ // Measure total emulated storage of all users; internal apps data
+ // will be spliced in later
+ for (UserInfo user : users) {
+ final File userPath = mSharedVolume.getPathForUser(user.id);
+ final long size = getDirectorySize(imcs, userPath);
+ addValue(details.usersSize, user.id, size);
+ }
+ }
+ }
+
+ // Measure all apps hosted on this volume for all users
+ if (mVolume.getType() == VolumeInfo.TYPE_PRIVATE) {
+ final List<ApplicationInfo> apps = packageManager.getInstalledApplications(
+ PackageManager.GET_UNINSTALLED_PACKAGES
+ | PackageManager.GET_DISABLED_COMPONENTS);
+
+ final List<ApplicationInfo> volumeApps = new ArrayList<>();
+ for (ApplicationInfo app : apps) {
+ if (Objects.equals(app.volumeUuid, mVolume.getFsUuid())) {
+ volumeApps.add(app);
+ }
+ }
+
+ final int count = users.size() * volumeApps.size();
+ if (count == 0) {
+ finished.sendToTarget();
+ return;
+ }
+
+ final StatsObserver observer = new StatsObserver(
+ true, details, currentUser, finished, count);
+ for (UserInfo user : users) {
+ for (ApplicationInfo app : volumeApps) {
+ packageManager.getPackageSizeInfo(app.packageName, user.id, observer);
+ }
+ }
+
+ } else {
+ finished.sendToTarget();
+ return;
+ }
+ }
+
+ private static long getDirectorySize(IMediaContainerService imcs, File path) {
+ try {
+ final long size = imcs.calculateDirectorySize(path.toString());
+ Log.d(TAG, "getDirectorySize(" + path + ") returned " + size);
+ return size;
+ } catch (Exception e) {
+ Log.w(TAG, "Could not read memory from default container service for " + path, e);
+ return 0;
+ }
+ }
+
+ private long measureMisc(IMediaContainerService imcs, File dir) {
+ final File[] files = dir.listFiles();
+ if (ArrayUtils.isEmpty(files)) return 0;
+
+ // Get sizes of all top level nodes except the ones already computed
+ long miscSize = 0;
+ for (File file : files) {
+ final String name = file.getName();
+ if (sMeasureMediaTypes.contains(name)) {
+ continue;
+ }
+
+ if (file.isFile()) {
+ miscSize += file.length();
+ } else if (file.isDirectory()) {
+ miscSize += getDirectorySize(imcs, file);
+ }
+ }
+ return miscSize;
+ }
+
+ private static void addValue(SparseLongArray array, int key, long value) {
+ array.put(key, array.get(key) + value);
+ }
+}
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java
index a31a1a7..5df74c5 100644
--- a/services/core/java/com/android/server/LockSettingsService.java
+++ b/services/core/java/com/android/server/LockSettingsService.java
@@ -220,6 +220,35 @@
setString("migrated_biometric_weak", "true", 0);
Slog.i(TAG, "Migrated biometric weak to use the fallback instead");
}
+
+ // Migrates lockscreen.disabled. Prior to M, the flag was ignored when more than one
+ // user was present on the system, so if we're upgrading to M and there is more than one
+ // user we disable the flag to remain consistent.
+ if (getString("migrated_lockscreen_disabled", null, 0) == null) {
+ final UserManager um = (UserManager) mContext.getSystemService(USER_SERVICE);
+
+ final List<UserInfo> users = um.getUsers();
+ final int userCount = users.size();
+ int switchableUsers = 0;
+ for (int i = 0; i < userCount; i++) {
+ if (users.get(i).supportsSwitchTo()) {
+ switchableUsers++;
+ }
+ }
+
+ if (switchableUsers > 1) {
+ for (int i = 0; i < userCount; i++) {
+ int id = users.get(i).id;
+
+ if (getBoolean(LockPatternUtils.DISABLE_LOCKSCREEN_KEY, false, id)) {
+ setBoolean(LockPatternUtils.DISABLE_LOCKSCREEN_KEY, false, id);
+ }
+ }
+ }
+
+ setString("migrated_lockscreen_disabled", "true", 0);
+ Slog.i(TAG, "Migrated lockscreen disabled flag");
+ }
} catch (RemoteException re) {
Slog.e(TAG, "Unable to migrate old data", re);
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index dfe3ec1..eb9234a 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -1677,7 +1677,7 @@
IActivityManager am = ActivityManagerNative.getDefault();
long ident = Binder.clearCallingIdentity();
try {
- am.updateDeviceOwner(mDeviceOwner.getDeviceOwnerPackageName());
+ am.updateDeviceOwner(getDeviceOwner());
} catch (RemoteException e) {
// Not gonna happen.
} finally {
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index d103fbf..7d1a2fa 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -71,6 +71,11 @@
public static final String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma";
/**
+ * Control whether users can edit APNs in Settings.
+ */
+ public static final String BOOL_APN_EXPAND = "bool_apn_expand";
+
+ /**
* If Voice Radio Technology is RIL_RADIO_TECHNOLOGY_LTE:14 or RIL_RADIO_TECHNOLOGY_UNKNOWN:0
* this is the value that should be used instead. A configuration value of
* RIL_RADIO_TECHNOLOGY_UNKNOWN:0 means there is no replacement value and that the default
@@ -121,6 +126,7 @@
sDefaults.putBoolean(BOOL_CARRIER_VOLTE_PROVISIONED, false);
sDefaults.putBoolean(BOOL_CARRIER_VOLTE_TTY_SUPPORTED, true);
sDefaults.putBoolean(BOOL_SHOW_APN_SETTING_CDMA, false);
+ sDefaults.putBoolean(BOOL_APN_EXPAND, true);
sDefaults.putInt(INT_VOLTE_REPLACEMENT_RAT, 0);