Merge "Patches for the Paste window behavior." into honeycomb
diff --git a/api/10.xml b/api/10.xml
index 15fcffe..ad54650 100644
--- a/api/10.xml
+++ b/api/10.xml
@@ -29401,6 +29401,23 @@
visibility="public"
>
</method>
+<method name="listenUsingInsecureRfcommWithServiceRecord"
+ return="android.bluetooth.BluetoothServerSocket"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="name" type="java.lang.String">
+</parameter>
+<parameter name="uuid" type="java.util.UUID">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
<method name="listenUsingRfcommWithServiceRecord"
return="android.bluetooth.BluetoothServerSocket"
abstract="false"
@@ -30587,6 +30604,21 @@
>
<implements name="android.os.Parcelable">
</implements>
+<method name="createInsecureRfcommSocketToServiceRecord"
+ return="android.bluetooth.BluetoothSocket"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="uuid" type="java.util.UUID">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
<method name="createRfcommSocketToServiceRecord"
return="android.bluetooth.BluetoothSocket"
abstract="false"
@@ -35673,6 +35705,17 @@
visibility="public"
>
</field>
+<field name="NFC_SERVICE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""nfc""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="NOTIFICATION_SERVICE"
type="java.lang.String"
transient="false"
@@ -59851,6 +59894,16 @@
visibility="public"
>
</field>
+<field name="inPreferQualityOverSpeed"
+ type="boolean"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="inPreferredConfig"
type="android.graphics.Bitmap.Config"
transient="false"
@@ -59963,6 +60016,146 @@
>
</field>
</class>
+<class name="BitmapRegionDecoder"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="decodeRegion"
+ return="android.graphics.Bitmap"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="rect" type="android.graphics.Rect">
+</parameter>
+<parameter name="options" type="android.graphics.BitmapFactory.Options">
+</parameter>
+</method>
+<method name="getHeight"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getWidth"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isRecycled"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="newInstance"
+ return="android.graphics.BitmapRegionDecoder"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="data" type="byte[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+<parameter name="length" type="int">
+</parameter>
+<parameter name="isShareable" type="boolean">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="newInstance"
+ return="android.graphics.BitmapRegionDecoder"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="fd" type="java.io.FileDescriptor">
+</parameter>
+<parameter name="isShareable" type="boolean">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="newInstance"
+ return="android.graphics.BitmapRegionDecoder"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="is" type="java.io.InputStream">
+</parameter>
+<parameter name="isShareable" type="boolean">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="newInstance"
+ return="android.graphics.BitmapRegionDecoder"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pathName" type="java.lang.String">
+</parameter>
+<parameter name="isShareable" type="boolean">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="recycle"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</class>
<class name="BitmapShader"
extends="android.graphics.Shader"
abstract="false"
@@ -85926,6 +86119,385 @@
</parameter>
</method>
</interface>
+<class name="MediaMetadataRetriever"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="MediaMetadataRetriever"
+ type="android.media.MediaMetadataRetriever"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="extractMetadata"
+ return="java.lang.String"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="keyCode" type="int">
+</parameter>
+</method>
+<method name="getEmbeddedPicture"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getFrameAtTime"
+ return="android.graphics.Bitmap"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="timeUs" type="long">
+</parameter>
+<parameter name="option" type="int">
+</parameter>
+</method>
+<method name="getFrameAtTime"
+ return="android.graphics.Bitmap"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="timeUs" type="long">
+</parameter>
+</method>
+<method name="getFrameAtTime"
+ return="android.graphics.Bitmap"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="release"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="setDataSource"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="path" type="java.lang.String">
+</parameter>
+<exception name="IllegalArgumentException" type="java.lang.IllegalArgumentException">
+</exception>
+</method>
+<method name="setDataSource"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="fd" type="java.io.FileDescriptor">
+</parameter>
+<parameter name="offset" type="long">
+</parameter>
+<parameter name="length" type="long">
+</parameter>
+<exception name="IllegalArgumentException" type="java.lang.IllegalArgumentException">
+</exception>
+</method>
+<method name="setDataSource"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="fd" type="java.io.FileDescriptor">
+</parameter>
+<exception name="IllegalArgumentException" type="java.lang.IllegalArgumentException">
+</exception>
+</method>
+<method name="setDataSource"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="uri" type="android.net.Uri">
+</parameter>
+<exception name="IllegalArgumentException" type="java.lang.IllegalArgumentException">
+</exception>
+<exception name="SecurityException" type="java.lang.SecurityException">
+</exception>
+</method>
+<field name="METADATA_KEY_ALBUM"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_ALBUMARTIST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="13"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_ARTIST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_AUTHOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_CD_TRACK_NUMBER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_COMPILATION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="15"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_COMPOSER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_DATE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_DISC_NUMBER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="14"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_DURATION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="9"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_GENRE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="6"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_MIMETYPE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="12"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_NUM_TRACKS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="10"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_TITLE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_WRITER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="11"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="METADATA_KEY_YEAR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="8"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="OPTION_CLOSEST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="OPTION_CLOSEST_SYNC"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="OPTION_NEXT_SYNC"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="OPTION_PREVIOUS_SYNC"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
<class name="MediaPlayer"
extends="java.lang.Object"
abstract="false"
@@ -87195,6 +87767,17 @@
deprecated="not deprecated"
visibility="public"
>
+<field name="AAC"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="AMR_NB"
type="int"
transient="false"
@@ -87206,6 +87789,17 @@
visibility="public"
>
</field>
+<field name="AMR_WB"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="DEFAULT"
type="int"
transient="false"
@@ -87362,6 +87956,28 @@
deprecated="not deprecated"
visibility="public"
>
+<field name="AMR_NB"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="AMR_WB"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="DEFAULT"
type="int"
transient="false"
@@ -100173,6 +100789,66 @@
deprecated="not deprecated"
visibility="public"
>
+<method name="disableForegroundDispatch"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="activity" type="android.app.Activity">
+</parameter>
+</method>
+<method name="disableForegroundNdefPush"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="activity" type="android.app.Activity">
+</parameter>
+</method>
+<method name="enableForegroundDispatch"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="activity" type="android.app.Activity">
+</parameter>
+<parameter name="intent" type="android.app.PendingIntent">
+</parameter>
+<parameter name="filters" type="android.content.IntentFilter[]">
+</parameter>
+<parameter name="techLists" type="java.lang.String[][]">
+</parameter>
+</method>
+<method name="enableForegroundNdefPush"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="activity" type="android.app.Activity">
+</parameter>
+<parameter name="msg" type="android.nfc.NdefMessage">
+</parameter>
+</method>
<method name="getDefaultAdapter"
return="android.nfc.NfcAdapter"
abstract="false"
@@ -100183,6 +100859,19 @@
deprecated="not deprecated"
visibility="public"
>
+<parameter name="context" type="android.content.Context">
+</parameter>
+</method>
+<method name="getDefaultAdapter"
+ return="android.nfc.NfcAdapter"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="deprecated"
+ visibility="public"
+>
</method>
<method name="isEnabled"
return="boolean"
@@ -100195,6 +100884,17 @@
visibility="public"
>
</method>
+<field name="ACTION_NDEF_DISCOVERED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.nfc.action.NDEF_DISCOVERED""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="ACTION_TAG_DISCOVERED"
type="java.lang.String"
transient="false"
@@ -100206,6 +100906,17 @@
visibility="public"
>
</field>
+<field name="ACTION_TECHNOLOGY_DISCOVERED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.nfc.action.TECH_DISCOVERED""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="EXTRA_ID"
type="java.lang.String"
transient="false"
@@ -100228,7 +100939,1327 @@
visibility="public"
>
</field>
+<field name="EXTRA_TAG"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.nfc.extra.TAG""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
+<class name="NfcManager"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="getDefaultAdapter"
+ return="android.nfc.NfcAdapter"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</class>
+<class name="Tag"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<implements name="android.os.Parcelable">
+</implements>
+<method name="createMockTag"
+ return="android.nfc.Tag"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="id" type="byte[]">
+</parameter>
+<parameter name="techList" type="int[]">
+</parameter>
+<parameter name="techListExtras" type="android.os.Bundle[]">
+</parameter>
+</method>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getId"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getTechList"
+ return="java.lang.String[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
+<field name="CREATOR"
+ type="android.os.Parcelable.Creator"
+ transient="false"
+ volatile="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<class name="TagLostException"
+ extends="java.io.IOException"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="TagLostException"
+ type="android.nfc.TagLostException"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<constructor name="TagLostException"
+ type="android.nfc.TagLostException"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="message" type="java.lang.String">
+</parameter>
+</constructor>
+</class>
+</package>
+<package name="android.nfc.tech"
+>
+<class name="BasicTagTechnology"
+ extends="java.lang.Object"
+ abstract="true"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility=""
+>
+<implements name="android.nfc.tech.TagTechnology">
+</implements>
+<method name="close"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="connect"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="getTag"
+ return="android.nfc.Tag"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isConnected"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="reconnect"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+</class>
+<class name="IsoDep"
+ extends="android.nfc.tech.BasicTagTechnology"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="get"
+ return="android.nfc.tech.IsoDep"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="tag" type="android.nfc.Tag">
+</parameter>
+</method>
+<method name="getHiLayerResponse"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getHistoricalBytes"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="setTimeout"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="timeout" type="int">
+</parameter>
+</method>
+<method name="transceive"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="data" type="byte[]">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+</class>
+<class name="MifareClassic"
+ extends="android.nfc.tech.BasicTagTechnology"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="authenticateSectorWithKeyA"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="sectorIndex" type="int">
+</parameter>
+<parameter name="key" type="byte[]">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="authenticateSectorWithKeyB"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="sectorIndex" type="int">
+</parameter>
+<parameter name="key" type="byte[]">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="blockToSector"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="blockIndex" type="int">
+</parameter>
+</method>
+<method name="decrement"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="blockIndex" type="int">
+</parameter>
+<parameter name="value" type="int">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="get"
+ return="android.nfc.tech.MifareClassic"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="tag" type="android.nfc.Tag">
+</parameter>
+</method>
+<method name="getBlockCount"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getBlockCountInSector"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="sectorIndex" type="int">
+</parameter>
+</method>
+<method name="getSectorCount"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSize"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getType"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="increment"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="blockIndex" type="int">
+</parameter>
+<parameter name="value" type="int">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="readBlock"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="blockIndex" type="int">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="restore"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="blockIndex" type="int">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="sectorToBlock"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="sectorIndex" type="int">
+</parameter>
+</method>
+<method name="transceive"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="data" type="byte[]">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="transfer"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="blockIndex" type="int">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="writeBlock"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="blockIndex" type="int">
+</parameter>
+<parameter name="data" type="byte[]">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<field name="BLOCK_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_DEFAULT"
+ type="byte[]"
+ transient="false"
+ volatile="false"
+ value="null"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_MIFARE_APPLICATION_DIRECTORY"
+ type="byte[]"
+ transient="false"
+ volatile="false"
+ value="null"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_NFC_FORUM"
+ type="byte[]"
+ transient="false"
+ volatile="false"
+ value="null"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SIZE_1K"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1024"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SIZE_2K"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2048"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SIZE_4K"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4096"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SIZE_MINI"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="320"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TYPE_CLASSIC"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TYPE_PLUS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TYPE_PRO"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TYPE_UNKNOWN"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="-1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<class name="MifareUltralight"
+ extends="android.nfc.tech.BasicTagTechnology"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="get"
+ return="android.nfc.tech.MifareUltralight"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="tag" type="android.nfc.Tag">
+</parameter>
+</method>
+<method name="getType"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="readPages"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pageOffset" type="int">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="transceive"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="data" type="byte[]">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="writePage"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pageOffset" type="int">
+</parameter>
+<parameter name="data" type="byte[]">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<field name="PAGE_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TYPE_ULTRALIGHT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TYPE_ULTRALIGHT_C"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TYPE_UNKNOWN"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="-1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<class name="Ndef"
+ extends="android.nfc.tech.BasicTagTechnology"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="canMakeReadonly"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="get"
+ return="android.nfc.tech.Ndef"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="tag" type="android.nfc.Tag">
+</parameter>
+</method>
+<method name="getCachedNdefMessage"
+ return="android.nfc.NdefMessage"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getMaxSize"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getNdefMessage"
+ return="android.nfc.NdefMessage"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="FormatException" type="android.nfc.FormatException">
+</exception>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="getType"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isWritable"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="makeReadonly"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="writeNdefMessage"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="msg" type="android.nfc.NdefMessage">
+</parameter>
+<exception name="FormatException" type="android.nfc.FormatException">
+</exception>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<field name="MIFARE_CLASSIC"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="101"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="NFC_FORUM_TYPE_1"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="NFC_FORUM_TYPE_2"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="NFC_FORUM_TYPE_3"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="NFC_FORUM_TYPE_4"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="OTHER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="-1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<class name="NdefFormatable"
+ extends="android.nfc.tech.BasicTagTechnology"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="format"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="firstMessage" type="android.nfc.NdefMessage">
+</parameter>
+<exception name="FormatException" type="android.nfc.FormatException">
+</exception>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="get"
+ return="android.nfc.tech.NdefFormatable"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="tag" type="android.nfc.Tag">
+</parameter>
+</method>
+</class>
+<class name="NfcA"
+ extends="android.nfc.tech.BasicTagTechnology"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="get"
+ return="android.nfc.tech.NfcA"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="tag" type="android.nfc.Tag">
+</parameter>
+</method>
+<method name="getAtqa"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSak"
+ return="short"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="transceive"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="data" type="byte[]">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+</class>
+<class name="NfcB"
+ extends="android.nfc.tech.BasicTagTechnology"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="get"
+ return="android.nfc.tech.NfcB"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="tag" type="android.nfc.Tag">
+</parameter>
+</method>
+<method name="getApplicationData"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getProtocolInfo"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="transceive"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="data" type="byte[]">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+</class>
+<class name="NfcF"
+ extends="android.nfc.tech.BasicTagTechnology"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="get"
+ return="android.nfc.tech.NfcF"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="tag" type="android.nfc.Tag">
+</parameter>
+</method>
+<method name="getManufacturer"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSystemCode"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="transceive"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="data" type="byte[]">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+</class>
+<class name="NfcV"
+ extends="android.nfc.tech.BasicTagTechnology"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="get"
+ return="android.nfc.tech.NfcV"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="tag" type="android.nfc.Tag">
+</parameter>
+</method>
+<method name="getDsfId"
+ return="byte"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getResponseFlags"
+ return="byte"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="transceive"
+ return="byte[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="data" type="byte[]">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+</class>
+<interface name="TagTechnology"
+ abstract="true"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<implements name="java.io.Closeable">
+</implements>
+<method name="close"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="connect"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+<method name="getTag"
+ return="android.nfc.Tag"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="reconnect"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
+</interface>
</package>
<package name="android.opengl"
>
@@ -120245,6 +122276,17 @@
visibility="public"
>
</field>
+<field name="GINGERBREAD_MR1"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="10"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
<class name="Bundle"
extends="java.lang.Object"
@@ -147050,6 +149092,92 @@
>
</field>
</class>
+<class name="RecognizerResultsIntent"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<field name="ACTION_VOICE_SEARCH_RESULTS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.speech.action.VOICE_SEARCH_RESULTS""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_VOICE_SEARCH_RESULT_HTML"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.speech.extras.VOICE_SEARCH_RESULT_HTML""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_VOICE_SEARCH_RESULT_HTML_BASE_URLS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.speech.extras.VOICE_SEARCH_RESULT_HTML_BASE_URLS""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_VOICE_SEARCH_RESULT_HTTP_HEADERS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.speech.extras.EXTRA_VOICE_SEARCH_RESULT_HTTP_HEADERS""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_VOICE_SEARCH_RESULT_STRINGS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.speech.extras.VOICE_SEARCH_RESULT_STRINGS""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_VOICE_SEARCH_RESULT_URLS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.speech.extras.VOICE_SEARCH_RESULT_URLS""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="URI_SCHEME_INLINE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""inline""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
<class name="SpeechRecognizer"
extends="java.lang.Object"
abstract="false"
diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java
index 6baf1c2..e403ac2 100644
--- a/core/java/android/content/res/CompatibilityInfo.java
+++ b/core/java/android/content/res/CompatibilityInfo.java
@@ -141,10 +141,16 @@
appFlags = appInfo.flags;
if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS) != 0) {
- mCompatibilityFlags |= LARGE_SCREENS | CONFIGURED_LARGE_SCREENS;
+ // Saying you support large screens also implies you support xlarge
+ // screens; there is no compatibility mode for a large app on an
+ // xlarge screen.
+ mCompatibilityFlags |= LARGE_SCREENS | CONFIGURED_LARGE_SCREENS
+ | XLARGE_SCREENS | CONFIGURED_XLARGE_SCREENS
+ | EXPANDABLE | CONFIGURED_EXPANDABLE;
}
if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS) != 0) {
- mCompatibilityFlags |= XLARGE_SCREENS | CONFIGURED_XLARGE_SCREENS;
+ mCompatibilityFlags |= XLARGE_SCREENS | CONFIGURED_XLARGE_SCREENS
+ | EXPANDABLE | CONFIGURED_EXPANDABLE;
}
if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) {
mCompatibilityFlags |= EXPANDABLE | CONFIGURED_EXPANDABLE;
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index f111f98..f9629bd 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -10940,7 +10940,7 @@
public void dispatchSystemUiVisibilityChanged(int visibility) {
if (mOnSystemUiVisibilityChangeListener != null) {
mOnSystemUiVisibilityChangeListener.onSystemUiVisibilityChange(
- visibility & ~PUBLIC_STATUS_BAR_VISIBILITY_MASK);
+ visibility & PUBLIC_STATUS_BAR_VISIBILITY_MASK);
}
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index a9abb65..fcfcc03 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -6625,15 +6625,10 @@
* @param y New y position of the WebTextView in view coordinates
*/
/* package */ void scrollFocusedTextInputY(int y) {
- if (!inEditingMode()) {
+ if (!inEditingMode() || mWebViewCore == null) {
return;
}
- int xPos = viewToContentX((mWebTextView.getLeft() + mWebTextView.getRight()) / 2);
- int yPos = viewToContentY((mWebTextView.getTop() + mWebTextView.getBottom()) / 2);
- int layer = nativeScrollableLayer(xPos, yPos, null, null);
- if (layer != 0) {
- nativeScrollLayer(layer, 0, viewToContentDimension(y));
- }
+ mWebViewCore.sendMessage(EventHub.SCROLL_TEXT_INPUT, 0, viewToContentDimension(y));
}
/**
@@ -7980,18 +7975,15 @@
* @param node Pointer to the node touched.
* @param x x-position of the touch.
* @param y y-position of the touch.
- * @param scrollY Only used when touching on a textarea. Otherwise, use -1.
- * Tells how much the textarea is scrolled.
*/
private void sendMotionUp(int touchGeneration,
- int frame, int node, int x, int y, int scrollY) {
+ int frame, int node, int x, int y) {
WebViewCore.TouchUpData touchUpData = new WebViewCore.TouchUpData();
touchUpData.mMoveGeneration = touchGeneration;
touchUpData.mFrame = frame;
touchUpData.mNode = node;
touchUpData.mX = x;
touchUpData.mY = y;
- touchUpData.mScrollY = scrollY;
mWebViewCore.sendMessage(EventHub.TOUCH_UP, touchUpData);
}
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 3bde000..b949a41 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -559,7 +559,7 @@
private native String nativeRetrieveImageSource(int x, int y);
private native void nativeTouchUp(int touchGeneration,
- int framePtr, int nodePtr, int x, int y, int scrollY);
+ int framePtr, int nodePtr, int x, int y);
private native boolean nativeHandleTouchEvent(int action, int[] idArray,
int[] xArray, int[] yArray, int count, int metaState);
@@ -777,8 +777,6 @@
int mNode;
int mX;
int mY;
- // Used in the case of a scrolled textarea
- int mScrollY;
}
static class TouchHighlightData {
@@ -1086,8 +1084,13 @@
break;
case SCROLL_TEXT_INPUT:
- nativeScrollFocusedTextInput(
- ((Float) msg.obj).floatValue(), msg.arg1);
+ float xPercent;
+ if (msg.obj == null) {
+ xPercent = 0f;
+ } else {
+ xPercent = ((Float) msg.obj).floatValue();
+ }
+ nativeScrollFocusedTextInput(xPercent, msg.arg2);
break;
case LOAD_URL: {
@@ -1307,8 +1310,7 @@
TouchUpData touchUpData = (TouchUpData) msg.obj;
nativeTouchUp(touchUpData.mMoveGeneration,
touchUpData.mFrame, touchUpData.mNode,
- touchUpData.mX, touchUpData.mY,
- touchUpData.mScrollY);
+ touchUpData.mX, touchUpData.mY);
break;
case TOUCH_EVENT: {
diff --git a/core/java/android/widget/TabWidget.java b/core/java/android/widget/TabWidget.java
index 1a4ff29..22f6f4e 100644
--- a/core/java/android/widget/TabWidget.java
+++ b/core/java/android/widget/TabWidget.java
@@ -66,6 +66,10 @@
private final Rect mBounds = new Rect();
+ // When positive, the widths and heights of tabs will be imposed so that they fit in parent
+ private int mImposedTabsHeight = -1;
+ private int[] mImposedTabWidths;
+
public TabWidget(Context context) {
this(context, null);
}
@@ -150,52 +154,62 @@
setOnFocusChangeListener(this);
}
- /**
- * {@inheritDoc}
- */
@Override
- void measureHorizontal(int widthMeasureSpec, int heightMeasureSpec) {
- // First measure with no constraint
- final int unspecifiedWidth = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
- super.measureHorizontal(unspecifiedWidth, heightMeasureSpec);
+ void measureChildBeforeLayout(View child, int childIndex,
+ int widthMeasureSpec, int totalWidth,
+ int heightMeasureSpec, int totalHeight) {
- final int count = getChildCount();
- int totalWidth = 0;
- int totalCount = 0;
- for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
- if (child.getVisibility() == GONE) {
- continue;
- }
- final int childWidth = child.getMeasuredWidth();
- totalWidth += childWidth;
- totalCount++;
+ if (mImposedTabsHeight >= 0) {
+ widthMeasureSpec = MeasureSpec.makeMeasureSpec(
+ totalWidth + mImposedTabWidths[childIndex], MeasureSpec.EXACTLY);
+ heightMeasureSpec = MeasureSpec.makeMeasureSpec(mImposedTabsHeight,
+ MeasureSpec.EXACTLY);
}
- final int width = MeasureSpec.getSize(widthMeasureSpec);
- if (totalWidth > width && totalCount > 0) {
- int extraWidth = totalWidth - width;
+ super.measureChildBeforeLayout(child, childIndex,
+ widthMeasureSpec, totalWidth, heightMeasureSpec, totalHeight);
+ }
+
+ @Override
+ void measureHorizontal(int widthMeasureSpec, int heightMeasureSpec) {
+ // First, measure with no constraint
+ final int unspecifiedWidth = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ super.measureHorizontal(unspecifiedWidth, heightMeasureSpec);
+ mImposedTabsHeight = -1;
+
+ int extraWidth = getMeasuredWidth() - MeasureSpec.getSize(widthMeasureSpec);
+ if (extraWidth > 0) {
+ final int count = getChildCount();
+
+ int childCount = 0;
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
- if (child.getVisibility() == GONE) {
- continue;
- }
- final int childWidth = child.getMeasuredWidth();
- final int delta = extraWidth / totalCount;
- final int tabWidth = Math.max(0, childWidth - delta);
-
- final int tabWidthMeasureSpec = MeasureSpec.makeMeasureSpec(
- tabWidth, MeasureSpec.EXACTLY);
- final int tabHeightMeasureSpec = MeasureSpec.makeMeasureSpec(
- child.getMeasuredHeight(), MeasureSpec.EXACTLY);
-
- child.measure(tabWidthMeasureSpec, tabHeightMeasureSpec);
-
- // Make sure the extra width is evenly distributed, avoiding int division remainder
- extraWidth -= delta;
- totalCount--;
+ if (child.getVisibility() == GONE) continue;
+ childCount++;
}
- setMeasuredDimension(width, getMeasuredHeight());
+
+ if (childCount > 0) {
+ if (mImposedTabWidths == null || mImposedTabWidths.length != count) {
+ mImposedTabWidths = new int[count];
+ }
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.getVisibility() == GONE) continue;
+ final int childWidth = child.getMeasuredWidth();
+ final int delta = extraWidth / childCount;
+ final int newWidth = Math.max(0, childWidth - delta);
+ mImposedTabWidths[i] = newWidth;
+ // Make sure the extra width is evenly distributed, no int division remainder
+ extraWidth -= childWidth - newWidth; // delta may have been clamped
+ childCount--;
+ mImposedTabsHeight = Math.max(mImposedTabsHeight, child.getMeasuredHeight());
+ }
+ }
+ }
+
+ // Measure again, this time with imposed tab widths and respecting initial spec request
+ if (mImposedTabsHeight >= 0 || unspecifiedWidth != widthMeasureSpec) {
+ super.measureHorizontal(widthMeasureSpec, heightMeasureSpec);
}
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index c500db3..8cb725a 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -3489,8 +3489,7 @@
com.android.internal.R.layout.textview_hint, null);
final float scale = getResources().getDisplayMetrics().density;
- mPopup = new ErrorPopup(err, (int) (200 * scale + 0.5f),
- (int) (50 * scale + 0.5f));
+ mPopup = new ErrorPopup(err, (int) (200 * scale + 0.5f), (int) (50 * scale + 0.5f));
mPopup.setFocusable(false);
// The user is entering text, so the input method is needed. We
// don't want the popup to be displayed on top of it.
@@ -3514,6 +3513,12 @@
ErrorPopup(TextView v, int width, int height) {
super(v, width, height);
mView = v;
+ // Make sure the TextView has a background set as it will be used the first time it is
+ // shown and positionned. Initialized with below background, which should have
+ // dimensions identical to the above version for this to work (and is more likely).
+ mPopupInlineErrorBackgroundId = getResourceId(mPopupInlineErrorBackgroundId,
+ com.android.internal.R.styleable.Theme_errorMessageBackground);
+ mView.setBackgroundResource(mPopupInlineErrorBackgroundId);
}
void fixDirection(boolean above) {
@@ -3521,18 +3526,21 @@
if (above) {
mPopupInlineErrorAboveBackgroundId =
- getResourceId(mPopupInlineErrorAboveBackgroundId, com.android.internal.R.styleable.Theme_errorMessageAboveBackground);
+ getResourceId(mPopupInlineErrorAboveBackgroundId,
+ com.android.internal.R.styleable.Theme_errorMessageAboveBackground);
} else {
- mPopupInlineErrorBackgroundId =
- getResourceId(mPopupInlineErrorBackgroundId, com.android.internal.R.styleable.Theme_errorMessageBackground);
+ mPopupInlineErrorBackgroundId = getResourceId(mPopupInlineErrorBackgroundId,
+ com.android.internal.R.styleable.Theme_errorMessageBackground);
}
- mView.setBackgroundResource(above ? mPopupInlineErrorAboveBackgroundId : mPopupInlineErrorBackgroundId);
+ mView.setBackgroundResource(above ? mPopupInlineErrorAboveBackgroundId :
+ mPopupInlineErrorBackgroundId);
}
private int getResourceId(int currentId, int index) {
if (currentId == 0) {
- TypedArray styledAttributes = mView.getContext().obtainStyledAttributes(R.styleable.Theme);
+ TypedArray styledAttributes = mView.getContext().obtainStyledAttributes(
+ R.styleable.Theme);
currentId = styledAttributes.getResourceId(index, 0);
styledAttributes.recycle();
}
@@ -3562,9 +3570,8 @@
final float scale = getResources().getDisplayMetrics().density;
final Drawables dr = mDrawables;
- return getWidth() - mPopup.getWidth()
- - getPaddingRight()
- - (dr != null ? dr.mDrawableSizeRight : 0) / 2 + (int) (25 * scale + 0.5f);
+ return getWidth() - mPopup.getWidth() - getPaddingRight() -
+ (dr != null ? dr.mDrawableSizeRight : 0) / 2 + (int) (25 * scale + 0.5f);
}
/**
@@ -3576,20 +3583,20 @@
* Compound, not extended, because the icon is not clipped
* if the text height is smaller.
*/
- int vspace = mBottom - mTop -
- getCompoundPaddingBottom() - getCompoundPaddingTop();
+ final int compoundPaddingTop = getCompoundPaddingTop();
+ int vspace = mBottom - mTop - getCompoundPaddingBottom() - compoundPaddingTop;
final Drawables dr = mDrawables;
- int icontop = getCompoundPaddingTop()
- + (vspace - (dr != null ? dr.mDrawableHeightRight : 0)) / 2;
+ int icontop = compoundPaddingTop +
+ (vspace - (dr != null ? dr.mDrawableHeightRight : 0)) / 2;
/*
* The "2" is the distance between the point and the top edge
* of the background.
*/
-
- return icontop + (dr != null ? dr.mDrawableHeightRight : 0)
- - getHeight() - 2;
+ final float scale = getResources().getDisplayMetrics().density;
+ return icontop + (dr != null ? dr.mDrawableHeightRight : 0) - getHeight() -
+ (int) (2 * scale + 0.5f);
}
private void hideError() {
@@ -5772,11 +5779,10 @@
int want = width - getCompoundPaddingLeft() - getCompoundPaddingRight();
int unpaddedWidth = want;
+
+ if (mHorizontallyScrolling) want = VERY_WIDE;
+
int hintWant = want;
-
- if (mHorizontallyScrolling)
- want = VERY_WIDE;
-
int hintWidth = mHintLayout == null ? hintWant : mHintLayout.getWidth();
if (mLayout == null) {
diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java
index 4b37beb..18d1825 100644
--- a/core/java/android/widget/TimePicker.java
+++ b/core/java/android/widget/TimePicker.java
@@ -132,12 +132,8 @@
mHourSpinner.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
public void onValueChange(NumberPicker spinner, int oldVal, int newVal) {
if (!is24HourView()) {
- int minValue = mHourSpinner.getMinValue();
- int maxValue = mHourSpinner.getMaxValue();
- // toggle AM/PM if the spinner has wrapped and not in 24
- // format
- if ((oldVal == maxValue && newVal == minValue)
- || (oldVal == minValue && newVal == maxValue)) {
+ if ((oldVal == HOURS_IN_HALF_DAY - 1 && newVal == HOURS_IN_HALF_DAY)
+ || (oldVal == HOURS_IN_HALF_DAY && newVal == HOURS_IN_HALF_DAY - 1)) {
mIsAm = !mIsAm;
updateAmPmControl();
}
@@ -163,21 +159,19 @@
int minValue = mMinuteSpinner.getMinValue();
int maxValue = mMinuteSpinner.getMaxValue();
if (oldVal == maxValue && newVal == minValue) {
- int currentHour = mHourSpinner.getValue();
- // toggle AM/PM if the spinner is about to wrap
- if (!is24HourView() && currentHour == mHourSpinner.getMaxValue()) {
+ int newHour = mHourSpinner.getValue() + 1;
+ if (!is24HourView() && newHour == HOURS_IN_HALF_DAY) {
mIsAm = !mIsAm;
updateAmPmControl();
}
- mHourSpinner.setValue(currentHour + 1);
+ mHourSpinner.setValue(newHour);
} else if (oldVal == minValue && newVal == maxValue) {
- int currentHour = mHourSpinner.getValue();
- // toggle AM/PM if the spinner is about to wrap
- if (!is24HourView() && currentHour == mHourSpinner.getMinValue()) {
+ int newHour = mHourSpinner.getValue() - 1;
+ if (!is24HourView() && newHour == HOURS_IN_HALF_DAY - 1) {
mIsAm = !mIsAm;
updateAmPmControl();
}
- mHourSpinner.setValue(currentHour - 1);
+ mHourSpinner.setValue(newHour);
}
onTimeChanged();
}
@@ -330,10 +324,12 @@
*/
public Integer getCurrentHour() {
int currentHour = mHourSpinner.getValue();
- if (is24HourView() || mIsAm) {
+ if (is24HourView()) {
return currentHour;
+ } else if (mIsAm) {
+ return currentHour % HOURS_IN_HALF_DAY;
} else {
- return (currentHour == HOURS_IN_HALF_DAY) ? 0 : currentHour + HOURS_IN_HALF_DAY;
+ return (currentHour % HOURS_IN_HALF_DAY) + HOURS_IN_HALF_DAY;
}
}
@@ -347,14 +343,16 @@
}
if (!is24HourView()) {
// convert [0,23] ordinal to wall clock display
- if (currentHour > HOURS_IN_HALF_DAY) {
- currentHour -= HOURS_IN_HALF_DAY;
+ if (currentHour >= HOURS_IN_HALF_DAY) {
mIsAm = false;
+ if (currentHour > HOURS_IN_HALF_DAY) {
+ currentHour = currentHour - HOURS_IN_HALF_DAY;
+ }
} else {
+ mIsAm = true;
if (currentHour == 0) {
currentHour = HOURS_IN_HALF_DAY;
}
- mIsAm = true;
}
updateAmPmControl();
}
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index b1b5d71..471a5a9 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -480,12 +480,12 @@
@Override
public void show() {
- if (mContainerView.getVisibility() == View.VISIBLE) {
- return;
- }
if (mCurrentAnim != null) {
mCurrentAnim.end();
}
+ if (mContainerView.getVisibility() == View.VISIBLE) {
+ return;
+ }
mContainerView.setVisibility(View.VISIBLE);
mContainerView.setAlpha(0);
AnimatorSet anim = new AnimatorSet();
diff --git a/core/res/res/drawable-hdpi/indicator_input_error.png b/core/res/res/drawable-hdpi/indicator_input_error.png
index 213976c..8785376 100644
--- a/core/res/res/drawable-hdpi/indicator_input_error.png
+++ b/core/res/res/drawable-hdpi/indicator_input_error.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/popup_inline_error_above_holo_dark.9.png b/core/res/res/drawable-hdpi/popup_inline_error_above_holo_dark.9.png
new file mode 100644
index 0000000..61ea2b0
--- /dev/null
+++ b/core/res/res/drawable-hdpi/popup_inline_error_above_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/popup_inline_error_above_holo_light.9.png b/core/res/res/drawable-hdpi/popup_inline_error_above_holo_light.9.png
new file mode 100644
index 0000000..83b2bce
--- /dev/null
+++ b/core/res/res/drawable-hdpi/popup_inline_error_above_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/popup_inline_error_holo_dark.9.png b/core/res/res/drawable-hdpi/popup_inline_error_holo_dark.9.png
new file mode 100644
index 0000000..daa47b7
--- /dev/null
+++ b/core/res/res/drawable-hdpi/popup_inline_error_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/popup_inline_error_holo_light.9.png b/core/res/res/drawable-hdpi/popup_inline_error_holo_light.9.png
new file mode 100644
index 0000000..6c45935
--- /dev/null
+++ b/core/res/res/drawable-hdpi/popup_inline_error_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/indicator_input_error.png b/core/res/res/drawable-mdpi/indicator_input_error.png
index ee60165..775e417 100755
--- a/core/res/res/drawable-mdpi/indicator_input_error.png
+++ b/core/res/res/drawable-mdpi/indicator_input_error.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/popup_inline_error_above_holo_dark.9.png b/core/res/res/drawable-mdpi/popup_inline_error_above_holo_dark.9.png
index dd4af6d..c03e658 100644
--- a/core/res/res/drawable-mdpi/popup_inline_error_above_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/popup_inline_error_above_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/popup_inline_error_above_holo_light.9.png b/core/res/res/drawable-mdpi/popup_inline_error_above_holo_light.9.png
index 8925112..19b153b 100644
--- a/core/res/res/drawable-mdpi/popup_inline_error_above_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/popup_inline_error_above_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/popup_inline_error_holo_dark.9.png b/core/res/res/drawable-mdpi/popup_inline_error_holo_dark.9.png
index 66c2c09..4092728 100755
--- a/core/res/res/drawable-mdpi/popup_inline_error_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/popup_inline_error_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/popup_inline_error_holo_light.9.png b/core/res/res/drawable-mdpi/popup_inline_error_holo_light.9.png
index c5113f2..67a2cd4 100755
--- a/core/res/res/drawable-mdpi/popup_inline_error_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/popup_inline_error_holo_light.9.png
Binary files differ
diff --git a/core/res/res/layout/textview_hint.xml b/core/res/res/layout/textview_hint.xml
index f9c4406..b94dfc9 100644
--- a/core/res/res/layout/textview_hint.xml
+++ b/core/res/res/layout/textview_hint.xml
@@ -18,5 +18,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="@color/primary_text_light"
+ android:textColor="?android:attr/textColorPrimaryInverse"
/>
diff --git a/core/res/res/raw/fallbackring.ogg b/core/res/res/raw/fallbackring.ogg
old mode 100644
new mode 100755
index 0cbf55d..a9adeb8
--- a/core/res/res/raw/fallbackring.ogg
+++ b/core/res/res/raw/fallbackring.ogg
Binary files differ
diff --git a/data/fonts/DroidSansFallback.ttf b/data/fonts/DroidSansFallback.ttf
index 206621f..8c6fabe 100644
--- a/data/fonts/DroidSansFallback.ttf
+++ b/data/fonts/DroidSansFallback.ttf
Binary files differ
diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java
index 4c659d4..1fc2722 100644
--- a/graphics/java/android/graphics/SurfaceTexture.java
+++ b/graphics/java/android/graphics/SurfaceTexture.java
@@ -32,6 +32,17 @@
* updated to contain the most recent image from the image stream. This may cause some frames of
* the stream to be skipped.
*
+ * <p>When sampling from the texture one should first transform the texture coordinates using the
+ * matrix queried via {@link #getTransformMatrix}. The transform matrix may change each time {@link
+ * #updateTexImage} is called, so it should be re-queried each time the texture image is updated.
+ * This matrix transforms traditional 2D OpenGL ES texture coordinate column vectors of the form (s,
+ * t, 0, 1) where s and t are on the inclusive interval [0, 1] to the proper sampling location in
+ * the streamed texture. This transform compensates for any properties of the image stream source
+ * that cause it to appear different from a traditional OpenGL ES texture. For example, sampling
+ * from the bottom left corner of the image can be accomplished by transforming the column vector
+ * (0, 0, 0, 1) using the queried matrix, while sampling from the top right corner of the image can
+ * be done by transforming (1, 1, 0, 1).
+ *
* <p>The texture object uses the GL_TEXTURE_EXTERNAL_OES texture target, which is defined by the
* OES_EGL_image_external OpenGL ES extension. This limits how the texture may be used.
*
diff --git a/media/java/android/media/videoeditor/AudioTrack.java b/media/java/android/media/videoeditor/AudioTrack.java
index 9e68a5d..eeace13 100755
--- a/media/java/android/media/videoeditor/AudioTrack.java
+++ b/media/java/android/media/videoeditor/AudioTrack.java
@@ -267,14 +267,16 @@
throw new IllegalArgumentException("Volume set exceeds maximum allowed value");
}
- if (volumePercent < 0) {
+ if (volumePercent < 0) {
throw new IllegalArgumentException("Invalid Volume ");
}
- mVolumePercent = volumePercent;
+
/**
* Force update of preview settings
*/
mMANativeHelper.setGeneratePreview(true);
+
+ mVolumePercent = volumePercent;
}
/**
@@ -294,11 +296,11 @@
* the volume of this Audio Track to 0.
*/
public void setMute(boolean muted) {
- mMuted = muted;
/**
* Force update of preview settings
*/
mMANativeHelper.setGeneratePreview(true);
+ mMuted = muted;
}
/**
@@ -363,14 +365,15 @@
throw new IllegalArgumentException("Invalid end time; is < 0");
}
- mBeginBoundaryTimeMs = beginMs;
- mEndBoundaryTimeMs = endMs;
-
- mTimelineDurationMs = mEndBoundaryTimeMs - mBeginBoundaryTimeMs;
/**
* Force update of preview settings
*/
mMANativeHelper.setGeneratePreview(true);
+
+ mBeginBoundaryTimeMs = beginMs;
+ mEndBoundaryTimeMs = endMs;
+
+ mTimelineDurationMs = mEndBoundaryTimeMs - mBeginBoundaryTimeMs;
}
/**
@@ -412,11 +415,11 @@
*/
public void disableLoop() {
if (mLoop) {
- mLoop = false;
/**
* Force update of preview settings
*/
mMANativeHelper.setGeneratePreview(true);
+ mLoop = false;
}
}
@@ -434,11 +437,11 @@
*/
public void disableDucking() {
if (mIsDuckingEnabled) {
- mIsDuckingEnabled = false;
/**
* Force update of preview settings
*/
mMANativeHelper.setGeneratePreview(true);
+ mIsDuckingEnabled = false;
}
}
@@ -462,13 +465,14 @@
+ duckedTrackVolume);
}
- mDuckingThreshold = threshold;
- mDuckedTrackVolume = duckedTrackVolume;
- mIsDuckingEnabled = true;
/**
* Force update of preview settings
*/
mMANativeHelper.setGeneratePreview(true);
+
+ mDuckingThreshold = threshold;
+ mDuckedTrackVolume = duckedTrackVolume;
+ mIsDuckingEnabled = true;
}
/**
diff --git a/media/java/android/media/videoeditor/Effect.java b/media/java/android/media/videoeditor/Effect.java
index 3362d47..c6b0839 100755
--- a/media/java/android/media/videoeditor/Effect.java
+++ b/media/java/android/media/videoeditor/Effect.java
@@ -105,8 +105,7 @@
final long oldDurationMs = mDurationMs;
mDurationMs = durationMs;
- mMediaItem.invalidateTransitions(mStartTimeMs, oldDurationMs,
- mStartTimeMs, mDurationMs);
+ mMediaItem.invalidateTransitions(mStartTimeMs, oldDurationMs, mStartTimeMs, mDurationMs);
}
/**
@@ -130,11 +129,11 @@
throw new IllegalArgumentException("Start time is too large");
}
+ getMediaItem().getNativeContext().setGeneratePreview(true);
final long oldStartTimeMs = mStartTimeMs;
mStartTimeMs = startTimeMs;
- mMediaItem.invalidateTransitions(oldStartTimeMs, mDurationMs,
- mStartTimeMs, mDurationMs);
+ mMediaItem.invalidateTransitions(oldStartTimeMs, mDurationMs, mStartTimeMs, mDurationMs);
}
/**
@@ -163,8 +162,7 @@
mStartTimeMs = startTimeMs;
mDurationMs = durationMs;
- mMediaItem.invalidateTransitions(oldStartTimeMs, oldDurationMs,
- mStartTimeMs, mDurationMs);
+ mMediaItem.invalidateTransitions(oldStartTimeMs, oldDurationMs, mStartTimeMs, mDurationMs);
}
/**
diff --git a/media/java/android/media/videoeditor/MediaArtistNativeHelper.java b/media/java/android/media/videoeditor/MediaArtistNativeHelper.java
index 27ea3c0..ba9403d 100644
--- a/media/java/android/media/videoeditor/MediaArtistNativeHelper.java
+++ b/media/java/android/media/videoeditor/MediaArtistNativeHelper.java
@@ -20,9 +20,10 @@
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.IntBuffer;
-import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.concurrent.Semaphore;
+
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@@ -39,22 +40,29 @@
*This class provide Native methods to be used by MediaArtist {@hide}
*/
class MediaArtistNativeHelper {
+ private static final String TAG = "MediaArtistNativeHelper";
static {
System.loadLibrary("videoeditor_jni");
}
- private final int MAX_THUMBNAIL_PERMITTED = 8;
+ private static final int MAX_THUMBNAIL_PERMITTED = 8;
+
+ public static final int TASK_LOADING_SETTINGS = 1;
+ public static final int TASK_ENCODING = 2;
+
+ /**
+ * The resize paint
+ */
+ private static final Paint sResizePaint = new Paint(Paint.FILTER_BITMAP_FLAG);
private final VideoEditor mVideoEditor;
- public EditSettings mStoryBoardSettings;
+ private EditSettings mStoryBoardSettings;
private String mOutputFilename;
- EditSettings mEditSettings = null;
-
- PreviewClipProperties mClipProperties = null;
+ private PreviewClipProperties mClipProperties = null;
private EditSettings mPreviewEditSettings;
@@ -62,30 +70,24 @@
private AudioTrack mAudioTrack = null;
- public boolean mInvalidatePreviewArray = true;
+ private boolean mInvalidatePreviewArray = true;
private boolean mRegenerateAudio = true;
private String mExportFilename = null;
- private boolean mExportDone = false;
-
private int mProgressToApp;
- /**
- * The resize paint
+ /*
+ * Semaphore to control preview calls
*/
- private static final Paint sResizePaint = new Paint(Paint.FILTER_BITMAP_FLAG);
+ private final Semaphore mLock = new Semaphore(1, true);
private String mRenderPreviewOverlayFile;
- private int mRenderPreviewRenderingMode;
+ private int mRenderPreviewRenderingMode;
private boolean mIsFirstProgress;
- public static final int TASK_LOADING_SETTINGS = 1;
-
- public static final int TASK_ENCODING = 2;
-
private static final String AUDIO_TRACK_PCM_FILE = "AudioPcm.pcm";
// Processing indication
@@ -98,33 +100,25 @@
public static final int PROCESSING_INTERMEDIATE3 = 13;
public static final int PROCESSING_EXPORT = 20;
- private int mProcessingState;
+ private int mProcessingState;
private Object mProcessingObject;
-
private PreviewProgressListener mPreviewProgressListener;
private ExportProgressListener mExportProgressListener;
private ExtractAudioWaveformProgressListener mExtractAudioWaveformProgressListener;
- private MediaProcessingProgressListener mMediaProcessingProgressListener;
+ private MediaProcessingProgressListener mMediaProcessingProgressListener;
private final String mProjectPath;
private long mPreviewProgress;
private String mAudioTrackPCMFilePath;
- int mTotalClips = 0;
-
- int mPreviewEffectsSize = 0;
+ private int mTotalClips = 0;
private boolean mErrorFlagSet = false;
@SuppressWarnings("unused")
private int mManualEditContext;
-
- List<Effect> mMediaEffectList;
-
- List<Overlay> mMediaOverLayList;
-
/* Listeners */
/**
@@ -763,7 +757,6 @@
/** Internal error. */
public static final int ERR_INTERNAL = 255;
-
}
/**
@@ -1203,9 +1196,8 @@
}
/**
- * Defines transition behaviours.
- **/
-
+ * Defines transition behaviors.
+ */
public static final class TransitionBehaviour {
/** The transition uses an increasing speed. */
@@ -1230,7 +1222,9 @@
public static final int FAST_MIDDLE = 4;
}
- /** Defines settings for the background music. */
+ /**
+ * Defines settings for the background music.
+ */
public static class BackgroundMusicSettings {
/** Background music file. */
@@ -1273,7 +1267,6 @@
public int lowVolume;
public boolean isLooping;
-
}
/** Defines settings for an effect. */
@@ -1568,7 +1561,6 @@
boolean bInDucking_enable;
String pcmFilePath;
-
}
/** Encapsulates preview clips and effect settings */
@@ -1775,7 +1767,6 @@
public int audioVolumeValue;
public String Id;
-
}
/**
@@ -1796,8 +1787,6 @@
if (mStoryBoardSettings == null)
mStoryBoardSettings = new EditSettings();
- mMediaEffectList = new ArrayList<Effect>();
- mMediaOverLayList = new ArrayList<Overlay>();
_init(mProjectPath, "null");
mAudioTrackPCMFilePath = null;
}
@@ -1879,7 +1868,7 @@
case PROCESSING_NONE:
default:
- Log.e("MediaArtistNativeHelper", "ERROR unexpected State=" + mProcessingState);
+ Log.e(TAG, "ERROR unexpected State=" + mProcessingState);
return;
}
if ((mProgressToApp != actualProgress) && (actualProgress != 0)) {
@@ -1888,8 +1877,7 @@
if (mMediaProcessingProgressListener != null) {
// Send the progress indication
- mMediaProcessingProgressListener.onProgress(mProcessingObject,
- action,
+ mMediaProcessingProgressListener.onProgress(mProcessingObject, action,
actualProgress);
}
}
@@ -1899,8 +1887,7 @@
/*
* Send the progress indication
*/
- mMediaProcessingProgressListener.onProgress(mProcessingObject,
- action,
+ mMediaProcessingProgressListener.onProgress(mProcessingObject, action,
actualProgress);
}
mProgressToApp = 1;
@@ -1944,15 +1931,14 @@
/**
* Release the native helper object
*/
- public void releaseNativeHelper() {
+ void releaseNativeHelper() {
try {
release();
} catch (IllegalStateException ex) {
- Log.e("MediaArtistNativeHelper",
- "Illegal State exeption caught in releaseNativeHelper");
+ Log.e(TAG, "Illegal State exeption caught in releaseNativeHelper");
throw ex;
} catch (RuntimeException ex) {
- Log.e("MediaArtistNativeHelper", "Runtime exeption caught in releaseNativeHelper");
+ Log.e(TAG, "Runtime exeption caught in releaseNativeHelper");
throw ex;
}
}
@@ -1962,9 +1948,7 @@
*/
@SuppressWarnings("unused")
private void onAudioGraphExtractProgressUpdate(int progress, boolean isVideo) {
-
- if ((mExtractAudioWaveformProgressListener != null) && (progress > 0))
- {
+ if ((mExtractAudioWaveformProgressListener != null) && (progress > 0)) {
mExtractAudioWaveformProgressListener.onProgress(progress);
}
}
@@ -1974,8 +1958,7 @@
*
* @param effects The reference of EffectColor
*
- * @return The populated effect settings in EffectSettings
- * reference
+ * @return The populated effect settings in EffectSettings reference
*/
EffectSettings getEffectSettings(EffectColor effects) {
EffectSettings effectSettings = new EffectSettings();
@@ -2017,8 +2000,7 @@
*
* @param overlay The reference of OverlayFrame
*
- * @return The populated overlay settings in EffectSettings
- * reference
+ * @return The populated overlay settings in EffectSettings reference
*/
EffectSettings getOverlaySettings(OverlayFrame overlay) {
EffectSettings effectSettings = new EffectSettings();
@@ -2039,7 +2021,7 @@
try {
(overlay).save(mProjectPath);
} catch (IOException e) {
- Log.e("MediaArtistNativeHelper","getOverlaySettings : File not found");
+ Log.e(TAG, "getOverlaySettings : File not found");
}
effectSettings.framingFile = overlay.getFilename();
}
@@ -2098,13 +2080,12 @@
int aspectRatio;
if (overlay.getMediaItem() instanceof MediaImageItem) {
if (((MediaImageItem)overlay.getMediaItem()).getGeneratedImageClip() != null) {
- //Kenburns was applied
+ // Ken Burns was applied
mediaItemHeight = ((MediaImageItem)overlay.getMediaItem()).getGeneratedClipHeight();
aspectRatio = getAspectRatio(
((MediaImageItem)overlay.getMediaItem()).getGeneratedClipWidth()
, mediaItemHeight);
- }
- else {
+ } else {
//For image get the scaled height. Aspect ratio would remain the same
mediaItemHeight = ((MediaImageItem)overlay.getMediaItem()).getScaledHeight();
aspectRatio = overlay.getMediaItem().getAspectRatio();
@@ -2148,7 +2129,7 @@
*
* @return The frame rate from one of the defined enum values
*/
- public int GetClosestVideoFrameRate(int averageFrameRate) {
+ int GetClosestVideoFrameRate(int averageFrameRate) {
if (averageFrameRate >= 25) {
return VideoFrameRate.FR_30_FPS;
} else if (averageFrameRate >= 20) {
@@ -2172,8 +2153,7 @@
* Helper function to adjust the effect or overlay start time
* depending on the begin and end boundary time of meddia item
*/
- public void adjustEffectsStartTimeAndDuration(EffectSettings lEffect,
- int beginCutTime,
+ public void adjustEffectsStartTimeAndDuration(EffectSettings lEffect, int beginCutTime,
int endCutTime) {
int effectStartTime = 0;
@@ -2271,20 +2251,20 @@
try {
err = nativeGenerateClip(editSettings);
} catch (IllegalArgumentException ex) {
- Log.e("MediaArtistNativeHelper","Illegal Argument exception in load settings");
+ Log.e(TAG, "Illegal Argument exception in load settings");
return -1;
} catch (IllegalStateException ex) {
- Log.e("MediaArtistNativeHelper","Illegal state exception in load settings");
+ Log.e(TAG, "Illegal state exception in load settings");
return -1;
} catch (RuntimeException ex) {
- Log.e("MediaArtistNativeHelper", "Runtime exception in load settings");
+ Log.e(TAG, "Runtime exception in load settings");
return -1;
}
return err;
}
/**
- * Init function to initialise the ClipSettings reference to
+ * Init function to initialiZe the ClipSettings reference to
* default values
*
* @param lclipSettings The ClipSettings reference
@@ -2357,9 +2337,8 @@
//editSettings.videoFormat = VideoFormat.MPEG4;
editSettings.videoFormat = VideoFormat.H264;
editSettings.videoFrameRate = VideoFrameRate.FR_30_FPS;
- editSettings.videoFrameSize = findVideoResolution(mVideoEditor.getAspectRatio(), m
- .getHeight());
-
+ editSettings.videoFrameSize = findVideoResolution(mVideoEditor.getAspectRatio(),
+ m.getHeight());
} else {
MediaImageItem m = (MediaImageItem)lMediaItem;
editSettings.audioBitrate = Bitrate.BR_64_KBPS;
@@ -2370,8 +2349,8 @@
editSettings.videoBitrate = Bitrate.BR_5_MBPS;
editSettings.videoFormat = VideoFormat.H264;
editSettings.videoFrameRate = VideoFrameRate.FR_30_FPS;
- editSettings.videoFrameSize = findVideoResolution(mVideoEditor.getAspectRatio(), m
- .getScaledHeight());
+ editSettings.videoFrameSize = findVideoResolution(mVideoEditor.getAspectRatio(),
+ m.getScaledHeight());
}
editSettings.outputFile = EffectClipPath;
@@ -2466,11 +2445,9 @@
clip2Height = ((MediaImageItem)m2).getScaledHeight();
}
if (clip1Height > clip2Height) {
- videoSize = findVideoResolution(mVideoEditor.getAspectRatio(),
- clip1Height);
+ videoSize = findVideoResolution(mVideoEditor.getAspectRatio(), clip1Height);
} else {
- videoSize = findVideoResolution(mVideoEditor.getAspectRatio(),
- clip2Height);
+ videoSize = findVideoResolution(mVideoEditor.getAspectRatio(), clip2Height);
}
} else if (m1 == null && m2 != null) {
if (m2 instanceof MediaVideoItem) {
@@ -2478,16 +2455,14 @@
} else if (m2 instanceof MediaImageItem) {
clip2Height = ((MediaImageItem)m2).getScaledHeight();
}
- videoSize = findVideoResolution(mVideoEditor.getAspectRatio(),
- clip2Height);
+ videoSize = findVideoResolution(mVideoEditor.getAspectRatio(), clip2Height);
} else if (m1 != null && m2 == null) {
if (m1 instanceof MediaVideoItem) {
clip1Height = m1.getHeight();
} else if (m1 instanceof MediaImageItem) {
clip1Height = ((MediaImageItem)m1).getScaledHeight();
}
- videoSize = findVideoResolution(mVideoEditor.getAspectRatio(),
- clip1Height);
+ videoSize = findVideoResolution(mVideoEditor.getAspectRatio(), clip1Height);
}
return videoSize;
}
@@ -2542,7 +2517,7 @@
*
* @param m1 Media item associated with effect
* @param effectSettings The EffectSettings reference containing
- * effect specific data
+ * effect specific data
* @param beginCutTime The begin cut time of the clip associated with effect
* @param endCutTime The end cut time of the clip associated with effect
* @param storyBoardTime The current story board time
@@ -2551,8 +2526,6 @@
*/
private int populateEffects(MediaItem m, EffectSettings[] effectSettings, int i,
int beginCutTime, int endCutTime, int storyBoardTime) {
- List<Effect> effects = m.getAllEffects();
- List<Overlay> overlays = m.getAllOverlays();
if (m.getBeginTransition() != null && m.getBeginTransition().getDuration() > 0
&& m.getEndTransition() != null && m.getEndTransition().getDuration() > 0) {
@@ -2566,19 +2539,20 @@
beginCutTime += m.getBeginTransition().getDuration();
}
+ final List<Effect> effects = m.getAllEffects();
+ final List<Overlay> overlays = m.getAllOverlays();
for (Effect effect : effects) {
if (effect instanceof EffectColor) {
effectSettings[i] = getEffectSettings((EffectColor)effect);
- adjustEffectsStartTimeAndDuration(effectSettings[i],
- beginCutTime, endCutTime);
+ adjustEffectsStartTimeAndDuration(effectSettings[i], beginCutTime, endCutTime);
effectSettings[i].startTime += storyBoardTime;
i++;
}
}
+
for (Overlay overlay : overlays) {
effectSettings[i] = getOverlaySettings((OverlayFrame)overlay);
- adjustEffectsStartTimeAndDuration(effectSettings[i],
- beginCutTime, endCutTime);
+ adjustEffectsStartTimeAndDuration(effectSettings[i], beginCutTime, endCutTime);
effectSettings[i].startTime += storyBoardTime;
i++;
}
@@ -2596,31 +2570,24 @@
Properties clipProperties, MediaItem m) {
if (m.getBeginTransition() != null && m.getBeginTransition().getDuration() > 0
&& m.getEndTransition() != null && m.getEndTransition().getDuration() > 0) {
-
clipSettings.beginCutTime += m.getBeginTransition().getDuration();
clipSettings.endCutTime -= m.getEndTransition().getDuration();
-
} else if (m.getBeginTransition() == null && m.getEndTransition() != null
&& m.getEndTransition().getDuration() > 0) {
-
clipSettings.endCutTime -= m.getEndTransition().getDuration();
-
} else if (m.getEndTransition() == null && m.getBeginTransition() != null
&& m.getBeginTransition().getDuration() > 0) {
-
clipSettings.beginCutTime += m.getBeginTransition().getDuration();
}
- clipProperties.duration = clipSettings.endCutTime -
- clipSettings.beginCutTime;
+
+ clipProperties.duration = clipSettings.endCutTime - clipSettings.beginCutTime;
if (clipProperties.videoDuration != 0) {
- clipProperties.videoDuration = clipSettings.endCutTime -
- clipSettings.beginCutTime;
+ clipProperties.videoDuration = clipSettings.endCutTime - clipSettings.beginCutTime;
}
if (clipProperties.audioDuration != 0) {
- clipProperties.audioDuration = clipSettings.endCutTime -
- clipSettings.beginCutTime;
+ clipProperties.audioDuration = clipSettings.endCutTime - clipSettings.beginCutTime;
}
}
@@ -2642,27 +2609,25 @@
editSettings.clipSettingsArray[index].clipPath = transition.getFilename();
editSettings.clipSettingsArray[index].fileType = FileType.THREE_GPP;
editSettings.clipSettingsArray[index].beginCutTime = 0;
- editSettings.clipSettingsArray[index].endCutTime =
- (int)transition.getDuration();
- editSettings.clipSettingsArray[index].mediaRendering =
- MediaRendering.BLACK_BORDERS;
+ editSettings.clipSettingsArray[index].endCutTime = (int)transition.getDuration();
+ editSettings.clipSettingsArray[index].mediaRendering = MediaRendering.BLACK_BORDERS;
+
try {
clipPropertiesArray.clipProperties[index] =
- getMediaProperties(transition.getFilename());
+ getMediaProperties(transition.getFilename());
} catch (Exception e) {
throw new IllegalArgumentException("Unsupported file or file not found");
}
+
clipPropertiesArray.clipProperties[index].Id = null;
clipPropertiesArray.clipProperties[index].audioVolumeValue = 100;
- clipPropertiesArray.clipProperties[index].duration =
- (int)transition.getDuration();
+ clipPropertiesArray.clipProperties[index].duration = (int)transition.getDuration();
if (clipPropertiesArray.clipProperties[index].videoDuration != 0) {
- clipPropertiesArray.clipProperties[index].videoDuration =
- (int)transition.getDuration();
+ clipPropertiesArray.clipProperties[index].videoDuration = (int)transition.getDuration();
}
+
if (clipPropertiesArray.clipProperties[index].audioDuration != 0) {
- clipPropertiesArray.clipProperties[index].audioDuration =
- (int)transition.getDuration();
+ clipPropertiesArray.clipProperties[index].audioDuration = (int)transition.getDuration();
}
}
@@ -2676,10 +2641,10 @@
private void adjustVolume(MediaItem m, PreviewClipProperties clipProperties,
int index) {
if (m instanceof MediaVideoItem) {
- boolean videoMuted = ((MediaVideoItem)m).isMuted();
+ final boolean videoMuted = ((MediaVideoItem)m).isMuted();
if (videoMuted == false) {
- mClipProperties.clipProperties[index].audioVolumeValue = ((MediaVideoItem)m)
- .getVolume();
+ mClipProperties.clipProperties[index].audioVolumeValue =
+ ((MediaVideoItem)m).getVolume();
} else {
mClipProperties.clipProperties[index].audioVolumeValue = 0;
}
@@ -2725,22 +2690,22 @@
private int populateMediaItemProperties(MediaItem m, int index, int maxHeight) {
mPreviewEditSettings.clipSettingsArray[index] = new ClipSettings();
if (m instanceof MediaVideoItem) {
- mPreviewEditSettings.clipSettingsArray[index] = ((MediaVideoItem)m)
- .getVideoClipProperties();
+ mPreviewEditSettings.clipSettingsArray[index] =
+ ((MediaVideoItem)m).getVideoClipProperties();
if (((MediaVideoItem)m).getHeight() > maxHeight) {
maxHeight = ((MediaVideoItem)m).getHeight();
}
} else if (m instanceof MediaImageItem) {
- mPreviewEditSettings.clipSettingsArray[index] = ((MediaImageItem)m)
- .getImageClipProperties();
+ mPreviewEditSettings.clipSettingsArray[index] =
+ ((MediaImageItem)m).getImageClipProperties();
if (((MediaImageItem)m).getScaledHeight() > maxHeight) {
maxHeight = ((MediaImageItem)m).getScaledHeight();
}
}
/** + Handle the image files here */
if (mPreviewEditSettings.clipSettingsArray[index].fileType == FileType.JPG) {
- mPreviewEditSettings.clipSettingsArray[index].clipDecodedPath = ((MediaImageItem)m)
- .getDecodedImageFileName();
+ mPreviewEditSettings.clipSettingsArray[index].clipDecodedPath =
+ ((MediaImageItem)m).getDecodedImageFileName();
mPreviewEditSettings.clipSettingsArray[index].clipOriginalPath =
mPreviewEditSettings.clipSettingsArray[index].clipPath;
@@ -2758,8 +2723,7 @@
if (mediaBGMList.size() == 1) {
mAudioTrack = mediaBGMList.get(0);
- } else
- {
+ } else {
mAudioTrack = null;
}
@@ -2792,41 +2756,31 @@
mAudioSettings.ducking_threshold = mAudioTrack.getDuckingThreshhold();
mAudioSettings.bInDucking_enable = mAudioTrack.isDuckingEnabled();
mAudioTrackPCMFilePath = String.format(mProjectPath + "/" + AUDIO_TRACK_PCM_FILE);
- //String.format(mProjectPath + "/" + "AudioPcm" + ".pcm");
mAudioSettings.pcmFilePath = mAudioTrackPCMFilePath;
- mPreviewEditSettings.backgroundMusicSettings =
- new BackgroundMusicSettings();
- mPreviewEditSettings.backgroundMusicSettings.file =
- mAudioTrackPCMFilePath;
- mPreviewEditSettings.backgroundMusicSettings.fileType =
- mAudioProperties.fileType;
+ mPreviewEditSettings.backgroundMusicSettings = new BackgroundMusicSettings();
+ mPreviewEditSettings.backgroundMusicSettings.file = mAudioTrackPCMFilePath;
+ mPreviewEditSettings.backgroundMusicSettings.fileType = mAudioProperties.fileType;
mPreviewEditSettings.backgroundMusicSettings.insertionTime =
- mAudioTrack.getStartTime();
- mPreviewEditSettings.backgroundMusicSettings.volumePercent =
- mAudioTrack.getVolume();
- mPreviewEditSettings.backgroundMusicSettings.beginLoop = mAudioTrack
- .getBoundaryBeginTime();
+ mAudioTrack.getStartTime();
+ mPreviewEditSettings.backgroundMusicSettings.volumePercent = mAudioTrack.getVolume();
+ mPreviewEditSettings.backgroundMusicSettings.beginLoop =
+ mAudioTrack.getBoundaryBeginTime();
mPreviewEditSettings.backgroundMusicSettings.endLoop =
mAudioTrack.getBoundaryEndTime();
- mPreviewEditSettings.backgroundMusicSettings.enableDucking = mAudioTrack
- .isDuckingEnabled();
- mPreviewEditSettings.backgroundMusicSettings.duckingThreshold = mAudioTrack
- .getDuckingThreshhold();
- mPreviewEditSettings.backgroundMusicSettings.lowVolume = mAudioTrack
- .getDuckedTrackVolume();
- mPreviewEditSettings.backgroundMusicSettings.isLooping =
- mAudioTrack.isLooping();
+ mPreviewEditSettings.backgroundMusicSettings.enableDucking =
+ mAudioTrack.isDuckingEnabled();
+ mPreviewEditSettings.backgroundMusicSettings.duckingThreshold =
+ mAudioTrack.getDuckingThreshhold();
+ mPreviewEditSettings.backgroundMusicSettings.lowVolume =
+ mAudioTrack.getDuckedTrackVolume();
+ mPreviewEditSettings.backgroundMusicSettings.isLooping = mAudioTrack.isLooping();
mPreviewEditSettings.primaryTrackVolume = 100;
mProcessingState = PROCESSING_AUDIO_PCM;
mProcessingObject = mAudioTrack;
} else {
- if (mAudioSettings != null) {
- mAudioSettings = null;
- }
- if (mPreviewEditSettings.backgroundMusicSettings != null) {
- mPreviewEditSettings.backgroundMusicSettings = null;
- }
+ mAudioSettings = null;
+ mPreviewEditSettings.backgroundMusicSettings = null;
mAudioTrackPCMFilePath = null;
}
}
@@ -2850,8 +2804,9 @@
final Iterator<Effect> ef = t.getAllEffects().iterator();
while (ef.hasNext()) {
final Effect e = ef.next();
- if (e instanceof EffectKenBurns)
+ if (e instanceof EffectKenBurns) {
totalEffects--;
+ }
}
}
return totalEffects;
@@ -2869,7 +2824,7 @@
* @param listener The MediaProcessingProgressListener
*
*/
- public void previewStoryBoard(List<MediaItem> mediaItemsList,
+ void previewStoryBoard(List<MediaItem> mediaItemsList,
List<Transition> mediaTransitionList, List<AudioTrack> mediaBGMList,
MediaProcessingProgressListener listener) {
if (mInvalidatePreviewArray) {
@@ -2888,8 +2843,9 @@
mTotalClips = mediaItemsList.size();
for (Transition transition : mediaTransitionList) {
- if (transition.getDuration() > 0)
+ if (transition.getDuration() > 0) {
mTotalClips++;
+ }
}
totalEffects = getTotalEffects(mediaItemsList);
@@ -2898,7 +2854,7 @@
mPreviewEditSettings.effectSettingsArray = new EffectSettings[totalEffects];
mClipProperties.clipProperties = new Properties[mTotalClips];
- /** record the call back progress listner */
+ /** record the call back progress listener */
mMediaProcessingProgressListener = listener;
mProgressToApp = 0;
@@ -2923,19 +2879,16 @@
previewIndex++;
}
/* Populate media item properties */
- maxHeight = populateMediaItemProperties(lMediaItem,
- previewIndex,
- maxHeight);
+ maxHeight = populateMediaItemProperties(lMediaItem, previewIndex, maxHeight);
/* Get the clip properties of the media item. */
- if (lMediaItem instanceof MediaImageItem)
- {
+ if (lMediaItem instanceof MediaImageItem) {
int tmpCnt = 0;
boolean bEffectKbPresent = false;
- List<Effect> effectList = lMediaItem.getAllEffects();
+ final List<Effect> effectList = lMediaItem.getAllEffects();
/**
- * check if Kenburns effect is present
+ * Check if Ken Burns effect is present
*/
- while ( tmpCnt < effectList.size()) {
+ while (tmpCnt < effectList.size()) {
if (effectList.get(tmpCnt) instanceof EffectKenBurns) {
bEffectKbPresent = true;
break;
@@ -2960,9 +2913,7 @@
mClipProperties.clipProperties[previewIndex].width = ((MediaImageItem)lMediaItem).getScaledWidth();
mClipProperties.clipProperties[previewIndex].height = ((MediaImageItem)lMediaItem).getScaledHeight();
}
-
- }else
- {
+ } else {
try {
mClipProperties.clipProperties[previewIndex]
= getMediaProperties(lMediaItem.getFilename());
@@ -3008,22 +2959,19 @@
if (!mErrorFlagSet) {
mPreviewEditSettings.videoFrameSize = findVideoResolution(mVideoEditor
.getAspectRatio(), maxHeight);
- /*if (mediaBGMList.size() == 1) //for remove Audio check */ {
- populateBackgroundMusicProperties(mediaBGMList);
- }
+ populateBackgroundMusicProperties(mediaBGMList);
+
/** call to native populate settings */
try {
nativePopulateSettings(mPreviewEditSettings, mClipProperties, mAudioSettings);
} catch (IllegalArgumentException ex) {
- Log.e("MediaArtistNativeHelper",
- "Illegal argument exception in nativePopulateSettings");
+ Log.e(TAG, "Illegal argument exception in nativePopulateSettings");
throw ex;
} catch (IllegalStateException ex) {
- Log.e("MediaArtistNativeHelper",
- "Illegal state exception in nativePopulateSettings");
+ Log.e(TAG, "Illegal state exception in nativePopulateSettings");
throw ex;
} catch (RuntimeException ex) {
- Log.e("MediaArtistNativeHelper", "Runtime exception in nativePopulateSettings");
+ Log.e(TAG, "Runtime exception in nativePopulateSettings");
throw ex;
}
mInvalidatePreviewArray = false;
@@ -3048,7 +2996,7 @@
* the callback is needed
* @param listener The PreviewProgressListener
*/
- public void doPreview(Surface surface, long fromMs, long toMs, boolean loop,
+ void doPreview(Surface surface, long fromMs, long toMs, boolean loop,
int callbackAfterFrameCount, PreviewProgressListener listener) {
mPreviewProgress = fromMs;
mIsFirstProgress = true;
@@ -3057,22 +3005,23 @@
if (!mInvalidatePreviewArray) {
try {
/** Modify the image files names to rgb image files. */
- for (int clipCnt = 0; clipCnt < mPreviewEditSettings.clipSettingsArray.length; clipCnt++) {
+ for (int clipCnt = 0; clipCnt < mPreviewEditSettings.clipSettingsArray.length;
+ clipCnt++) {
if (mPreviewEditSettings.clipSettingsArray[clipCnt].fileType == FileType.JPG) {
- mPreviewEditSettings.clipSettingsArray[clipCnt].clipPath = mPreviewEditSettings.clipSettingsArray[clipCnt].clipDecodedPath;
+ mPreviewEditSettings.clipSettingsArray[clipCnt].clipPath =
+ mPreviewEditSettings.clipSettingsArray[clipCnt].clipDecodedPath;
}
}
nativePopulateSettings(mPreviewEditSettings, mClipProperties, mAudioSettings);
nativeStartPreview(surface, fromMs, toMs, callbackAfterFrameCount, loop);
} catch (IllegalArgumentException ex) {
- Log.e("MediaArtistNativeHelper",
- "Illegal argument exception in nativeStartPreview");
+ Log.e(TAG, "Illegal argument exception in nativeStartPreview");
throw ex;
} catch (IllegalStateException ex) {
- Log.e("MediaArtistNativeHelper", "Illegal state exception in nativeStartPreview");
+ Log.e(TAG, "Illegal state exception in nativeStartPreview");
throw ex;
} catch (RuntimeException ex) {
- Log.e("MediaArtistNativeHelper", "Runtime exception in nativeStartPreview");
+ Log.e(TAG, "Runtime exception in nativeStartPreview");
throw ex;
}
}
@@ -3081,7 +3030,7 @@
/**
* This function is responsible for stopping the preview
*/
- public long stopPreview() {
+ long stopPreview() {
nativeStopPreview();
return mPreviewProgress;
}
@@ -3099,48 +3048,48 @@
* @return The actual time from the story board at which the frame was extracted
* and rendered
*/
- public long renderPreviewFrame(Surface surface, long time, int surfaceWidth,
+ long renderPreviewFrame(Surface surface, long time, int surfaceWidth,
int surfaceHeight, VideoEditor.OverlayData overlayData) {
- long timeMs = 0;
- if (!mInvalidatePreviewArray) {
- try {
- for (int clipCnt = 0;
- clipCnt < mPreviewEditSettings.clipSettingsArray.length;
- clipCnt++) {
-
- if (mPreviewEditSettings.clipSettingsArray[clipCnt].fileType == FileType.JPG) {
- mPreviewEditSettings.clipSettingsArray[clipCnt].clipPath =
- mPreviewEditSettings.clipSettingsArray[clipCnt].clipDecodedPath;
- }
- }
-
- // Reset the render preview frame params that shall be set by native.
- mRenderPreviewOverlayFile = null;
- mRenderPreviewRenderingMode = MediaRendering.RESIZING;
- nativePopulateSettings(mPreviewEditSettings, mClipProperties, mAudioSettings);
- timeMs = (long)nativeRenderPreviewFrame(surface, time, surfaceWidth, surfaceHeight);
-
- if (mRenderPreviewOverlayFile != null) {
- overlayData.set(BitmapFactory.decodeFile(mRenderPreviewOverlayFile), mRenderPreviewRenderingMode);
- } else {
- overlayData.setClear();
- }
- } catch (IllegalArgumentException ex) {
- Log.e("MediaArtistNativeHelper",
- "Illegal Argument exception in nativeRenderPreviewFrame");
- throw ex;
- } catch (IllegalStateException ex) {
- Log.e("MediaArtistNativeHelper",
- "Illegal state exception in nativeRenderPreviewFrame");
- throw ex;
- } catch (RuntimeException ex) {
- Log.e("MediaArtistNativeHelper", "Runtime exception in nativeRenderPreviewFrame");
- throw ex;
- }
- return timeMs;
- } else {
+ if (mInvalidatePreviewArray) {
throw new RuntimeException("Call generate preview first");
}
+
+ long timeMs = 0;
+ try {
+ for (int clipCnt = 0; clipCnt < mPreviewEditSettings.clipSettingsArray.length;
+ clipCnt++) {
+ if (mPreviewEditSettings.clipSettingsArray[clipCnt].fileType == FileType.JPG) {
+ mPreviewEditSettings.clipSettingsArray[clipCnt].clipPath =
+ mPreviewEditSettings.clipSettingsArray[clipCnt].clipDecodedPath;
+ }
+ }
+
+ // Reset the render preview frame params that shall be set by native.
+ mRenderPreviewOverlayFile = null;
+ mRenderPreviewRenderingMode = MediaRendering.RESIZING;
+
+ nativePopulateSettings(mPreviewEditSettings, mClipProperties, mAudioSettings);
+
+ timeMs = (long)nativeRenderPreviewFrame(surface, time, surfaceWidth, surfaceHeight);
+
+ if (mRenderPreviewOverlayFile != null) {
+ overlayData.set(BitmapFactory.decodeFile(mRenderPreviewOverlayFile),
+ mRenderPreviewRenderingMode);
+ } else {
+ overlayData.setClear();
+ }
+ } catch (IllegalArgumentException ex) {
+ Log.e(TAG, "Illegal Argument exception in nativeRenderPreviewFrame");
+ throw ex;
+ } catch (IllegalStateException ex) {
+ Log.e(TAG, "Illegal state exception in nativeRenderPreviewFrame");
+ throw ex;
+ } catch (RuntimeException ex) {
+ Log.e(TAG, "Runtime exception in nativeRenderPreviewFrame");
+ throw ex;
+ }
+
+ return timeMs;
}
private void previewFrameEditInfo(String filename, int renderingMode) {
@@ -3162,24 +3111,20 @@
* @return The actual time from media item at which the frame was extracted
* and rendered
*/
- public long renderMediaItemPreviewFrame(Surface surface, String filepath,
- long time, int framewidth,
- int frameheight) {
+ long renderMediaItemPreviewFrame(Surface surface, String filepath,
+ long time, int framewidth, int frameheight) {
long timeMs = 0;
try {
-
timeMs = (long)nativeRenderMediaItemPreviewFrame(surface, filepath, framewidth,
frameheight, 0, 0, time);
} catch (IllegalArgumentException ex) {
- Log.e("MediaArtistNativeHelper",
- "Illegal Argument exception in renderMediaItemPreviewFrame");
+ Log.e(TAG, "Illegal Argument exception in renderMediaItemPreviewFrame");
throw ex;
} catch (IllegalStateException ex) {
- Log.e("MediaArtistNativeHelper",
- "Illegal state exception in renderMediaItemPreviewFrame");
+ Log.e(TAG, "Illegal state exception in renderMediaItemPreviewFrame");
throw ex;
} catch (RuntimeException ex) {
- Log.e("MediaArtistNativeHelper", "Runtime exception in renderMediaItemPreviewFrame");
+ Log.e(TAG, "Runtime exception in renderMediaItemPreviewFrame");
throw ex;
}
@@ -3191,7 +3136,18 @@
* and for generating the preview again
*/
void setGeneratePreview(boolean isRequired) {
- mInvalidatePreviewArray = isRequired;
+ boolean semAcquiredDone = false;
+ try {
+ lock();
+ semAcquiredDone = true;
+ mInvalidatePreviewArray = isRequired;
+ } catch (InterruptedException ex) {
+ Log.e(TAG, "Runtime exception in renderMediaItemPreviewFrame");
+ } finally {
+ if (semAcquiredDone) {
+ unlock();
+ }
+ }
}
/**
@@ -3210,7 +3166,7 @@
*
* @return The calculated aspect ratio
*/
- public int getAspectRatio(int w, int h) {
+ int getAspectRatio(int w, int h) {
double apRatio = (double)(w) / (double)(h);
BigDecimal bd = new BigDecimal(apRatio);
bd = bd.setScale(3, BigDecimal.ROUND_HALF_UP);
@@ -3238,7 +3194,7 @@
*
* @return The File type in JAVA layer
*/
- public int getFileType(int fileType) {
+ int getFileType(int fileType) {
int retValue = -1;
switch (fileType) {
case FileType.UNSUPPORTED:
@@ -3277,7 +3233,7 @@
*
* @return The video codec type in JAVA layer
*/
- public int getVideoCodecType(int codecType) {
+ int getVideoCodecType(int codecType) {
int retValue = -1;
switch (codecType) {
case VideoFormat.H263:
@@ -3305,7 +3261,7 @@
*
* @return The audio codec type in JAVA layer
*/
- public int getAudioCodecType(int codecType) {
+ int getAudioCodecType(int codecType) {
int retValue = -1;
switch (codecType) {
case AudioFormat.AMR_NB:
@@ -3331,7 +3287,7 @@
*
* @return The frame rate as integer
*/
- public int getFrameRate(int fps) {
+ int getFrameRate(int fps) {
int retValue = -1;
switch (fps) {
case VideoFrameRate.FR_5_FPS:
@@ -3536,7 +3492,7 @@
}
/**
- * Calculates videdo resolution for output clip
+ * Calculates video resolution for output clip
* based on clip's height and aspect ratio of storyboard
*
* @param aspectRatio The aspect ratio of story board
@@ -3580,8 +3536,7 @@
resolutions = MediaProperties.getSupportedResolutions(mVideoEditor.getAspectRatio());
// Get the highest resolution
maxResolution = resolutions[resolutions.length - 1];
- retValue = findVideoResolution(mVideoEditor.getAspectRatio(),
- maxResolution.second);
+ retValue = findVideoResolution(mVideoEditor.getAspectRatio(), maxResolution.second);
}
return retValue;
@@ -3595,12 +3550,12 @@
* @param height The height of clip
* @param bitrate The bitrate at which the movie should be exported
* @param mediaItemsList The media items list
- * @param mediaTransitionList The transitons list
+ * @param mediaTransitionList The transitions list
* @param mediaBGMList The background track list
* @param listener The ExportProgressListener
*
*/
- public void export(String filePath, String projectDir, int height, int bitrate,
+ void export(String filePath, String projectDir, int height, int bitrate,
List<MediaItem> mediaItemsList, List<Transition> mediaTransitionList,
List<AudioTrack> mediaBGMList, ExportProgressListener listener) {
@@ -3672,8 +3627,10 @@
mPreviewEditSettings.transitionSettingsArray = new TransitionSettings[mTotalClips - 1];
for (int index = 0; index < mTotalClips - 1; index++) {
mPreviewEditSettings.transitionSettingsArray[index] = new TransitionSettings();
- mPreviewEditSettings.transitionSettingsArray[index].videoTransitionType = VideoTransition.NONE;
- mPreviewEditSettings.transitionSettingsArray[index].audioTransitionType = AudioTransition.NONE;
+ mPreviewEditSettings.transitionSettingsArray[index].videoTransitionType =
+ VideoTransition.NONE;
+ mPreviewEditSettings.transitionSettingsArray[index].audioTransitionType =
+ AudioTransition.NONE;
}
for (int clipCnt = 0; clipCnt < mPreviewEditSettings.clipSettingsArray.length; clipCnt++) {
if (mPreviewEditSettings.clipSettingsArray[clipCnt].fileType == FileType.JPG) {
@@ -3690,191 +3647,39 @@
err = generateClip(mPreviewEditSettings);
mProcessingState = PROCESSING_NONE;
} catch (IllegalArgumentException ex) {
- Log.e("MediaArtistNativeHelper", "IllegalArgument for generateClip");
+ Log.e(TAG, "IllegalArgument for generateClip");
throw ex;
} catch (IllegalStateException ex) {
- Log.e("MediaArtistNativeHelper", "IllegalStateExceptiont for generateClip");
+ Log.e(TAG, "IllegalStateExceptiont for generateClip");
throw ex;
} catch (RuntimeException ex) {
- Log.e("MediaArtistNativeHelper", "RuntimeException for generateClip");
+ Log.e(TAG, "RuntimeException for generateClip");
throw ex;
}
if (err != 0) {
- Log.e("MediaArtistNativeHelper", "RuntimeException for generateClip");
- throw new RuntimeException("generateClip failed with error="+err );
+ Log.e(TAG, "RuntimeException for generateClip");
+ throw new RuntimeException("generateClip failed with error=" + err);
}
- mExportDone = true;
mExportProgressListener = null;
}
/**
- * This method is responsible for exporting a movie
- *
- * @param filePath The output file path
- * @param projectDir The output project directory
- * @param height The height of clip
- * @param bitrate The bitrate at which the movie should be exported
- * @param audioCodec The audio codec to use
- * @param videoCodec The video codec to use
- * @param mediaItemsList The media items list
- * @param mediaTransitionList The transitons list
- * @param mediaBGMList The background track list
- * @param listener The ExportProgressListener
- *
- */
- public void export(String filePath, String projectDir,int height,int bitrate,
- int audioCodec,int videoCodec,List<MediaItem> mediaItemsList,
- List<Transition> mediaTransitionList,List<AudioTrack> mediaBGMList,
- ExportProgressListener listener) {
-
- int outBitrate = 0;
- mExportFilename = filePath;
- previewStoryBoard(mediaItemsList, mediaTransitionList, mediaBGMList,null);
- mExportProgressListener = listener;
-
- mProgressToApp = 0;
-
- switch (bitrate) {
- case MediaProperties.BITRATE_28K:
- outBitrate = Bitrate.BR_32_KBPS;
- break;
- case MediaProperties.BITRATE_40K:
- outBitrate = Bitrate.BR_48_KBPS;
- break;
- case MediaProperties.BITRATE_64K:
- outBitrate = Bitrate.BR_64_KBPS;
- break;
- case MediaProperties.BITRATE_96K:
- outBitrate = Bitrate.BR_96_KBPS;
- break;
- case MediaProperties.BITRATE_128K:
- outBitrate = Bitrate.BR_128_KBPS;
- break;
- case MediaProperties.BITRATE_192K:
- outBitrate = Bitrate.BR_192_KBPS;
- break;
- case MediaProperties.BITRATE_256K:
- outBitrate = Bitrate.BR_256_KBPS;
- break;
- case MediaProperties.BITRATE_384K:
- outBitrate = Bitrate.BR_384_KBPS;
- break;
- case MediaProperties.BITRATE_512K:
- outBitrate = Bitrate.BR_512_KBPS;
- break;
- case MediaProperties.BITRATE_800K:
- outBitrate = Bitrate.BR_800_KBPS;
- break;
- case MediaProperties.BITRATE_2M:
- outBitrate = Bitrate.BR_2_MBPS;
- break;
- case MediaProperties.BITRATE_5M:
- outBitrate = Bitrate.BR_5_MBPS;
- break;
- case MediaProperties.BITRATE_8M:
- outBitrate = Bitrate.BR_8_MBPS;
- break;
-
- default:
- throw new IllegalArgumentException("Argument Bitrate incorrect");
- }
- mPreviewEditSettings.videoFrameRate = VideoFrameRate.FR_30_FPS;
- mPreviewEditSettings.outputFile = mOutputFilename = filePath;
-
- int aspectRatio = mVideoEditor.getAspectRatio();
- mPreviewEditSettings.videoFrameSize = findVideoResolution(aspectRatio, height);
- switch (audioCodec) {
- case MediaProperties.ACODEC_AAC_LC:
- mPreviewEditSettings.audioFormat = AudioFormat.AAC;
- break;
- case MediaProperties.ACODEC_AMRNB:
- mPreviewEditSettings.audioFormat = AudioFormat.AMR_NB;
- break;
- }
-
- switch (videoCodec) {
- case MediaProperties.VCODEC_H263:
- mPreviewEditSettings.videoFormat = VideoFormat.H263;
- break;
- case MediaProperties.VCODEC_H264BP:
- mPreviewEditSettings.videoFormat = VideoFormat.H264;
- break;
- case MediaProperties.VCODEC_MPEG4:
- mPreviewEditSettings.videoFormat = VideoFormat.MPEG4;
- break;
- }
-
- mPreviewEditSettings.audioSamplingFreq = AudioSamplingFrequency.FREQ_32000;
- mPreviewEditSettings.maxFileSize = 0;
- mPreviewEditSettings.audioChannels = 2;
- mPreviewEditSettings.videoBitrate = outBitrate;
- mPreviewEditSettings.audioBitrate = Bitrate.BR_96_KBPS;
-
- mPreviewEditSettings.transitionSettingsArray =
- new TransitionSettings[mTotalClips - 1];
- for (int index = 0; index < mTotalClips - 1; index++) {
- mPreviewEditSettings.transitionSettingsArray[index] =
- new TransitionSettings();
- mPreviewEditSettings.transitionSettingsArray[index].videoTransitionType =
- VideoTransition.NONE;
- mPreviewEditSettings.transitionSettingsArray[index].audioTransitionType =
- AudioTransition.NONE;
- }
- for (int clipCnt = 0; clipCnt < mPreviewEditSettings.clipSettingsArray.length; clipCnt++) {
- if (mPreviewEditSettings.clipSettingsArray[clipCnt].fileType == FileType.JPG) {
- mPreviewEditSettings.clipSettingsArray[clipCnt].clipPath =
- mPreviewEditSettings.clipSettingsArray[clipCnt].clipOriginalPath;
- }
- }
- nativePopulateSettings(mPreviewEditSettings, mClipProperties, mAudioSettings);
-
- int err = 0;
- try {
- mProcessingState = PROCESSING_EXPORT;
- mProcessingObject = null;
- err = generateClip(mPreviewEditSettings);
- mProcessingState = PROCESSING_NONE;
- } catch (IllegalArgumentException ex) {
- Log.e("MediaArtistNativeHelper", "IllegalArgument for generateClip");
- throw ex;
- } catch (IllegalStateException ex) {
- Log.e("MediaArtistNativeHelper", "IllegalStateExceptiont for generateClip");
- throw ex;
- } catch (RuntimeException ex) {
- Log.e("MediaArtistNativeHelper", "RuntimeException for generateClip");
- throw ex;
- }
-
- if (err != 0) {
- Log.e("MediaArtistNativeHelper", "RuntimeException for generateClip");
- throw new RuntimeException("generateClip failed with error="+err );
- }
-
- mExportDone = true;
- mExportProgressListener = null;
- }
-
-
- /**
* This methods takes care of stopping the Export process
*
* @param The input file name for which export has to be stopped
*/
- public void stop(String filename) {
- if (!mExportDone) {
- try {
- stopEncoding();
- } catch (IllegalStateException ex) {
- Log.e("MediaArtistNativeHelper", "Illegal state exception in unload settings");
- throw ex;
- } catch (RuntimeException ex) {
- Log.e("MediaArtistNativeHelper", "Runtime exception in unload settings");
- throw ex;
- }
-
+ void stop(String filename) {
+ try {
+ stopEncoding();
new File(mExportFilename).delete();
+ } catch (IllegalStateException ex) {
+ Log.e(TAG, "Illegal state exception in unload settings");
+ throw ex;
+ } catch (RuntimeException ex) {
+ Log.e(TAG, "Runtime exception in unload settings");
+ throw ex;
}
}
@@ -3885,9 +3690,9 @@
* @param inputFile The inputFile
* @param width The width of the output frame
* @param height The height of the output frame
- * @param timeMS The time in ms at which the frame hass to be extracted
+ * @param timeMS The time in ms at which the frame has to be extracted
*/
- public Bitmap getPixels(String inputFile, int width, int height, long timeMS) {
+ Bitmap getPixels(String inputFile, int width, int height, long timeMS) {
if (inputFile == null) {
throw new IllegalArgumentException();
}
@@ -3918,8 +3723,7 @@
/* Create a canvas to resize */
final Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(tempBitmap, new Rect(0, 0, newWidth, newHeight),
- new Rect(0, 0, width, height),
- sResizePaint);
+ new Rect(0, 0, width, height), sResizePaint);
}
if (tempBitmap != null) {
@@ -3961,50 +3765,49 @@
}
int i = 0;
int deltaTime = (int)(endMs - startMs) / thumbnailCount;
- Bitmap[] bitmap = null;
+ Bitmap[] bitmaps = null;
try {
// This may result in out of Memory Error
rgb888 = new int[thumbnailSize * thumbnailCount];
- bitmap = new Bitmap[thumbnailCount];
+ bitmaps = new Bitmap[thumbnailCount];
} catch (Throwable e) {
// Allocating to new size with Fixed count
try {
System.gc();
rgb888 = new int[thumbnailSize * MAX_THUMBNAIL_PERMITTED];
- bitmap = new Bitmap[MAX_THUMBNAIL_PERMITTED];
+ bitmaps = new Bitmap[MAX_THUMBNAIL_PERMITTED];
thumbnailCount = MAX_THUMBNAIL_PERMITTED;
} catch (Throwable ex) {
throw new RuntimeException("Memory allocation fails, thumbnail count too large: "+thumbnailCount);
}
}
IntBuffer tmpBuffer = IntBuffer.allocate(thumbnailSize);
- nativeGetPixelsList(filename, rgb888, newWidth, newHeight, deltaTime, thumbnailCount, startMs,
- endMs);
+ nativeGetPixelsList(filename, rgb888, newWidth, newHeight, deltaTime, thumbnailCount,
+ startMs, endMs);
for (; i < thumbnailCount; i++) {
- bitmap[i] = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ bitmaps[i] = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
tmpBuffer.put(rgb888, (i * thumbnailSize), thumbnailSize);
tmpBuffer.rewind();
if ((newWidth == width) && (newHeight == height)) {
- bitmap[i].copyPixelsFromBuffer(tmpBuffer);
+ bitmaps[i].copyPixelsFromBuffer(tmpBuffer);
} else {
/* Copy the out rgb buffer to temp bitmap */
tempBitmap.copyPixelsFromBuffer(tmpBuffer);
/* Create a canvas to resize */
- final Canvas canvas = new Canvas(bitmap[i]);
+ final Canvas canvas = new Canvas(bitmaps[i]);
canvas.drawBitmap(tempBitmap, new Rect(0, 0, newWidth, newHeight),
- new Rect(0, 0, width, height),
- sResizePaint);
+ new Rect(0, 0, width, height), sResizePaint);
}
}
if (tempBitmap != null) {
tempBitmap.recycle();
}
- return bitmap;
+ return bitmaps;
}
/**
@@ -4020,7 +3823,7 @@
* @param isVideo The flag to indicate if the file is video file or not
*
**/
- public void generateAudioGraph(String uniqueId, String inFileName, String OutAudiGraphFileName,
+ void generateAudioGraph(String uniqueId, String inFileName, String OutAudiGraphFileName,
int frameDuration, int audioChannels, int samplesCount,
ExtractAudioWaveformProgressListener listener, boolean isVideo) {
String tempPCMFileName;
@@ -4028,7 +3831,7 @@
mExtractAudioWaveformProgressListener = listener;
/**
- * in case of Video , first call will generate the PCM file to make the
+ * In case of Video, first call will generate the PCM file to make the
* audio graph
*/
if (isVideo) {
@@ -4036,6 +3839,7 @@
} else {
tempPCMFileName = mAudioTrackPCMFilePath;
}
+
/**
* For Video item, generate the PCM
*/
@@ -4046,19 +3850,46 @@
nativeGenerateAudioGraph(tempPCMFileName, OutAudiGraphFileName, frameDuration,
audioChannels, samplesCount);
- /* once the audio graph file is generated, delete the pcm file */
+ /**
+ * Once the audio graph file is generated, delete the pcm file
+ */
if (isVideo) {
new File(tempPCMFileName).delete();
}
}
- public void clearPreviewSurface(Surface surface) {
- nativeClearSurface(surface);
+ void clearPreviewSurface(Surface surface) {
+ nativeClearSurface(surface);
+ }
+
+ /**
+ * Grab the semaphore which arbitrates access to the editor
+ *
+ * @throws InterruptedException
+ */
+ void lock() throws InterruptedException {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "lock: grabbing semaphore", new Throwable());
+ }
+ mLock.acquire();
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "lock: grabbed semaphore");
+ }
+ }
+
+ /**
+ * Release the semaphore which arbitrates access to the editor
+ */
+ void unlock() {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "unlock: releasing semaphore");
+ }
+ mLock.release();
}
/** Native Methods */
native Properties getMediaProperties(String file) throws IllegalArgumentException,
- IllegalStateException, RuntimeException, Exception;
+ IllegalStateException, RuntimeException, Exception;
/**
* Get the version of ManualEdit.
@@ -4073,7 +3904,7 @@
* Returns the video thumbnail in an array of integers. Output format is
* ARGB8888.
*
- * @param pixelArray the array that receives the pixelvalues
+ * @param pixelArray the array that receives the pixel values
* @param width width of the video thumbnail
* @param height height of the video thumbnail
* @param timeMS desired time of the thumbnail in ms
@@ -4103,7 +3934,6 @@
*/
private native void nativeClearSurface(Surface surface);
-
/**
* Stops the encoding. This method should only be called after encoding has
* started using method <code> startEncoding</code>
@@ -4113,7 +3943,6 @@
private native void stopEncoding() throws IllegalStateException, RuntimeException;
-
private native void _init(String tempPath, String libraryPath)
throws IllegalArgumentException, IllegalStateException, RuntimeException;
@@ -4121,7 +3950,7 @@
int callbackAfterFrameCount, boolean loop) throws IllegalArgumentException,
IllegalStateException, RuntimeException;
- private native void nativePopulateSettings(EditSettings mEditSettings,
+ private native void nativePopulateSettings(EditSettings editSettings,
PreviewClipProperties mProperties, AudioSettings mAudioSettings)
throws IllegalArgumentException, IllegalStateException, RuntimeException;
diff --git a/media/java/android/media/videoeditor/MediaImageItem.java b/media/java/android/media/videoeditor/MediaImageItem.java
index 633e7ee..69088ed 100755
--- a/media/java/android/media/videoeditor/MediaImageItem.java
+++ b/media/java/android/media/videoeditor/MediaImageItem.java
@@ -294,6 +294,8 @@
return;
}
+ mMANativeHelper.setGeneratePreview(true);
+
/**
* Invalidate the end transitions if necessary.
* This invalidation is necessary for the case in which an effect or
diff --git a/media/java/android/media/videoeditor/MediaItem.java b/media/java/android/media/videoeditor/MediaItem.java
index a24b46e..d3ab051 100755
--- a/media/java/android/media/videoeditor/MediaItem.java
+++ b/media/java/android/media/videoeditor/MediaItem.java
@@ -176,6 +176,9 @@
default:
throw new IllegalArgumentException("Invalid Rendering Mode");
}
+
+ mMANativeHelper.setGeneratePreview(true);
+
mRenderingMode = renderingMode;
if (mBeginTransition != null) {
mBeginTransition.invalidate();
@@ -184,7 +187,6 @@
if (mEndTransition != null) {
mEndTransition.invalidate();
}
- mMANativeHelper.setGeneratePreview(true);
}
/**
@@ -296,12 +298,11 @@
mEffects.add(effect);
invalidateTransitions(effect.getStartTime(), effect.getDuration());
- if (mMANativeHelper != null) {
- if (effect instanceof EffectKenBurns) {
- mRegenerateClip = true;
- }
- mMANativeHelper.setGeneratePreview(true);
+
+ if (effect instanceof EffectKenBurns) {
+ mRegenerateClip = true;
}
+ mMANativeHelper.setGeneratePreview(true);
}
/**
@@ -318,23 +319,23 @@
public Effect removeEffect(String effectId) {
for (Effect effect : mEffects) {
if (effect.getId().equals(effectId)) {
+ mMANativeHelper.setGeneratePreview(true);
+
mEffects.remove(effect);
+
invalidateTransitions(effect.getStartTime(), effect.getDuration());
- if (mMANativeHelper != null) {
- if (effect instanceof EffectKenBurns) {
- if (mGeneratedImageClip != null) {
- /**
- * Delete the file
- */
- new File(mGeneratedImageClip).delete();
- /**
- * Invalidate the filename
- */
- mGeneratedImageClip = null;
- }
- mRegenerateClip = false;
+ if (effect instanceof EffectKenBurns) {
+ if (mGeneratedImageClip != null) {
+ /**
+ * Delete the file
+ */
+ new File(mGeneratedImageClip).delete();
+ /**
+ * Invalidate the filename
+ */
+ mGeneratedImageClip = null;
}
- mMANativeHelper.setGeneratePreview(true);
+ mRegenerateClip = false;
}
return effect;
}
@@ -448,9 +449,7 @@
mOverlays.add(overlay);
invalidateTransitions(overlay.getStartTime(), overlay.getDuration());
- if (mMANativeHelper != null) {
- mMANativeHelper.setGeneratePreview(true);
- }
+ mMANativeHelper.setGeneratePreview(true);
}
/**
@@ -483,10 +482,9 @@
public Overlay removeOverlay(String overlayId) {
for (Overlay overlay : mOverlays) {
if (overlay.getId().equals(overlayId)) {
+ mMANativeHelper.setGeneratePreview(true);
+
mOverlays.remove(overlay);
- if (mMANativeHelper != null) {
- mMANativeHelper.setGeneratePreview(true);
- }
if (overlay instanceof OverlayFrame) {
((OverlayFrame)overlay).invalidate();
}
diff --git a/media/java/android/media/videoeditor/MediaVideoItem.java b/media/java/android/media/videoeditor/MediaVideoItem.java
index 02155db..bbadd62 100755
--- a/media/java/android/media/videoeditor/MediaVideoItem.java
+++ b/media/java/android/media/videoeditor/MediaVideoItem.java
@@ -198,6 +198,8 @@
throw new IllegalArgumentException("setExtractBoundaries: Start time or end time is negative");
}
+ mMANativeHelper.setGeneratePreview(true);
+
if (beginMs != mBeginBoundaryTimeMs) {
if (mBeginTransition != null) {
mBeginTransition.invalidate();
@@ -212,7 +214,6 @@
mBeginBoundaryTimeMs = beginMs;
mEndBoundaryTimeMs = endMs;
- mMANativeHelper.setGeneratePreview(true);
adjustTransitions();
mVideoEditor.updateTimelineDuration();
/**
@@ -260,12 +261,11 @@
throw new IllegalArgumentException("Invalid Time duration");
}
- if ((width <=0) || (height <= 0)) {
+ if ((width <= 0) || (height <= 0)) {
throw new IllegalArgumentException("Invalid Dimensions");
}
- return mMANativeHelper.getPixels(super.getFilename(),
- width, height,timeMs);
+ return mMANativeHelper.getPixels(super.getFilename(), width, height,timeMs);
}
/*
@@ -610,6 +610,7 @@
* @param muted true to mute the media item
*/
public void setMute(boolean muted) {
+ mMANativeHelper.setGeneratePreview(true);
mMuted = muted;
if (mBeginTransition != null) {
mBeginTransition.invalidate();
@@ -617,7 +618,6 @@
if (mEndTransition != null) {
mEndTransition.invalidate();
}
- mMANativeHelper.setGeneratePreview(true);
}
/**
diff --git a/media/java/android/media/videoeditor/Overlay.java b/media/java/android/media/videoeditor/Overlay.java
index ec03966..a070eb4 100755
--- a/media/java/android/media/videoeditor/Overlay.java
+++ b/media/java/android/media/videoeditor/Overlay.java
@@ -106,7 +106,6 @@
* @param durationMs The duration in milliseconds
*/
public void setDuration(long durationMs) {
-
if (durationMs < 0) {
throw new IllegalArgumentException("Invalid duration");
}
@@ -115,11 +114,12 @@
throw new IllegalArgumentException("Duration is too large");
}
+ getMediaItem().getNativeContext().setGeneratePreview(true);
+
final long oldDurationMs = mDurationMs;
mDurationMs = durationMs;
- mMediaItem.invalidateTransitions(mStartTimeMs, oldDurationMs,
- mStartTimeMs, mDurationMs);
+ mMediaItem.invalidateTransitions(mStartTimeMs, oldDurationMs, mStartTimeMs, mDurationMs);
}
/**
@@ -143,11 +143,12 @@
throw new IllegalArgumentException("Start time is too large");
}
+ getMediaItem().getNativeContext().setGeneratePreview(true);
+
final long oldStartTimeMs = mStartTimeMs;
mStartTimeMs = startTimeMs;
- mMediaItem.invalidateTransitions(oldStartTimeMs, mDurationMs,
- mStartTimeMs, mDurationMs);
+ mMediaItem.invalidateTransitions(oldStartTimeMs, mDurationMs, mStartTimeMs, mDurationMs);
}
/**
@@ -161,14 +162,15 @@
throw new IllegalArgumentException("Invalid start time or duration");
}
+ getMediaItem().getNativeContext().setGeneratePreview(true);
+
final long oldStartTimeMs = mStartTimeMs;
final long oldDurationMs = mDurationMs;
mStartTimeMs = startTimeMs;
mDurationMs = durationMs;
- mMediaItem.invalidateTransitions(oldStartTimeMs, oldDurationMs,
- mStartTimeMs, mDurationMs);
+ mMediaItem.invalidateTransitions(oldStartTimeMs, oldDurationMs, mStartTimeMs, mDurationMs);
}
/**
diff --git a/media/java/android/media/videoeditor/OverlayFrame.java b/media/java/android/media/videoeditor/OverlayFrame.java
index 0a928fe..2bb9a1c 100755
--- a/media/java/android/media/videoeditor/OverlayFrame.java
+++ b/media/java/android/media/videoeditor/OverlayFrame.java
@@ -120,6 +120,10 @@
* @param bitmap The overlay bitmap.
*/
public void setBitmap(Bitmap bitmap) {
+ getMediaItem().getNativeContext().setGeneratePreview(true);
+
+ invalidate();
+
mBitmap = bitmap;
if (mFilename != null) {
/**
@@ -238,12 +242,16 @@
* Delete the overlay files
*/
void invalidate() {
- if (mFilename != null) {
- new File(mFilename).delete();
- mFilename = null;
+ if (mBitmap != null) {
mBitmap.recycle();
mBitmap = null;
}
+
+ if (mFilename != null) {
+ new File(mFilename).delete();
+ mFilename = null;
+ }
+
if (mBitmapFileName != null) {
new File(mBitmapFileName).delete();
mBitmapFileName = null;
diff --git a/media/java/android/media/videoeditor/VideoEditorImpl.java b/media/java/android/media/videoeditor/VideoEditorImpl.java
index 54b3837..cc847ef 100755
--- a/media/java/android/media/videoeditor/VideoEditorImpl.java
+++ b/media/java/android/media/videoeditor/VideoEditorImpl.java
@@ -27,20 +27,17 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.Semaphore;
-
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
+import android.graphics.Bitmap;
import android.graphics.Rect;
import android.util.Log;
import android.util.Xml;
import android.view.Surface;
import android.view.SurfaceHolder;
-import android.graphics.Bitmap;
-
/**
* The VideoEditor implementation {@hide}
*/
@@ -54,15 +51,6 @@
* The project filename
*/
private static final String PROJECT_FILENAME = "videoeditor.xml";
- /*
- * Semaphore to control preview calls
- */
- final Semaphore mPreviewSemaphore = new Semaphore(1, true);
-
- /*
- * Semaphore to control export calls
- */
- final Semaphore mExportSemaphore = new Semaphore(1, true);
/*
* XML tags
@@ -74,8 +62,7 @@
private static final String TAG_TRANSITION = "transition";
private static final String TAG_OVERLAYS = "overlays";
private static final String TAG_OVERLAY = "overlay";
- private static final String TAG_OVERLAY_USER_ATTRIBUTES =
- "overlay_user_attributes";
+ private static final String TAG_OVERLAY_USER_ATTRIBUTES = "overlay_user_attributes";
private static final String TAG_EFFECTS = "effects";
private static final String TAG_EFFECT = "effect";
private static final String TAG_AUDIO_TRACKS = "audio_tracks";
@@ -86,7 +73,6 @@
private static final String ATTR_AUDIO_WAVEFORM_FILENAME = "waveform";
private static final String ATTR_RENDERING_MODE = "rendering_mode";
private static final String ATTR_ASPECT_RATIO = "aspect_ratio";
- private static final String ATTR_PREVIEW_PREPARE = "preview_prepare_invalid";
private static final String ATTR_REGENERATE_PCM = "regeneratePCMFlag";
private static final String ATTR_TYPE = "type";
private static final String ATTR_DURATION = "duration";
@@ -116,18 +102,12 @@
private static final String ATTR_DUCK_ENABLED = "ducking_enabled";
private static final String ATTR_DUCK_THRESHOLD = "ducking_threshold";
private static final String ATTR_DUCKED_TRACK_VOLUME = "ducking_volume";
- private static final String ATTR_GENERATED_IMAGE_CLIP =
- "generated_image_clip";
- private static final String ATTR_GENERATED_TRANSITION_CLIP =
- "generated_transition_clip";
- private static final String ATTR_IS_TRANSITION_GENERATED =
- "is_transition_generated";
- private static final String ATTR_OVERLAY_RGB_FILENAME =
- "overlay_rgb_filename";
- private static final String ATTR_OVERLAY_FRAME_WIDTH =
- "overlay_frame_width";
- private static final String ATTR_OVERLAY_FRAME_HEIGHT =
- "overlay_frame_height";
+ private static final String ATTR_GENERATED_IMAGE_CLIP = "generated_image_clip";
+ private static final String ATTR_GENERATED_TRANSITION_CLIP = "generated_transition_clip";
+ private static final String ATTR_IS_TRANSITION_GENERATED = "is_transition_generated";
+ private static final String ATTR_OVERLAY_RGB_FILENAME = "overlay_rgb_filename";
+ private static final String ATTR_OVERLAY_FRAME_WIDTH = "overlay_frame_width";
+ private static final String ATTR_OVERLAY_FRAME_HEIGHT = "overlay_frame_height";
/*
* Instance variables
@@ -143,7 +123,6 @@
* Private Object for calling native Methods via MediaArtistNativeHelper
*/
private MediaArtistNativeHelper mMANativeHelper;
- private VideoEditor veObject = null;
private boolean mPreviewInProgress = false;
/**
@@ -153,7 +132,6 @@
* related to the project
*/
public VideoEditorImpl(String projectPath) throws IOException {
-
mMANativeHelper = new MediaArtistNativeHelper(projectPath, this);
mProjectPath = projectPath;
final File projectXml = new File(projectPath, PROJECT_FILENAME);
@@ -184,6 +162,7 @@
if (audioTrack == null) {
throw new IllegalArgumentException("Audio Track is null");
}
+
if (mAudioTracks.size() == 1) {
throw new IllegalArgumentException("No more tracks can be added");
}
@@ -196,16 +175,16 @@
/*
* Form the audio PCM file path
*/
- String audioTrackPCMFilePath = String.format(mProjectPath + "/"
+ final String audioTrackPCMFilePath = String.format(mProjectPath + "/"
+ "AudioPcm" + audioTrack.getId() + ".pcm");
/*
* Create PCM only if not generated in previous session
*/
- if (new File(audioTrackPCMFilePath).exists())
- {
+ if (new File(audioTrackPCMFilePath).exists()) {
mMANativeHelper.setAudioflag(false);
}
+
mMANativeHelper.setGeneratePreview(true);
}
@@ -223,15 +202,14 @@
* Add the Media item to MediaItem list
*/
if (mMediaItems.contains(mediaItem)) {
- throw new IllegalArgumentException("Media item already exists: " +
- mediaItem.getId());
+ throw new IllegalArgumentException("Media item already exists: " + mediaItem.getId());
}
/*
* Invalidate the end transition if necessary
*/
final int mediaItemsCount = mMediaItems.size();
- if ( mediaItemsCount > 0) {
+ if (mediaItemsCount > 0) {
removeTransitionAfter(mediaItemsCount - 1);
}
@@ -258,6 +236,7 @@
if (transition == null) {
throw new IllegalArgumentException("Null Transition");
}
+
final MediaItem beforeMediaItem = transition.getBeforeMediaItem();
final MediaItem afterMediaItem = transition.getAfterMediaItem();
/*
@@ -266,15 +245,16 @@
if (mMediaItems == null) {
throw new IllegalArgumentException("No media items are added");
}
- if ((afterMediaItem != null) && (beforeMediaItem != null)) {
- int afterMediaItemIndex = mMediaItems.indexOf(afterMediaItem);
- int beforeMediaItemIndex = mMediaItems.indexOf(beforeMediaItem);
+ if ((afterMediaItem != null) && (beforeMediaItem != null)) {
+ final int afterMediaItemIndex = mMediaItems.indexOf(afterMediaItem);
+ final int beforeMediaItemIndex = mMediaItems.indexOf(beforeMediaItem);
if ((afterMediaItemIndex == -1) || (beforeMediaItemIndex == -1)) {
throw new IllegalArgumentException
("Either of the mediaItem is not found in the list");
}
+
if (afterMediaItemIndex != (beforeMediaItemIndex - 1) ) {
throw new IllegalArgumentException("MediaItems are not in sequence");
}
@@ -334,9 +314,10 @@
case MediaProperties.ACODEC_AMRNB:
break;
- default :
+ default: {
String message = "Unsupported audio codec type " + audioCodec;
throw new IllegalArgumentException(message);
+ }
}
switch (videoCodec) {
@@ -347,9 +328,10 @@
case MediaProperties.VCODEC_MPEG4:
break;
- default :
+ default: {
String message = "Unsupported video codec type " + videoCodec;
throw new IllegalArgumentException(message);
+ }
}
export(filename, height, bitrate, listener);
@@ -360,13 +342,15 @@
*/
public void export(String filename, int height, int bitrate,
ExportProgressListener listener) throws IOException {
- if ( filename == null) {
+ if (filename == null) {
throw new IllegalArgumentException("export: filename is null");
}
- File tempPathFile = new File(filename);
+
+ final File tempPathFile = new File(filename);
if (tempPathFile == null) {
throw new IOException(filename + "can not be created");
}
+
if (mMediaItems.size() == 0) {
throw new IllegalStateException("No MediaItems added");
}
@@ -381,10 +365,12 @@
case MediaProperties.HEIGHT_720:
break;
- default:
+ default: {
String message = "Unsupported height value " + height;
throw new IllegalArgumentException(message);
+ }
}
+
switch (bitrate) {
case MediaProperties.BITRATE_28K:
break;
@@ -413,20 +399,24 @@
case MediaProperties.BITRATE_8M:
break;
- default:
+ default: {
final String message = "Unsupported bitrate value " + bitrate;
throw new IllegalArgumentException(message);
+ }
}
+ boolean semAcquireDone = false;
try {
- mExportSemaphore.acquire();
+ mMANativeHelper.lock();
+ semAcquireDone = true;
mMANativeHelper.export(filename, mProjectPath, height,bitrate,
- mMediaItems, mTransitions, mAudioTracks,
- listener);
+ mMediaItems, mTransitions, mAudioTracks, listener);
} catch (InterruptedException ex) {
Log.e(TAG, "Sem acquire NOT successful in export");
} finally {
- mExportSemaphore.release();
+ if (semAcquireDone) {
+ mMANativeHelper.unlock();
+ }
}
}
@@ -436,18 +426,18 @@
public void generatePreview(MediaProcessingProgressListener listener) {
boolean semAcquireDone = false;
try {
- mPreviewSemaphore.acquire();
+ mMANativeHelper.lock();
semAcquireDone = true;
- mMANativeHelper.setGeneratePreview(true);
+
if ((mMediaItems.size() > 0) || (mAudioTracks.size() > 0)) {
- mMANativeHelper.previewStoryBoard(mMediaItems, mTransitions,
- mAudioTracks, listener);
+ mMANativeHelper.previewStoryBoard(mMediaItems, mTransitions, mAudioTracks,
+ listener);
}
} catch (InterruptedException ex) {
Log.e(TAG, "Sem acquire NOT successful in previewStoryBoard");
} finally {
if (semAcquireDone) {
- mPreviewSemaphore.release();
+ mMANativeHelper.unlock();
}
}
}
@@ -553,29 +543,28 @@
if (afterAudioTrackId == null) {
mAudioTracks.add(0, audioTrack);
+ mMANativeHelper.setGeneratePreview(true);
} else {
final int audioTrackCount = mAudioTracks.size();
for (int i = 0; i < audioTrackCount; i++) {
AudioTrack at = mAudioTracks.get(i);
if (at.getId().equals(afterAudioTrackId)) {
mAudioTracks.add(i + 1, audioTrack);
+ mMANativeHelper.setGeneratePreview(true);
return;
}
}
- throw new IllegalArgumentException("AudioTrack not found: "
- + afterAudioTrackId);
+
+ throw new IllegalArgumentException("AudioTrack not found: " + afterAudioTrackId);
}
- mMANativeHelper.setGeneratePreview(true);
}
/*
* {@inheritDoc}
*/
- public synchronized void insertMediaItem(MediaItem mediaItem,
- String afterMediaItemId) {
+ public synchronized void insertMediaItem(MediaItem mediaItem, String afterMediaItemId) {
if (mMediaItems.contains(mediaItem)) {
- throw new IllegalArgumentException("Media item already exists: "
- + mediaItem.getId());
+ throw new IllegalArgumentException("Media item already exists: " + mediaItem.getId());
}
if (afterMediaItemId == null) {
@@ -585,9 +574,11 @@
*/
removeTransitionBefore(0);
}
+
mMediaItems.add(0, mediaItem);
computeTimelineDuration();
generateProjectThumbnail();
+ mMANativeHelper.setGeneratePreview(true);
} else {
final int mediaItemCount = mMediaItems.size();
for (int i = 0; i < mediaItemCount; i++) {
@@ -606,29 +597,25 @@
return;
}
}
- throw new IllegalArgumentException("MediaItem not found: "
- + afterMediaItemId);
+
+ throw new IllegalArgumentException("MediaItem not found: " + afterMediaItemId);
}
- mMANativeHelper.setGeneratePreview(true);
}
/*
* {@inheritDoc}
*/
- public synchronized void moveAudioTrack(String audioTrackId,
- String afterAudioTrackId) {
+ public synchronized void moveAudioTrack(String audioTrackId, String afterAudioTrackId) {
throw new IllegalStateException("Not supported");
}
/*
* {@inheritDoc}
*/
- public synchronized void moveMediaItem(String mediaItemId,
- String afterMediaItemId) {
+ public synchronized void moveMediaItem(String mediaItemId, String afterMediaItemId) {
final MediaItem moveMediaItem = removeMediaItem(mediaItemId,true);
if (moveMediaItem == null) {
- throw new IllegalArgumentException("Target MediaItem not found: "
- + mediaItemId);
+ throw new IllegalArgumentException("Target MediaItem not found: " + mediaItemId);
}
if (afterMediaItemId == null) {
@@ -643,6 +630,8 @@
*/
mMediaItems.add(0, moveMediaItem);
computeTimelineDuration();
+ mMANativeHelper.setGeneratePreview(true);
+
generateProjectThumbnail();
} else {
throw new IllegalStateException("Cannot move media item (it is the only item)");
@@ -666,10 +655,8 @@
}
}
- throw new IllegalArgumentException("MediaItem not found: "
- + afterMediaItemId);
+ throw new IllegalArgumentException("MediaItem not found: " + afterMediaItemId);
}
- mMANativeHelper.setGeneratePreview(true);
}
/*
@@ -681,16 +668,15 @@
mAudioTracks.clear();
mTransitions.clear();
mMANativeHelper.releaseNativeHelper();
- if (mMANativeHelper!= null)
- mMANativeHelper = null;
- if (veObject != null)
- veObject= null;
+ mMANativeHelper = null;
}
/*
* {@inheritDoc}
*/
public synchronized void removeAllMediaItems() {
+ mMANativeHelper.setGeneratePreview(true);
+
mMediaItems.clear();
/**
@@ -702,7 +688,6 @@
mTransitions.clear();
mDurationMs = 0;
- mMANativeHelper.setGeneratePreview(true);
/**
* If a thumbnail already exists, then delete it
*/
@@ -722,11 +707,10 @@
audioTrack.invalidate();
mMANativeHelper.invalidatePcmFile();
mMANativeHelper.setAudioflag(true);
- }
- else {
+ mMANativeHelper.setGeneratePreview(true);
+ } else {
throw new IllegalArgumentException(" No more audio tracks");
}
- mMANativeHelper.setGeneratePreview(true);
return audioTrack;
}
@@ -737,6 +721,7 @@
final String firstItemString = mMediaItems.get(0).getId();
final MediaItem mediaItem = getMediaItem(mediaItemId);
if (mediaItem != null) {
+ mMANativeHelper.setGeneratePreview(true);
/**
* Remove the media item
*/
@@ -760,10 +745,10 @@
removeAdjacentTransitions(mediaItem);
computeTimelineDuration();
}
- mMANativeHelper.setGeneratePreview(true);
+
/**
* If string equals first mediaItem, then
- * generate Project thumbail
+ * generate Project thumbnail
*/
if (firstItemString.equals(mediaItemId)) {
generateProjectThumbnail();
@@ -784,6 +769,7 @@
final MediaItem mediaItem = getMediaItem(mediaItemId);
if (mediaItem != null) {
+ mMANativeHelper.setGeneratePreview(true);
/**
* Remove the media item
*/
@@ -794,7 +780,6 @@
removeAdjacentTransitions(mediaItem);
computeTimelineDuration();
}
- mMANativeHelper.setGeneratePreview(true);
/**
* If string equals first mediaItem, then
@@ -812,10 +797,11 @@
public synchronized Transition removeTransition(String transitionId) {
final Transition transition = getTransition(transitionId);
if (transition == null) {
- throw new IllegalStateException("Transition not found: "
- + transitionId);
+ throw new IllegalStateException("Transition not found: " + transitionId);
}
+ mMANativeHelper.setGeneratePreview(true);
+
/**
* Remove the transition references
*/
@@ -832,7 +818,6 @@
mTransitions.remove(transition);
transition.invalidate();
computeTimelineDuration();
- mMANativeHelper.setGeneratePreview(true);
return transition;
}
@@ -841,63 +826,43 @@
*/
public long renderPreviewFrame(SurfaceHolder surfaceHolder, long timeMs,
OverlayData overlayData) {
- long result = 0;
- int surfaceWidth = 0;
- int surfaceHeight = 0;
- Rect frame;
-
if (surfaceHolder == null) {
throw new IllegalArgumentException("Surface Holder is null");
}
+ final Surface surface = surfaceHolder.getSurface();
+ if (surface == null) {
+ throw new IllegalArgumentException("Surface could not be retrieved from Surface holder");
+ }
+
if (timeMs < 0) {
throw new IllegalArgumentException("requested time not correct");
} else if (timeMs > mDurationMs) {
throw new IllegalArgumentException("requested time more than duration");
}
- if (mMANativeHelper != null) {
- if (mMANativeHelper.mInvalidatePreviewArray) {
- return -1;
- }
- }
- else {
- return -1;
- }
+
+ long result = 0;
+
boolean semAcquireDone = false;
-
- try{
- mPreviewSemaphore.acquire();
+ try {
+ mMANativeHelper.lock();
semAcquireDone = true;
- Surface surface = surfaceHolder.getSurface();
- frame = surfaceHolder.getSurfaceFrame();
- surfaceWidth = frame.width();
- surfaceHeight = frame.height();
- if (surface == null) {
- throw new RuntimeException("Surface could not be retrieved from Surface holder");
+ if (mMediaItems.size() > 0) {
+ final Rect frame = surfaceHolder.getSurfaceFrame();
+ result = mMANativeHelper.renderPreviewFrame(surface,
+ timeMs, frame.width(), frame.height(), overlayData);
+ } else {
+ result = 0;
}
-
- if (!mMANativeHelper.mInvalidatePreviewArray) {
- if (mMediaItems.size() > 0) {
- result = mMANativeHelper.renderPreviewFrame(surface,
- timeMs,surfaceWidth,surfaceHeight, overlayData);
- }
- else {
- result = 0;
- }
- }
- else {
- result = -1;
- }
-
} catch (InterruptedException ex) {
Log.e(TAG, "Sem acquire NOT successful in renderPreviewFrame");
- }
- finally {
+ } finally {
if (semAcquireDone) {
- mPreviewSemaphore.release();
+ mMANativeHelper.unlock();
}
}
+
return result;
}
@@ -926,10 +891,6 @@
mAspectRatio =
Integer.parseInt(parser.getAttributeValue("",
ATTR_ASPECT_RATIO));
- final boolean mInvalidatePreviewArray =
- Boolean.parseBoolean(parser.getAttributeValue("",
- ATTR_PREVIEW_PREPARE));
- mMANativeHelper.setGeneratePreview(mInvalidatePreviewArray);
final boolean mRegenPCM =
Boolean.parseBoolean(parser.getAttributeValue("",
@@ -1126,7 +1087,7 @@
final String transitionFile = parser.getAttributeValue("",
ATTR_GENERATED_TRANSITION_CLIP);
- if (new File(transitionFile).exists() == true) {
+ if (new File(transitionFile).exists()) {
transition.setFilename(transitionFile);
} else {
transition.setFilename(null);
@@ -1300,8 +1261,6 @@
serializer.startTag("", TAG_PROJECT);
serializer.attribute("",
ATTR_ASPECT_RATIO, Integer.toString(mAspectRatio));
- serializer.attribute("", ATTR_PREVIEW_PREPARE,
- Boolean.toString(mMANativeHelper.getGeneratePreview()));
serializer.attribute("", ATTR_REGENERATE_PCM,
Boolean.toString(mMANativeHelper.getAudioflag()));
@@ -1551,56 +1510,54 @@
if (surfaceHolder == null) {
throw new IllegalArgumentException();
}
+
+ final Surface surface = surfaceHolder.getSurface();
+ if (surface == null) {
+ throw new IllegalArgumentException("Surface could not be retrieved from surface holder");
+ }
+
if (listener == null) {
throw new IllegalArgumentException();
}
+
if (fromMs >= mDurationMs) {
- throw new IllegalArgumentException("requested time not correct");
+ throw new IllegalArgumentException("Requested time not correct");
}
if (fromMs < 0) {
- throw new IllegalArgumentException("requested time not correct");
+ throw new IllegalArgumentException("Requested time not correct");
}
boolean semAcquireDone = false;
try{
- mPreviewSemaphore.acquire();
+ mMANativeHelper.lock();
semAcquireDone = true;
- } catch (InterruptedException ex) {
- Log.e(TAG, "Sem acquire NOT successful in startPreview");
- }
-
- if (semAcquireDone) {
- Surface mSurface = surfaceHolder.getSurface();
-
- if (mSurface == null) {
- throw new RuntimeException("Surface could not be retrieved from surface holder");
- }
if (mMediaItems.size() > 0) {
- try {
- mMANativeHelper.previewStoryBoard(mMediaItems, mTransitions,
- mAudioTracks, null);
- mMANativeHelper.doPreview(mSurface, fromMs, toMs, loop,
- callbackAfterFrameCount, listener);
- mPreviewInProgress = true;
- } catch (IllegalArgumentException ex) {
- mPreviewSemaphore.release();
- Log.e(TAG, "Illegal Argument exception in do preview");
- throw ex;
- } catch (IllegalStateException ex) {
- mPreviewSemaphore.release();
- Log.e(TAG, "Illegal State exception in do preview");
- throw ex;
- } catch (RuntimeException ex) {
- mPreviewSemaphore.release();
- Log.e(TAG, "Runtime exception in do preview");
- throw ex;
- }
+ mMANativeHelper.previewStoryBoard(mMediaItems, mTransitions,
+ mAudioTracks, null);
+ mMANativeHelper.doPreview(surface, fromMs, toMs, loop,
+ callbackAfterFrameCount, listener);
+ mPreviewInProgress = true;
}
/**
* release on complete by calling stopPreview
*/
+ } catch (InterruptedException ex) {
+ Log.e(TAG, "Sem acquire NOT successful in startPreview");
+ } catch (IllegalArgumentException ex) {
+ Log.e(TAG, "Illegal Argument exception in do preview");
+ throw ex;
+ } catch (IllegalStateException ex) {
+ Log.e(TAG, "Illegal State exception in do preview");
+ throw ex;
+ } catch (RuntimeException ex) {
+ Log.e(TAG, "Runtime exception in do preview");
+ throw ex;
+ } finally {
+ if (semAcquireDone) {
+ mMANativeHelper.unlock();
+ }
}
}
@@ -1614,10 +1571,9 @@
/**
* release the sem acquired in startPreview
*/
- mPreviewSemaphore.release();
+ mMANativeHelper.unlock();
return result;
- }
- else {
+ } else {
return 0;
}
}
@@ -1662,6 +1618,7 @@
Transition t = it.next();
if (t.getBeforeMediaItem() == mediaItem) {
it.remove();
+ mMANativeHelper.setGeneratePreview(true);
t.invalidate();
mediaItem.setBeginTransition(null);
if (index > 0) {
@@ -1684,6 +1641,7 @@
Transition t = it.next();
if (t.getAfterMediaItem() == mediaItem) {
it.remove();
+ mMANativeHelper.setGeneratePreview(true);
t.invalidate();
mediaItem.setEndTransition(null);
/**
@@ -1730,22 +1688,22 @@
if (mMediaItems.size() > 0) {
MediaItem mI = mMediaItems.get(0);
/*
- * Lets initialiZe the width for default aspect ratio i.e 16:9
+ * Lets initialize the width for default aspect ratio i.e 16:9
*/
int height = 480;
int width = 854;
switch (mI.getAspectRatio()) {
case MediaProperties.ASPECT_RATIO_3_2:
- width = 720;
+ width = 720;
break;
case MediaProperties.ASPECT_RATIO_4_3:
- width = 640;
+ width = 640;
break;
case MediaProperties.ASPECT_RATIO_5_3:
- width = 800;
+ width = 800;
break;
case MediaProperties.ASPECT_RATIO_11_9:
- width = 586;
+ width = 586;
break;
case MediaProperties.ASPECT_RATIO_16_9:
case MediaProperties.ASPECT_RATIO_UNDEFINED:
@@ -1756,10 +1714,11 @@
try {
projectBitmap = mI.getThumbnail(width, height, 500);
} catch (IllegalArgumentException e) {
- throw new IllegalArgumentException ("Illegal Argument Error creating project thumbnail");
+ throw new IllegalArgumentException ("Illegal argument error creating project thumbnail");
} catch (IOException e) {
throw new IllegalArgumentException ("IO Error creating project thumbnail");
}
+
try {
FileOutputStream stream = new FileOutputStream(mProjectPath + "/"
+ THUMBNAIL_FILENAME);
@@ -1767,7 +1726,6 @@
stream.flush();
stream.close();
} catch (IOException e) {
-
throw new IllegalArgumentException ("Error creating project thumbnail");
} finally {
projectBitmap.recycle();
@@ -1788,7 +1746,7 @@
final Surface surface = surfaceHolder.getSurface();
if (surface == null) {
- throw new RuntimeException("Surface could not be retrieved from surface holder");
+ throw new IllegalArgumentException("Surface could not be retrieved from surface holder");
}
if (mMANativeHelper != null) {
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index 7ac6f92..a1cb23a 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -82,6 +82,11 @@
if (ggl_unlikely(gEGLErrorKey == -1))
return EGL_SUCCESS;
GLint error = (GLint)pthread_getspecific(gEGLErrorKey);
+ if (error == 0) {
+ // The TLS key has been created by another thread, but the value for
+ // this thread has not been initialized.
+ return EGL_SUCCESS;
+ }
pthread_setspecific(gEGLErrorKey, (void*)EGL_SUCCESS);
return error;
}
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel_title.xml b/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel_title.xml
index 3e785c6..2d34635 100644
--- a/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel_title.xml
+++ b/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel_title.xml
@@ -119,7 +119,7 @@
android:layout_width="match_parent"
android:layout_alignParentRight="true"
android:layout_above="@id/title_divider"
- android:layout_marginRight="32dip"
+ android:layout_marginRight="6dip"
android:layout_marginBottom="8dip"
>
<TextView android:id="@+id/time_bg"
@@ -127,14 +127,14 @@
android:layout_height="wrap_content"
android:gravity="right"
android:singleLine="true"
- android:textSize="72sp"
+ android:textSize="78sp"
android:textColor="#999999" />
<TextView android:id="@+id/time_fg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:singleLine="true"
- android:textSize="72sp"
+ android:textSize="78sp"
android:textColor="#666666" />
</com.android.systemui.statusbar.tablet.HoloClock>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java
index 502e0fe..0c2909a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java
@@ -16,6 +16,8 @@
package com.android.systemui.statusbar.tablet;
+import com.android.systemui.R;
+
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -23,18 +25,16 @@
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.IBinder;
-import android.os.RemoteException;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Pair;
-import android.util.Slog;
import android.view.View;
-import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
+import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
@@ -48,10 +48,8 @@
import java.util.Set;
import java.util.TreeMap;
-import com.android.internal.statusbar.IStatusBarService;
-import com.android.systemui.R;
-
-public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, OnClickListener {
+public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, View.OnClickListener,
+ CompoundButton.OnCheckedChangeListener {
private static final boolean DEBUG = TabletStatusBar.DEBUG;
private static final String TAG = "InputMethodsPanel";
@@ -144,8 +142,8 @@
mInputMethodMenuList = (LinearLayout) findViewById(R.id.input_method_menu_list);
mHardKeyboardSection = (LinearLayout) findViewById(R.id.hard_keyboard_section);
mHardKeyboardSwitch = (Switch) findViewById(R.id.hard_keyboard_switch);
- mHardKeyboardSwitch.setOnClickListener(this);
- mConfigureImeShortcut = ((View) findViewById(R.id.ime_settings_shortcut));
+ mHardKeyboardSwitch.setOnCheckedChangeListener(this);
+ mConfigureImeShortcut = findViewById(R.id.ime_settings_shortcut);
mConfigureImeShortcut.setOnClickListener(this);
// TODO: If configurations for IME are not changed, do not update
// by checking onConfigurationChanged.
@@ -179,9 +177,17 @@
if (view == mConfigureImeShortcut) {
showConfigureInputMethods();
onFinishPanel(true);
- } else if (view == mHardKeyboardSwitch) {
- mHardKeyboardEnabled = mHardKeyboardSwitch.isChecked();
- mHardKeyboardEnabledChangeListener.onHardKeyboardEnabledChange(mHardKeyboardEnabled);
+ }
+ }
+
+ @Override
+ public void onCheckedChanged(CompoundButton button, boolean checked) {
+ if (button == mHardKeyboardSwitch) {
+ if (mHardKeyboardEnabled != checked) {
+ mHardKeyboardEnabled = checked;
+ if (mHardKeyboardEnabledChangeListener != null)
+ mHardKeyboardEnabledChangeListener.onHardKeyboardEnabledChange(checked);
+ }
}
}
@@ -247,9 +253,9 @@
subtypeView, new Pair<InputMethodInfo, InputMethodSubtype> (imi, subtype));
subtypeView.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View view) {
+ public void onClick(View v) {
Pair<InputMethodInfo, InputMethodSubtype> imiAndSubtype =
- updateRadioButtonsByView(view);
+ updateRadioButtonsByView(v);
onFinishPanel(false);
setInputMethodAndSubtype(imiAndSubtype.first, imiAndSubtype.second);
}
@@ -310,7 +316,9 @@
private void updateHardKeyboardSection() {
if (mHardKeyboardAvailable) {
mHardKeyboardSection.setVisibility(View.VISIBLE);
- mHardKeyboardSwitch.setChecked(mHardKeyboardEnabled);
+ if (mHardKeyboardSwitch.isChecked() != mHardKeyboardEnabled) {
+ mHardKeyboardSwitch.setChecked(mHardKeyboardEnabled);
+ }
} else {
mHardKeyboardSection.setVisibility(View.GONE);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
index 22fed63..2ec2af0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
@@ -170,7 +170,7 @@
setContentFrameVisible(n > 0, false);
} else if (mSettingsView == null) {
// we're looking at the notifications; time to maybe make some changes
- if (mNotificationCount != n) {
+ if ((mNotificationCount > 0) != (n > 0)) {
setContentFrameVisible(n > 0, true);
}
}
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index 2343dd8..7f8485b 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -531,7 +531,9 @@
* {@code true} otherwise.
*/
public synchronized boolean getAnyDataEnabled() {
- return (mInternalDataEnabled && mDataEnabled && (enabledCount != 0));
+ boolean result = (mInternalDataEnabled && mDataEnabled && (enabledCount != 0));
+ if (!result && DBG) log("getAnyDataEnabled " + result);
+ return result;
}
protected abstract void startNetStatPoll();
@@ -657,7 +659,13 @@
// disabled apn's still need avail/unavail notificiations - send them out
protected void notifyOffApnsOfAvailability(String reason, boolean availability) {
- if (mAvailability == availability) return;
+ if (mAvailability == availability) {
+ if (DBG) {
+ log("notifyOffApnsOfAvailability: no change in availability, " +
+ "not nofitying about reason='" + reason + "' availability=" + availability);
+ }
+ return;
+ }
mAvailability = availability;
for (int id = 0; id < APN_NUM_TYPES; id++) {
if (!isApnIdEnabled(id)) {
@@ -685,10 +693,13 @@
* @return {@code true} if data connectivity is possible, {@code false} otherwise.
*/
protected boolean isDataPossible() {
- boolean possible = (isDataAllowed()
- && !(getAnyDataEnabled() && (mState == State.FAILED || mState == State.IDLE)));
- if (!possible && DBG && isDataAllowed()) {
- log("Data not possible. No coverage: dataState = " + mState);
+ boolean dataAllowed = isDataAllowed();
+ boolean anyDataEnabled = getAnyDataEnabled();
+ boolean possible = (dataAllowed
+ && !(anyDataEnabled && (mState == State.FAILED || mState == State.IDLE)));
+ if (!possible && DBG) {
+ log("isDataPossible() " + possible + ", dataAllowed=" + dataAllowed +
+ " anyDataEnabled=" + anyDataEnabled + " dataState=" + mState);
}
return possible;
}
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/DelegateMethodAdapter.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/DelegateMethodAdapter.java
index c7968a4..8d7f016 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/DelegateMethodAdapter.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/DelegateMethodAdapter.java
@@ -27,6 +27,8 @@
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
+import java.util.ArrayList;
+
/**
* This method adapter rewrites a method by discarding the original code and generating
* a call to a delegate. Original annotations are passed along unchanged.
@@ -124,7 +126,7 @@
public void generateCode() {
/*
* The goal is to generate a call to a static delegate method.
- * If this method is not-static, the first parameter will be this.
+ * If this method is non-static, the first parameter will be 'this'.
* All the parameters must be passed and then the eventual return type returned.
*
* Example, let's say we have a method such as
@@ -133,9 +135,19 @@
* We'll want to create a body that calls a delegate method like this:
* TheClass_Delegate.method_1(this, a, b, c);
*
+ * If the method is non-static and the class name is an inner class (e.g. has $ in its
+ * last segment), we want to push the 'this' of the outer class first:
+ * OuterClass_InnerClass_Delegate.method_1(
+ * OuterClass.this,
+ * OuterClass$InnerClass.this,
+ * a, b, c);
+ *
+ * Only one level of inner class is supported right now, for simplicity and because
+ * we don't need more.
+ *
* The generated class name is the current class name with "_Delegate" appended to it.
* One thing to realize is that we don't care about generics -- since generic types
- * are erased at runtime, they have no influence on the method being called.
+ * are erased at runtime, they have no influence on the method name being called.
*/
// Add our annotation
@@ -151,34 +163,61 @@
mVisitCodeCalled = true;
}
- int numVars = 0;
+ ArrayList<Type> paramTypes = new ArrayList<Type>();
+ String delegateClassName = mClassName + DELEGATE_SUFFIX;
+ boolean pushedArg0 = false;
+ int maxStack = 0;
- // Push "this" for an instance method, which is always ALOAD 0
+ // For an instance method (e.g. non-static), push the 'this' preceded
+ // by the 'this' of any outer class, if any.
if (!mIsStatic) {
- mParentVisitor.visitVarInsn(Opcodes.ALOAD, numVars++);
+ // Check if the last segment of the class name has inner an class.
+ // Right now we only support one level of inner classes.
+ int slash = mClassName.lastIndexOf('/');
+ int dol = mClassName.lastIndexOf('$');
+ if (dol != -1 && dol > slash && dol == mClassName.indexOf('$')) {
+ String outerClass = mClassName.substring(0, dol);
+ Type outerType = Type.getObjectType(outerClass);
+
+ // Change a delegate class name to "com/foo/Outer_Inner_Delegate"
+ delegateClassName = delegateClassName.replace('$', '_');
+
+ // The first-level inner class has a package-protected member called 'this$0'
+ // that points to the outer class.
+
+ // Push this.getField("this$0") on the call stack.
+ mParentVisitor.visitVarInsn(Opcodes.ALOAD, 0); // var 0 = this
+ mParentVisitor.visitFieldInsn(Opcodes.GETFIELD,
+ mClassName, // class where the field is defined
+ "this$0", // field name
+ outerType.getDescriptor()); // type of the field
+ maxStack++;
+ paramTypes.add(outerType);
+ }
+
+ // Push "this" for the instance method, which is always ALOAD 0
+ mParentVisitor.visitVarInsn(Opcodes.ALOAD, 0);
+ maxStack++;
+ pushedArg0 = true;
+ paramTypes.add(Type.getObjectType(mClassName));
}
- // Push all other arguments
+ // Push all other arguments. Start at arg 1 if we already pushed 'this' above.
Type[] argTypes = Type.getArgumentTypes(mDesc);
+ int maxLocals = pushedArg0 ? 1 : 0;
for (Type t : argTypes) {
int size = t.getSize();
- mParentVisitor.visitVarInsn(t.getOpcode(Opcodes.ILOAD), numVars);
- numVars += size;
+ mParentVisitor.visitVarInsn(t.getOpcode(Opcodes.ILOAD), maxLocals);
+ maxLocals += size;
+ maxStack += size;
+ paramTypes.add(t);
}
- // Construct the descriptor of the delegate. For a static method, it's the same
- // however for an instance method we need to pass the 'this' reference first
- String desc = mDesc;
- if (!mIsStatic) {
- Type[] argTypes2 = new Type[argTypes.length + 1];
-
- argTypes2[0] = Type.getObjectType(mClassName);
- System.arraycopy(argTypes, 0, argTypes2, 1, argTypes.length);
-
- desc = Type.getMethodDescriptor(Type.getReturnType(mDesc), argTypes2);
- }
-
- String delegateClassName = mClassName + DELEGATE_SUFFIX;
+ // Construct the descriptor of the delegate based on the parameters
+ // we pushed on the call stack. The return type remains unchanged.
+ String desc = Type.getMethodDescriptor(
+ Type.getReturnType(mDesc),
+ paramTypes.toArray(new Type[paramTypes.size()]));
// Invoke the static delegate
mParentVisitor.visitMethodInsn(Opcodes.INVOKESTATIC,
@@ -189,7 +228,7 @@
Type returnType = Type.getReturnType(mDesc);
mParentVisitor.visitInsn(returnType.getOpcode(Opcodes.IRETURN));
- mParentVisitor.visitMaxs(numVars, numVars);
+ mParentVisitor.visitMaxs(maxStack, maxLocals);
mParentVisitor.visitEnd();
// For debugging now. Maybe we should collect these and store them in
diff --git a/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/DelegateClassAdapterTest.java b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/DelegateClassAdapterTest.java
index 7d80796..e8b3ea8 100644
--- a/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/DelegateClassAdapterTest.java
+++ b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/DelegateClassAdapterTest.java
@@ -24,25 +24,38 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import com.android.tools.layoutlib.create.dataclass.ClassWithNative;
+import com.android.tools.layoutlib.create.dataclass.OuterClass;
+import com.android.tools.layoutlib.create.dataclass.OuterClass.InnerClass;
+
import org.junit.Before;
import org.junit.Test;
import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
public class DelegateClassAdapterTest {
private MockLog mLog;
- private static final String CLASS_NAME =
- DelegateClassAdapterTest.class.getCanonicalName() + "$" +
- ClassWithNative.class.getSimpleName();
+ private static final String NATIVE_CLASS_NAME = ClassWithNative.class.getCanonicalName();
+ private static final String OUTER_CLASS_NAME = OuterClass.class.getCanonicalName();
+ private static final String INNER_CLASS_NAME = OuterClass.class.getCanonicalName() + "$" +
+ InnerClass.class.getSimpleName();
@Before
public void setUp() throws Exception {
@@ -55,11 +68,11 @@
*/
@SuppressWarnings("unchecked")
@Test
- public void testNoOp() throws Exception {
+ public void testNoOp() throws Throwable {
// create an instance of the class that will be modified
// (load the class in a distinct class loader so that we can trash its definition later)
ClassLoader cl1 = new ClassLoader(this.getClass().getClassLoader()) { };
- Class<ClassWithNative> clazz1 = (Class<ClassWithNative>) cl1.loadClass(CLASS_NAME);
+ Class<ClassWithNative> clazz1 = (Class<ClassWithNative>) cl1.loadClass(NATIVE_CLASS_NAME);
ClassWithNative instance1 = clazz1.newInstance();
assertEquals(42, instance1.add(20, 22));
try {
@@ -73,42 +86,47 @@
ClassWriter cw = new ClassWriter(0 /*flags*/);
HashSet<String> delegateMethods = new HashSet<String>();
- String internalClassName = CLASS_NAME.replace('.', '/');
+ String internalClassName = NATIVE_CLASS_NAME.replace('.', '/');
DelegateClassAdapter cv = new DelegateClassAdapter(
mLog, cw, internalClassName, delegateMethods);
- ClassReader cr = new ClassReader(CLASS_NAME);
+ ClassReader cr = new ClassReader(NATIVE_CLASS_NAME);
cr.accept(cv, 0 /* flags */);
// Load the generated class in a different class loader and try it again
- final byte[] bytes = cw.toByteArray();
- ClassLoader2 cl2 = new ClassLoader2(bytes) {
- @Override
- public void testModifiedInstance() throws Exception {
- Class<?> clazz2 = loadClass(CLASS_NAME);
- Object i2 = clazz2.newInstance();
- assertNotNull(i2);
- assertEquals(42, callAdd(i2, 20, 22));
+ ClassLoader2 cl2 = null;
+ try {
+ cl2 = new ClassLoader2() {
+ @Override
+ public void testModifiedInstance() throws Exception {
+ Class<?> clazz2 = loadClass(NATIVE_CLASS_NAME);
+ Object i2 = clazz2.newInstance();
+ assertNotNull(i2);
+ assertEquals(42, callAdd(i2, 20, 22));
- try {
- callCallNativeInstance(i2, 10, 3.1415, new Object[0]);
- fail("Test should have failed to invoke callTheNativeMethod [2]");
- } catch (InvocationTargetException e) {
- // This is expected to fail since the native method has NOT been
- // overridden here.
- assertEquals(UnsatisfiedLinkError.class, e.getCause().getClass());
+ try {
+ callCallNativeInstance(i2, 10, 3.1415, new Object[0]);
+ fail("Test should have failed to invoke callTheNativeMethod [2]");
+ } catch (InvocationTargetException e) {
+ // This is expected to fail since the native method has NOT been
+ // overridden here.
+ assertEquals(UnsatisfiedLinkError.class, e.getCause().getClass());
+ }
+
+ // Check that the native method does NOT have the new annotation
+ Method[] m = clazz2.getDeclaredMethods();
+ assertEquals("native_instance", m[2].getName());
+ assertTrue(Modifier.isNative(m[2].getModifiers()));
+ Annotation[] a = m[2].getAnnotations();
+ assertEquals(0, a.length);
}
-
- // Check that the native method does NOT have the new annotation
- Method[] m = clazz2.getDeclaredMethods();
- assertEquals("native_instance", m[2].getName());
- assertTrue(Modifier.isNative(m[2].getModifiers()));
- Annotation[] a = m[2].getAnnotations();
- assertEquals(0, a.length);
- }
- };
- cl2.testModifiedInstance();
+ };
+ cl2.add(NATIVE_CLASS_NAME, cw);
+ cl2.testModifiedInstance();
+ } catch (Throwable t) {
+ throw dumpGeneratedClass(t, cl2);
+ }
}
/**
@@ -122,38 +140,37 @@
public void testConstructorsNotSupported() throws IOException {
ClassWriter cw = new ClassWriter(0 /*flags*/);
- String internalClassName = CLASS_NAME.replace('.', '/');
+ String internalClassName = NATIVE_CLASS_NAME.replace('.', '/');
HashSet<String> delegateMethods = new HashSet<String>();
delegateMethods.add("<init>");
DelegateClassAdapter cv = new DelegateClassAdapter(
mLog, cw, internalClassName, delegateMethods);
- ClassReader cr = new ClassReader(CLASS_NAME);
+ ClassReader cr = new ClassReader(NATIVE_CLASS_NAME);
cr.accept(cv, 0 /* flags */);
}
@Test
- public void testDelegateNative() throws Exception {
+ public void testDelegateNative() throws Throwable {
ClassWriter cw = new ClassWriter(0 /*flags*/);
- String internalClassName = CLASS_NAME.replace('.', '/');
+ String internalClassName = NATIVE_CLASS_NAME.replace('.', '/');
HashSet<String> delegateMethods = new HashSet<String>();
delegateMethods.add(DelegateClassAdapter.ALL_NATIVES);
DelegateClassAdapter cv = new DelegateClassAdapter(
mLog, cw, internalClassName, delegateMethods);
- ClassReader cr = new ClassReader(CLASS_NAME);
+ ClassReader cr = new ClassReader(NATIVE_CLASS_NAME);
cr.accept(cv, 0 /* flags */);
// Load the generated class in a different class loader and try it
- final byte[] bytes = cw.toByteArray();
-
+ ClassLoader2 cl2 = null;
try {
- ClassLoader2 cl2 = new ClassLoader2(bytes) {
+ cl2 = new ClassLoader2() {
@Override
public void testModifiedInstance() throws Exception {
- Class<?> clazz2 = loadClass(CLASS_NAME);
+ Class<?> clazz2 = loadClass(NATIVE_CLASS_NAME);
Object i2 = clazz2.newInstance();
assertNotNull(i2);
@@ -173,48 +190,105 @@
assertEquals("LayoutlibDelegate", a[0].annotationType().getSimpleName());
}
};
+ cl2.add(NATIVE_CLASS_NAME, cw);
cl2.testModifiedInstance();
+ } catch (Throwable t) {
+ throw dumpGeneratedClass(t, cl2);
+ }
+ }
- // This code block is useful for debugging. However to make it work you need to
- // pull in the org.objectweb.asm.util.TraceClassVisitor class and associated
- // utilities which are found in the ASM source jar.
- //
- // } catch (Throwable t) {
- // For debugging, dump the bytecode of the class in case of unexpected error.
- // StringWriter sw = new StringWriter();
- // PrintWriter pw = new PrintWriter(sw);
- // TraceClassVisitor tcv = new TraceClassVisitor(pw);
- // ClassReader cr2 = new ClassReader(bytes);
- // cr2.accept(tcv, 0 /* flags */);
- // String msg = "\n" + t.getClass().getCanonicalName();
- // if (t.getMessage() != null) {
- // msg += ": " + t.getMessage();
- // }
- // msg = msg + "\nBytecode dump:\n" + sw.toString();
- // // Re-throw exception with new message
- // RuntimeException ex = new RuntimeException(msg, t);
- // throw ex;
- } finally {
+ @Test
+ public void testDelegateInner() throws Throwable {
+ // We'll delegate the "get" method of both the inner and outer class.
+ HashSet<String> delegateMethods = new HashSet<String>();
+ delegateMethods.add("get");
+
+ // Generate the delegate for the outer class.
+ ClassWriter cwOuter = new ClassWriter(0 /*flags*/);
+ String outerClassName = OUTER_CLASS_NAME.replace('.', '/');
+ DelegateClassAdapter cvOuter = new DelegateClassAdapter(
+ mLog, cwOuter, outerClassName, delegateMethods);
+ ClassReader cr = new ClassReader(OUTER_CLASS_NAME);
+ cr.accept(cvOuter, 0 /* flags */);
+
+ // Generate the delegate for the inner class.
+ ClassWriter cwInner = new ClassWriter(0 /*flags*/);
+ String innerClassName = INNER_CLASS_NAME.replace('.', '/');
+ DelegateClassAdapter cvInner = new DelegateClassAdapter(
+ mLog, cwInner, innerClassName, delegateMethods);
+ cr = new ClassReader(INNER_CLASS_NAME);
+ cr.accept(cvInner, 0 /* flags */);
+
+ // Load the generated classes in a different class loader and try them
+ ClassLoader2 cl2 = null;
+ try {
+ cl2 = new ClassLoader2() {
+ @Override
+ public void testModifiedInstance() throws Exception {
+
+ // Check the outer class
+ Class<?> outerClazz2 = loadClass(OUTER_CLASS_NAME);
+ Object o2 = outerClazz2.newInstance();
+ assertNotNull(o2);
+
+ // The original Outer.get returns 1+10+20,
+ // but the delegate makes it return 4+10+20
+ assertEquals(4+10+20, callGet(o2, 10, 20));
+
+ // Check the inner class. Since it's not a static inner class, we need
+ // to use the hidden constructor that takes the outer class as first parameter.
+ Class<?> innerClazz2 = loadClass(INNER_CLASS_NAME);
+ Constructor<?> innerCons = innerClazz2.getConstructor(
+ new Class<?>[] { outerClazz2 });
+ Object i2 = innerCons.newInstance(new Object[] { o2 });
+ assertNotNull(i2);
+
+ // The original Inner.get returns 3+10+20,
+ // but the delegate makes it return 6+10+20
+ assertEquals(6+10+20, callGet(i2, 10, 20));
+ }
+ };
+ cl2.add(OUTER_CLASS_NAME, cwOuter.toByteArray());
+ cl2.add(INNER_CLASS_NAME, cwInner.toByteArray());
+ cl2.testModifiedInstance();
+ } catch (Throwable t) {
+ throw dumpGeneratedClass(t, cl2);
}
}
//-------
/**
- * A class loader than can define and instantiate our dummy {@link ClassWithNative}.
+ * A class loader than can define and instantiate our modified classes.
* <p/>
- * The trick here is that this class loader will test our modified version of ClassWithNative.
+ * The trick here is that this class loader will test our <em>modified</em> version
+ * of the classes, the one with the delegate calls.
+ * <p/>
* Trying to do so in the original class loader generates all sort of link issues because
* there are 2 different definitions of the same class name. This class loader will
* define and load the class when requested by name and provide helpers to access the
* instance methods via reflection.
*/
private abstract class ClassLoader2 extends ClassLoader {
- private final byte[] mClassWithNative;
- public ClassLoader2(byte[] classWithNative) {
+ private final Map<String, byte[]> mClassDefs = new HashMap<String, byte[]>();
+
+ public ClassLoader2() {
super(null);
- mClassWithNative = classWithNative;
+ }
+
+ public ClassLoader2 add(String className, byte[] definition) {
+ mClassDefs.put(className, definition);
+ return this;
+ }
+
+ public ClassLoader2 add(String className, ClassWriter rewrittenClass) {
+ mClassDefs.put(className, rewrittenClass.toByteArray());
+ return this;
+ }
+
+ private Set<Entry<String, byte[]>> getByteCode() {
+ return mClassDefs.entrySet();
}
@SuppressWarnings("unused")
@@ -224,9 +298,10 @@
return super.findClass(name);
} catch (ClassNotFoundException e) {
- if (CLASS_NAME.equals(name)) {
+ byte[] def = mClassDefs.get(name);
+ if (def != null) {
// Load the modified ClassWithNative from its bytes representation.
- return defineClass(CLASS_NAME, mClassWithNative, 0, mClassWithNative.length);
+ return defineClass(name, def, 0, def.length);
}
try {
@@ -244,6 +319,17 @@
}
/**
+ * Accesses {@link OuterClass#get()} or {@link InnerClass#get() }via reflection.
+ */
+ public int callGet(Object instance, int a, long b) throws Exception {
+ Method m = instance.getClass().getMethod("get",
+ new Class<?>[] { int.class, long.class } );
+
+ Object result = m.invoke(instance, new Object[] { a, b });
+ return ((Integer) result).intValue();
+ }
+
+ /**
* Accesses {@link ClassWithNative#add(int, int)} via reflection.
*/
public int callAdd(Object instance, int a, int b) throws Exception {
@@ -271,34 +357,53 @@
}
/**
- * Dummy test class with a native method.
- * The native method is not defined and any attempt to invoke it will
- * throw an {@link UnsatisfiedLinkError}.
+ * For debugging, it's useful to dump the content of the generated classes
+ * along with the exception that was generated.
+ *
+ * However to make it work you need to pull in the org.objectweb.asm.util.TraceClassVisitor
+ * class and associated utilities which are found in the ASM source jar. Since we don't
+ * want that dependency in the source code, we only put it manually for development and
+ * access the TraceClassVisitor via reflection if present.
+ *
+ * @param t The exception thrown by {@link ClassLoader2#testModifiedInstance()}
+ * @param cl2 The {@link ClassLoader2} instance with the generated bytecode.
+ * @return Either original {@code t} or a new wrapper {@link Throwable}
*/
- public static class ClassWithNative {
- public ClassWithNative() {
- }
+ private Throwable dumpGeneratedClass(Throwable t, ClassLoader2 cl2) {
+ try {
+ // For debugging, dump the bytecode of the class in case of unexpected error
+ // if we can find the TraceClassVisitor class.
+ Class<?> tcvClass = Class.forName("org.objectweb.asm.util.TraceClassVisitor");
- public int add(int a, int b) {
- return a + b;
- }
+ StringBuilder sb = new StringBuilder();
+ sb.append('\n').append(t.getClass().getCanonicalName());
+ if (t.getMessage() != null) {
+ sb.append(": ").append(t.getMessage());
+ }
- public int callNativeInstance(int a, double d, Object[] o) {
- return native_instance(a, d, o);
- }
+ for (Entry<String, byte[]> entry : cl2.getByteCode()) {
+ String className = entry.getKey();
+ byte[] bytes = entry.getValue();
- private native int native_instance(int a, double d, Object[] o);
- }
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ // next 2 lines do: TraceClassVisitor tcv = new TraceClassVisitor(pw);
+ Constructor<?> cons = tcvClass.getConstructor(new Class<?>[] { pw.getClass() });
+ Object tcv = cons.newInstance(new Object[] { pw });
+ ClassReader cr2 = new ClassReader(bytes);
+ cr2.accept((ClassVisitor) tcv, 0 /* flags */);
- /**
- * The delegate that receives the call to {@link ClassWithNative}'s overridden methods.
- */
- public static class ClassWithNative_Delegate {
- public static int native_instance(ClassWithNative instance, int a, double d, Object[] o) {
- if (o != null && o.length > 0) {
- o[0] = instance;
+ sb.append("\nBytecode dump: <").append(className).append(">:\n")
+ .append(sw.toString());
}
- return (int)(a + d);
+
+ // Re-throw exception with new message
+ RuntimeException ex = new RuntimeException(sb.toString(), t);
+ return ex;
+ } catch (Throwable ignore) {
+ // In case of problem, just throw the original exception as-is.
+ return t;
}
}
+
}
diff --git a/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/ClassWithNative.java b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/ClassWithNative.java
new file mode 100644
index 0000000..c314853
--- /dev/null
+++ b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/ClassWithNative.java
@@ -0,0 +1,45 @@
+/*
+ * 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.android.tools.layoutlib.create.dataclass;
+
+import com.android.tools.layoutlib.create.DelegateClassAdapterTest;
+
+/**
+ * Dummy test class with a native method.
+ * The native method is not defined and any attempt to invoke it will
+ * throw an {@link UnsatisfiedLinkError}.
+ *
+ * Used by {@link DelegateClassAdapterTest}.
+ */
+public class ClassWithNative {
+ public ClassWithNative() {
+ }
+
+ public int add(int a, int b) {
+ return a + b;
+ }
+
+ // Note: it's good to have a long or double for testing parameters since they take
+ // 2 slots in the stack/locals maps.
+
+ public int callNativeInstance(int a, double d, Object[] o) {
+ return native_instance(a, d, o);
+ }
+
+ private native int native_instance(int a, double d, Object[] o);
+}
+
diff --git a/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/ClassWithNative_Delegate.java b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/ClassWithNative_Delegate.java
new file mode 100644
index 0000000..a3d4dc6
--- /dev/null
+++ b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/ClassWithNative_Delegate.java
@@ -0,0 +1,34 @@
+/*
+ * 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.android.tools.layoutlib.create.dataclass;
+
+import com.android.tools.layoutlib.create.DelegateClassAdapterTest;
+
+/**
+ * The delegate that receives the call to {@link ClassWithNative_Delegate}'s overridden methods.
+ *
+ * Used by {@link DelegateClassAdapterTest}.
+ */
+public class ClassWithNative_Delegate {
+ public static int native_instance(ClassWithNative instance, int a, double d, Object[] o) {
+ if (o != null && o.length > 0) {
+ o[0] = instance;
+ }
+ return (int)(a + d);
+ }
+}
+
diff --git a/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/OuterClass.java b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/OuterClass.java
new file mode 100644
index 0000000..9dc2f69
--- /dev/null
+++ b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/OuterClass.java
@@ -0,0 +1,48 @@
+/*
+ * 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.tools.layoutlib.create.dataclass;
+
+import com.android.tools.layoutlib.create.DelegateClassAdapterTest;
+
+/**
+ * Test class with an inner class.
+ *
+ * Used by {@link DelegateClassAdapterTest}.
+ */
+public class OuterClass {
+ private int mOuterValue = 1;
+ public OuterClass() {
+ }
+
+ // Outer.get returns 1 + a + b
+ // Note: it's good to have a long or double for testing parameters since they take
+ // 2 slots in the stack/locals maps.
+ public int get(int a, long b) {
+ return mOuterValue + a + (int) b;
+ }
+
+ public class InnerClass {
+ public InnerClass() {
+ }
+
+ // Inner.get returns 1+2=3 + a + b
+ public int get(int a, long b) {
+ return 2 + mOuterValue + a + (int) b;
+ }
+ }
+}
+
diff --git a/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/OuterClass_Delegate.java b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/OuterClass_Delegate.java
new file mode 100644
index 0000000..3252d87
--- /dev/null
+++ b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/OuterClass_Delegate.java
@@ -0,0 +1,30 @@
+/*
+ * 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.tools.layoutlib.create.dataclass;
+
+import com.android.tools.layoutlib.create.DelegateClassAdapterTest;
+
+/**
+ * Used by {@link DelegateClassAdapterTest}.
+ */
+public class OuterClass_Delegate {
+ // The delegate override of Outer.get returns 4 + a + b
+ public static int get(OuterClass instance, int a, long b) {
+ return 4 + a + (int) b;
+ }
+}
+
diff --git a/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/OuterClass_InnerClass_Delegate.java b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/OuterClass_InnerClass_Delegate.java
new file mode 100644
index 0000000..b472220
--- /dev/null
+++ b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/dataclass/OuterClass_InnerClass_Delegate.java
@@ -0,0 +1,30 @@
+/*
+ * 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.tools.layoutlib.create.dataclass;
+
+import com.android.tools.layoutlib.create.DelegateClassAdapterTest;
+import com.android.tools.layoutlib.create.dataclass.OuterClass.InnerClass;
+
+/**
+ * Used by {@link DelegateClassAdapterTest}.
+ */
+public class OuterClass_InnerClass_Delegate {
+ // The delegate override of Inner.get return 6 + a + b
+ public static int get(OuterClass outer, InnerClass inner, int a, long b) {
+ return 6 + a + (int) b;
+ }
+}