diff options
69 files changed, 2069 insertions, 775 deletions
diff --git a/core/java/com/android/internal/app/NetInitiatedActivity.java b/core/java/com/android/internal/app/NetInitiatedActivity.java index 24818a8..03b0957 100755 --- a/core/java/com/android/internal/app/NetInitiatedActivity.java +++ b/core/java/com/android/internal/app/NetInitiatedActivity.java @@ -30,7 +30,6 @@ import android.os.ServiceManager; import android.widget.Toast; import android.util.Log; import android.location.LocationManager; -import com.android.internal.location.GpsLocationProvider; import com.android.internal.location.GpsNetInitiatedHandler; /** diff --git a/core/java/com/android/internal/widget/DigitalClock.java b/core/java/com/android/internal/widget/DigitalClock.java index fa47ff6..23e2277 100644 --- a/core/java/com/android/internal/widget/DigitalClock.java +++ b/core/java/com/android/internal/widget/DigitalClock.java @@ -30,7 +30,7 @@ import android.provider.Settings; import android.text.format.DateFormat; import android.util.AttributeSet; import android.view.View; -import android.widget.LinearLayout; +import android.widget.RelativeLayout; import android.widget.TextView; import java.text.DateFormatSymbols; @@ -39,7 +39,7 @@ import java.util.Calendar; /** * Displays the time */ -public class DigitalClock extends LinearLayout { +public class DigitalClock extends RelativeLayout { private final static String M12 = "h:mm"; private final static String M24 = "kk:mm"; diff --git a/core/jni/Android.mk b/core/jni/Android.mk index 85d1a6f..6d1a414 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -121,7 +121,6 @@ LOCAL_SRC_FILES:= \ android_server_BluetoothA2dpService.cpp \ android_message_digest_sha1.cpp \ android_ddm_DdmHandleNativeHeap.cpp \ - android_location_GpsLocationProvider.cpp \ com_android_internal_os_ZygoteInit.cpp \ com_android_internal_graphics_NativeUtils.cpp \ android_backup_BackupDataInput.cpp \ diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 7f8e854..c9e5bdc 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -154,7 +154,6 @@ extern int register_android_server_BluetoothEventLoop(JNIEnv *env); extern int register_android_server_BluetoothA2dpService(JNIEnv* env); extern int register_android_ddm_DdmHandleNativeHeap(JNIEnv *env); extern int register_com_android_internal_os_ZygoteInit(JNIEnv* env); -extern int register_android_location_GpsLocationProvider(JNIEnv* env); extern int register_android_backup_BackupDataInput(JNIEnv *env); extern int register_android_backup_BackupDataOutput(JNIEnv *env); extern int register_android_backup_FileBackupHelperBase(JNIEnv *env); @@ -1267,7 +1266,6 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_server_BluetoothA2dpService), REG_JNI(register_android_message_digest_sha1), REG_JNI(register_android_ddm_DdmHandleNativeHeap), - REG_JNI(register_android_location_GpsLocationProvider), REG_JNI(register_android_backup_BackupDataInput), REG_JNI(register_android_backup_BackupDataOutput), REG_JNI(register_android_backup_FileBackupHelperBase), diff --git a/core/res/res/layout/keyguard_screen_tab_unlock.xml b/core/res/res/layout/keyguard_screen_tab_unlock.xml index b404955..a4b2357 100644 --- a/core/res/res/layout/keyguard_screen_tab_unlock.xml +++ b/core/res/res/layout/keyguard_screen_tab_unlock.xml @@ -41,20 +41,21 @@ android:ellipsize="marquee" android:gravity="right|bottom" android:textAppearance="?android:attr/textAppearanceMedium" + android:textSize="22sp" /> - <!-- emergency call button shown when sim is missing or PUKd --> - <Button - android:id="@+id/emergencyCallButton" + <!-- "emergency calls only" shown when sim is missing or PUKd --> + <TextView + android:id="@+id/emergencyCallText" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentTop="true" + android:layout_below="@id/carrier" android:layout_alignParentRight="true" - android:layout_marginTop="10dip" + android:layout_marginTop="0dip" android:layout_marginRight="8dip" - android:drawableLeft="@drawable/ic_emergency" - style="@style/Widget.Button.Transparent" - android:drawablePadding="8dip" + android:text="@string/emergency_calls_only" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/white" /> <!-- time and date --> @@ -64,6 +65,7 @@ android:layout_below="@id/carrier" android:layout_marginTop="52dip" android:layout_marginLeft="20dip" + android:layout_marginBottom="8dip" > <TextView android:id="@+id/timeDisplay" @@ -71,7 +73,6 @@ android:layout_height="wrap_content" android:singleLine="true" android:ellipsize="none" - android:gravity="bottom" android:textSize="72sp" android:textAppearance="?android:attr/textAppearanceMedium" android:shadowColor="#C0000000" @@ -84,8 +85,9 @@ <TextView android:id="@+id/am_pm" android:layout_width="wrap_content" - android:layout_height="match_parent" - android:gravity="bottom" + android:layout_height="wrap_content" + android:layout_toRightOf="@id/timeDisplay" + android:layout_alignBaseline="@id/timeDisplay" android:singleLine="true" android:ellipsize="none" android:textSize="22sp" diff --git a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml index 6ee659c..e1c9772 100644 --- a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml +++ b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml @@ -46,18 +46,19 @@ android:ellipsize="marquee" android:gravity="right|bottom" android:textAppearance="?android:attr/textAppearanceMedium" + android:textSize="22sp" /> - <!-- emergency call button shown when sim is missing or PUKd --> - <Button - android:id="@+id/emergencyCallButton" + <!-- "emergency calls only" shown when sim is missing or PUKd --> + <TextView + android:id="@+id/emergencyCallText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginTop="20dip" - android:drawableLeft="@drawable/ic_emergency" - style="@style/Widget.Button.Transparent" - android:drawablePadding="8dip" + android:text="@string/emergency_calls_only" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/white" /> <com.android.internal.widget.DigitalClock android:id="@+id/time" @@ -65,12 +66,12 @@ android:layout_height="wrap_content" android:layout_below="@id/carrier" android:layout_marginTop="56dip" + android:layout_marginBottom="8dip" > <TextView android:id="@+id/timeDisplay" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:gravity="bottom" android:singleLine="true" android:ellipsize="none" android:textSize="72sp" @@ -85,8 +86,9 @@ <TextView android:id="@+id/am_pm" android:layout_width="wrap_content" - android:layout_height="match_parent" - android:gravity="bottom" + android:layout_height="wrap_content" + android:layout_toRightOf="@id/timeDisplay" + android:layout_alignBaseline="@id/timeDisplay" android:singleLine="true" android:ellipsize="none" android:textSize="22sp" diff --git a/core/res/res/layout/keyguard_screen_unlock_landscape.xml b/core/res/res/layout/keyguard_screen_unlock_landscape.xml index c1b406f..83381a1 100644 --- a/core/res/res/layout/keyguard_screen_unlock_landscape.xml +++ b/core/res/res/layout/keyguard_screen_unlock_landscape.xml @@ -58,18 +58,19 @@ android:ellipsize="marquee" android:gravity="right|bottom" /> + <com.android.internal.widget.DigitalClock android:id="@+id/time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_marginTop="8dip" + android:layout_marginBottom="8dip" > <TextView android:id="@+id/timeDisplay" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:gravity="bottom" android:singleLine="true" android:ellipsize="none" android:textSize="72sp" @@ -84,8 +85,9 @@ <TextView android:id="@+id/am_pm" android:layout_width="wrap_content" - android:layout_height="match_parent" - android:gravity="bottom" + android:layout_height="wrap_content" + android:layout_toRightOf="@id/timeDisplay" + android:layout_alignBaseline="@id/timeDisplay" android:singleLine="true" android:ellipsize="none" android:textSize="22sp" diff --git a/core/res/res/layout/keyguard_screen_unlock_portrait.xml b/core/res/res/layout/keyguard_screen_unlock_portrait.xml index 16cd48c..97c4ae9 100644 --- a/core/res/res/layout/keyguard_screen_unlock_portrait.xml +++ b/core/res/res/layout/keyguard_screen_unlock_portrait.xml @@ -55,12 +55,12 @@ android:layout_alignParentTop="true" android:layout_marginTop="15dip" android:layout_marginLeft="20dip" + android:layout_marginBottom="8dip" > <TextView android:id="@+id/timeDisplay" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:gravity="bottom" android:singleLine="true" android:ellipsize="none" android:textSize="56sp" @@ -74,8 +74,9 @@ <TextView android:id="@+id/am_pm" android:layout_width="wrap_content" - android:layout_height="match_parent" - android:gravity="bottom" + android:layout_height="wrap_content" + android:layout_toRightOf="@id/timeDisplay" + android:layout_alignBaseline="@id/timeDisplay" android:singleLine="true" android:ellipsize="none" android:textSize="18sp" diff --git a/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java index ad99ee8..dfb10fb 100644 --- a/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java +++ b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java @@ -28,11 +28,11 @@ import android.widget.ExpandableListView; import junit.framework.Assert; public class ExpandableListTester { - private ExpandableListView mExpandableListView; - private ExpandableListAdapter mAdapter; - private ListUtil mListUtil; + private final ExpandableListView mExpandableListView; + private final ExpandableListAdapter mAdapter; + private final ListUtil mListUtil; - private ActivityInstrumentationTestCase2<? extends ExpandableListScenario> + private final ActivityInstrumentationTestCase2<? extends ExpandableListScenario> mActivityInstrumentation; Instrumentation mInstrumentation; @@ -76,6 +76,8 @@ public class ExpandableListTester { View headerChild = mExpandableListView.getChildAt(index - mExpandableListView.getFirstVisiblePosition()); mExpandableListView.showContextMenuForChild(headerChild); + mInstrumentation.waitForIdleSync(); + Assert.assertNull(menuListener.getErrorMessage(), menuListener.getErrorMessage()); index++; } @@ -92,6 +94,8 @@ public class ExpandableListTester { View groupChild = mExpandableListView.getChildAt(index - mExpandableListView.getFirstVisiblePosition()); mExpandableListView.showContextMenuForChild(groupChild); + mInstrumentation.waitForIdleSync(); + Assert.assertNull(menuListener.getErrorMessage(), menuListener.getErrorMessage()); index++; final int childrenCount = mAdapter.getChildrenCount(groupIndex); @@ -102,6 +106,8 @@ public class ExpandableListTester { View child = mExpandableListView.getChildAt(index - mExpandableListView.getFirstVisiblePosition()); mExpandableListView.showContextMenuForChild(child); + mInstrumentation.waitForIdleSync(); + Assert.assertNull(menuListener.getErrorMessage(), menuListener.getErrorMessage()); index++; } } @@ -115,6 +121,8 @@ public class ExpandableListTester { View footerChild = mExpandableListView.getChildAt(index - mExpandableListView.getFirstVisiblePosition()); mExpandableListView.showContextMenuForChild(footerChild); + mInstrumentation.waitForIdleSync(); + Assert.assertNull(menuListener.getErrorMessage(), menuListener.getErrorMessage()); index++; } diff --git a/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java b/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java index b482005..2dbdff8 100644 --- a/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java +++ b/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java @@ -23,8 +23,6 @@ import android.view.View.OnCreateContextMenuListener; import android.widget.ExpandableListView; import android.widget.AdapterView.AdapterContextMenuInfo; -import junit.framework.Assert; - public class PositionTesterContextMenuListener implements OnCreateContextMenuListener { private int groupPosition, childPosition; @@ -33,6 +31,9 @@ public class PositionTesterContextMenuListener implements OnCreateContextMenuLis private static final int ADAPTER_TYPE = -1; private int testType; // as returned by getPackedPositionType + // Will be set to null by each call to onCreateContextMenu, unless an error occurred. + private String errorMessage; + public void expectGroupContextMenu(int groupPosition) { this.groupPosition = groupPosition; testType = ExpandableListView.PACKED_POSITION_TYPE_GROUP; @@ -50,30 +51,61 @@ public class PositionTesterContextMenuListener implements OnCreateContextMenuLis } public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { + errorMessage = null; if (testType == ADAPTER_TYPE) { - Assert.assertTrue("MenuInfo is not an AdapterContextMenuInfo", - menuInfo instanceof AdapterContextMenuInfo); + if (!isTrue("MenuInfo is not an AdapterContextMenuInfo", + menuInfo instanceof AdapterContextMenuInfo)) { + return; + } AdapterContextMenuInfo adapterContextMenuInfo = (AdapterContextMenuInfo) menuInfo; - Assert.assertEquals("Wrong flat position", - groupPosition, - adapterContextMenuInfo.position); + if (!areEqual("Wrong flat position", groupPosition, adapterContextMenuInfo.position)) { + return; + } } else { - Assert.assertTrue("MenuInfo is not an ExpandableListContextMenuInfo", - menuInfo instanceof ExpandableListView.ExpandableListContextMenuInfo); + if (!isTrue("MenuInfo is not an ExpandableListContextMenuInfo", + menuInfo instanceof ExpandableListView.ExpandableListContextMenuInfo)) { + return; + } ExpandableListView.ExpandableListContextMenuInfo elvMenuInfo = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; long packedPosition = elvMenuInfo.packedPosition; int packedPositionType = ExpandableListView.getPackedPositionType(packedPosition); - Assert.assertEquals("Wrong packed position type", testType, packedPositionType); + if (!areEqual("Wrong packed position type", testType, packedPositionType)) { + return; + } int packedPositionGroup = ExpandableListView.getPackedPositionGroup(packedPosition); - Assert.assertEquals("Wrong group position", groupPosition, packedPositionGroup); + if (!areEqual("Wrong group position", groupPosition, packedPositionGroup)) { + return; + } if (testType == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { - int packedPosChild = ExpandableListView.getPackedPositionChild(packedPosition); - Assert.assertEquals("Wrong child position", childPosition, packedPosChild); + int packedPositionChild = ExpandableListView.getPackedPositionChild(packedPosition); + if (!areEqual("Wrong child position", childPosition, packedPositionChild)) { + return; + } } } } + + private boolean areEqual(String message, int expected, int actual) { + if (expected != actual) { + errorMessage = String.format(message + " (%d vs %d", expected, actual); + return false; + } + return true; + } + + private boolean isTrue(String message, boolean value) { + if (!value) { + errorMessage = message; + return false; + } + return true; + } + + public String getErrorMessage() { + return errorMessage; + } } diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index 17c0778..d32a0b5 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -76,10 +76,30 @@ public class Allocation extends BaseObj { subData1D(0, mType.getElementCount(), d); } + public void subData(int off, FieldPacker fp) { + int eSize = mType.mElement.getSizeBytes(); + final byte[] data = fp.getData(); + + int count = data.length / eSize; + if ((eSize * count) != data.length) { + throw new IllegalArgumentException("Field packer length " + data.length + + " not divisible by element size " + eSize + "."); + } + data1DChecks(off, count, data.length, data.length); + mRS.nAllocationSubData1D(mID, off, count, data, data.length); + } + private void data1DChecks(int off, int count, int len, int dataSize) { mRS.validate(); - if((off < 0) || (count < 1) || ((off + count) > mType.getElementCount())) { - throw new IllegalArgumentException("Offset or Count out of bounds."); + if(off < 0) { + throw new IllegalArgumentException("Offset must be >= 0."); + } + if(count < 1) { + throw new IllegalArgumentException("Count must be >= 1."); + } + if((off + count) > mType.getElementCount()) { + throw new IllegalArgumentException("Overflow, Available count " + mType.getElementCount() + + ", got " + count + " at offset " + off + "."); } if((len) < dataSize) { throw new IllegalArgumentException("Array too small for allocation type."); diff --git a/graphics/java/android/renderscript/Byte2.java b/graphics/java/android/renderscript/Byte2.java new file mode 100644 index 0000000..95cf88c --- /dev/null +++ b/graphics/java/android/renderscript/Byte2.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.renderscript; + +import java.lang.Math; +import android.util.Log; + + +/** + * @hide + * + **/ +public class Byte2 { + public Byte2() { + } + + public byte x; + public byte y; +} + + + + diff --git a/graphics/java/android/renderscript/Byte3.java b/graphics/java/android/renderscript/Byte3.java new file mode 100644 index 0000000..a6c0ca9 --- /dev/null +++ b/graphics/java/android/renderscript/Byte3.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.renderscript; + +import java.lang.Math; +import android.util.Log; + + +/** + * @hide + * + **/ +public class Byte3 { + public Byte3() { + } + + public byte x; + public byte y; + public byte z; +} + + + + diff --git a/graphics/java/android/renderscript/Byte4.java b/graphics/java/android/renderscript/Byte4.java new file mode 100644 index 0000000..a5bfc61 --- /dev/null +++ b/graphics/java/android/renderscript/Byte4.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.renderscript; + +import java.lang.Math; +import android.util.Log; + + +/** + * @hide + * + **/ +public class Byte4 { + public Byte4() { + } + + public byte x; + public byte y; + public byte z; + public byte w; +} + + + diff --git a/graphics/java/android/renderscript/Element.java b/graphics/java/android/renderscript/Element.java index 10ef05a..7b155fe 100644 --- a/graphics/java/android/renderscript/Element.java +++ b/graphics/java/android/renderscript/Element.java @@ -126,6 +126,77 @@ public class Element extends BaseObj { return rs.mElement_USER_F32; } + public static Element USER_ELEMENT(RenderScript rs) { + if(rs.mElement_USER_ELEMENT == null) { + rs.mElement_USER_ELEMENT = createUser(rs, DataType.RS_ELEMENT); + } + return rs.mElement_USER_ELEMENT; + } + + public static Element USER_TYPE(RenderScript rs) { + if(rs.mElement_USER_TYPE == null) { + rs.mElement_USER_TYPE = createUser(rs, DataType.RS_TYPE); + } + return rs.mElement_USER_TYPE; + } + + public static Element USER_ALLOCATION(RenderScript rs) { + if(rs.mElement_USER_ALLOCATION == null) { + rs.mElement_USER_ALLOCATION = createUser(rs, DataType.RS_ALLOCATION); + } + return rs.mElement_USER_ALLOCATION; + } + + public static Element USER_SAMPLER(RenderScript rs) { + if(rs.mElement_USER_SAMPLER == null) { + rs.mElement_USER_SAMPLER = createUser(rs, DataType.RS_SAMPLER); + } + return rs.mElement_USER_SAMPLER; + } + + public static Element USER_SCRIPT(RenderScript rs) { + if(rs.mElement_USER_SCRIPT == null) { + rs.mElement_USER_SCRIPT = createUser(rs, DataType.RS_SCRIPT); + } + return rs.mElement_USER_SCRIPT; + } + + public static Element USER_MESH(RenderScript rs) { + if(rs.mElement_USER_MESH == null) { + rs.mElement_USER_MESH = createUser(rs, DataType.RS_MESH); + } + return rs.mElement_USER_MESH; + } + + public static Element USER_PROGRAM_FRAGMENT(RenderScript rs) { + if(rs.mElement_USER_PROGRAM_FRAGMENT == null) { + rs.mElement_USER_PROGRAM_FRAGMENT = createUser(rs, DataType.RS_PROGRAM_FRAGMENT); + } + return rs.mElement_USER_PROGRAM_FRAGMENT; + } + + public static Element USER_PROGRAM_VERTEX(RenderScript rs) { + if(rs.mElement_USER_PROGRAM_VERTEX == null) { + rs.mElement_USER_PROGRAM_VERTEX = createUser(rs, DataType.RS_PROGRAM_VERTEX); + } + return rs.mElement_USER_PROGRAM_VERTEX; + } + + public static Element USER_PROGRAM_RASTER(RenderScript rs) { + if(rs.mElement_USER_PROGRAM_RASTER == null) { + rs.mElement_USER_PROGRAM_RASTER = createUser(rs, DataType.RS_PROGRAM_RASTER); + } + return rs.mElement_USER_PROGRAM_RASTER; + } + + public static Element USER_PROGRAM_STORE(RenderScript rs) { + if(rs.mElement_USER_PROGRAM_STORE == null) { + rs.mElement_USER_PROGRAM_STORE = createUser(rs, DataType.RS_PROGRAM_STORE); + } + return rs.mElement_USER_PROGRAM_STORE; + } + + public static Element A_8(RenderScript rs) { if(rs.mElement_A_8 == null) { rs.mElement_A_8 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_A); diff --git a/graphics/java/android/renderscript/FieldPacker.java b/graphics/java/android/renderscript/FieldPacker.java index b26e47d..6d55c7e 100644 --- a/graphics/java/android/renderscript/FieldPacker.java +++ b/graphics/java/android/renderscript/FieldPacker.java @@ -33,21 +33,24 @@ public class FieldPacker { } } - void reset() { + public void reset() { mPos = 0; } + public void reset(int i) { + mPos = i; + } - void addI8(byte v) { + public void addI8(byte v) { mData[mPos++] = v; } - void addI16(short v) { + public void addI16(short v) { align(2); mData[mPos++] = (byte)(v & 0xff); mData[mPos++] = (byte)(v >> 8); } - void addI32(int v) { + public void addI32(int v) { align(4); mData[mPos++] = (byte)(v & 0xff); mData[mPos++] = (byte)((v >> 8) & 0xff); @@ -55,7 +58,7 @@ public class FieldPacker { mData[mPos++] = (byte)((v >> 24) & 0xff); } - void addI64(long v) { + public void addI64(long v) { align(8); mData[mPos++] = (byte)(v & 0xff); mData[mPos++] = (byte)((v >> 8) & 0xff); @@ -67,14 +70,14 @@ public class FieldPacker { mData[mPos++] = (byte)((v >> 56) & 0xff); } - void addU8(short v) { + public void addU8(short v) { if ((v < 0) || (v > 0xff)) { throw new IllegalArgumentException("Saving value out of range for type"); } mData[mPos++] = (byte)v; } - void addU16(int v) { + public void addU16(int v) { if ((v < 0) || (v > 0xffff)) { throw new IllegalArgumentException("Saving value out of range for type"); } @@ -83,7 +86,7 @@ public class FieldPacker { mData[mPos++] = (byte)(v >> 8); } - void addU32(long v) { + public void addU32(long v) { if ((v < 0) || (v > 0xffffffff)) { throw new IllegalArgumentException("Saving value out of range for type"); } @@ -94,7 +97,7 @@ public class FieldPacker { mData[mPos++] = (byte)((v >> 24) & 0xff); } - void addU64(long v) { + public void addU64(long v) { if (v < 0) { throw new IllegalArgumentException("Saving value out of range for type"); } @@ -109,15 +112,135 @@ public class FieldPacker { mData[mPos++] = (byte)((v >> 56) & 0xff); } - void addF32(float v) { + public void addF32(float v) { addI32(Float.floatToRawIntBits(v)); } - void addF64(float v) { + public void addF64(float v) { addI64(Double.doubleToRawLongBits(v)); } - final byte[] getData() { + public void addObj(BaseObj obj) { + if (obj != null) { + addI32(obj.getID()); + } else { + addI32(0); + } + } + + public void addF32(Float2 v) { + addF32(v.x); + addF32(v.y); + } + public void addF32(Float3 v) { + addF32(v.x); + addF32(v.y); + addF32(v.z); + } + public void addF32(Float4 v) { + addF32(v.x); + addF32(v.y); + addF32(v.z); + addF32(v.w); + } + + public void addI8(Byte2 v) { + addI8(v.x); + addI8(v.y); + } + public void addI8(Byte3 v) { + addI8(v.x); + addI8(v.y); + addI8(v.z); + } + public void addI8(Byte4 v) { + addI8(v.x); + addI8(v.y); + addI8(v.z); + addI8(v.w); + } + + public void addU8(Short2 v) { + addU8(v.x); + addU8(v.y); + } + public void addU8(Short3 v) { + addU8(v.x); + addU8(v.y); + addU8(v.z); + } + public void addU8(Short4 v) { + addU8(v.x); + addU8(v.y); + addU8(v.z); + addU8(v.w); + } + + public void addI16(Short2 v) { + addI16(v.x); + addI16(v.y); + } + public void addI16(Short3 v) { + addI16(v.x); + addI16(v.y); + addI16(v.z); + } + public void addI16(Short4 v) { + addI16(v.x); + addI16(v.y); + addI16(v.z); + addI16(v.w); + } + + public void addU16(Int2 v) { + addU16(v.x); + addU16(v.y); + } + public void addU16(Int3 v) { + addU16(v.x); + addU16(v.y); + addU16(v.z); + } + public void addU16(Int4 v) { + addU16(v.x); + addU16(v.y); + addU16(v.z); + addU16(v.w); + } + + public void addI32(Int2 v) { + addI32(v.x); + addI32(v.y); + } + public void addI32(Int3 v) { + addI32(v.x); + addI32(v.y); + addI32(v.z); + } + public void addI32(Int4 v) { + addI32(v.x); + addI32(v.y); + addI32(v.z); + addI32(v.w); + } + + public void addU32(Int2 v) { + addU32(v.x); + addU32(v.y); + } + public void addU32(Int3 v) { + addU32(v.x); + addU32(v.y); + addU32(v.z); + } + public void addU32(Int4 v) { + addU32(v.x); + addU32(v.y); + addU32(v.z); + addU32(v.w); + } + + public final byte[] getData() { return mData; } diff --git a/graphics/java/android/renderscript/Vector2f.java b/graphics/java/android/renderscript/Float2.java index 567d57f..8fea91f 100644 --- a/graphics/java/android/renderscript/Vector2f.java +++ b/graphics/java/android/renderscript/Float2.java @@ -24,8 +24,8 @@ import android.util.Log; * @hide * **/ -public class Vector2f { - public Vector2f() { +public class Float2 { + public Float2() { } public float x; diff --git a/graphics/java/android/renderscript/Vector3f.java b/graphics/java/android/renderscript/Float3.java index f2842f3..9d9e406 100644 --- a/graphics/java/android/renderscript/Vector3f.java +++ b/graphics/java/android/renderscript/Float3.java @@ -24,8 +24,8 @@ import android.util.Log; * @hide * **/ -public class Vector3f { - public Vector3f() { +public class Float3 { + public Float3() { } public float x; diff --git a/graphics/java/android/renderscript/Vector4f.java b/graphics/java/android/renderscript/Float4.java index fabd959..a703e80 100644 --- a/graphics/java/android/renderscript/Vector4f.java +++ b/graphics/java/android/renderscript/Float4.java @@ -24,8 +24,8 @@ import android.util.Log; * @hide * **/ -public class Vector4f { - public Vector4f() { +public class Float4 { + public Float4() { } public float x; diff --git a/graphics/java/android/renderscript/Int2.java b/graphics/java/android/renderscript/Int2.java new file mode 100644 index 0000000..56e2fe9 --- /dev/null +++ b/graphics/java/android/renderscript/Int2.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.renderscript; + +import java.lang.Math; +import android.util.Log; + + +/** + * @hide + * + **/ +public class Int2 { + public Int2() { + } + + public int x; + public int y; +} + + + + diff --git a/graphics/java/android/renderscript/Int3.java b/graphics/java/android/renderscript/Int3.java new file mode 100644 index 0000000..1b27509 --- /dev/null +++ b/graphics/java/android/renderscript/Int3.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.renderscript; + +import java.lang.Math; +import android.util.Log; + + +/** + * @hide + * + **/ +public class Int3 { + public Int3() { + } + + public int x; + public int y; + public int z; +} + + + + diff --git a/graphics/java/android/renderscript/Int4.java b/graphics/java/android/renderscript/Int4.java new file mode 100644 index 0000000..3d6f3f5 --- /dev/null +++ b/graphics/java/android/renderscript/Int4.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.renderscript; + +import java.lang.Math; +import android.util.Log; + + +/** + * @hide + * + **/ +public class Int4 { + public Int4() { + } + + public int x; + public int y; + public int z; + public int w; +} + + + diff --git a/graphics/java/android/renderscript/Long2.java b/graphics/java/android/renderscript/Long2.java new file mode 100644 index 0000000..11ead2f --- /dev/null +++ b/graphics/java/android/renderscript/Long2.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.renderscript; + +import java.lang.Math; +import android.util.Log; + + +/** + * @hide + * + **/ +public class Long2 { + public Long2() { + } + + public long x; + public long y; +} + + + + diff --git a/graphics/java/android/renderscript/Long3.java b/graphics/java/android/renderscript/Long3.java new file mode 100644 index 0000000..1604532 --- /dev/null +++ b/graphics/java/android/renderscript/Long3.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.renderscript; + +import java.lang.Math; +import android.util.Log; + + +/** + * @hide + * + **/ +public class Long3 { + public Long3() { + } + + public long x; + public long y; + public long z; +} + + + + diff --git a/graphics/java/android/renderscript/Long4.java b/graphics/java/android/renderscript/Long4.java new file mode 100644 index 0000000..2fd2747 --- /dev/null +++ b/graphics/java/android/renderscript/Long4.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.renderscript; + +import java.lang.Math; +import android.util.Log; + + +/** + * @hide + * + **/ +public class Long4 { + public Long4() { + } + + public long x; + public long y; + public long z; + public long w; +} + + + diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index a935243..db2a3fd 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -203,6 +203,17 @@ public class RenderScript { Element mElement_USER_I32; Element mElement_USER_F32; + Element mElement_USER_ELEMENT; + Element mElement_USER_TYPE; + Element mElement_USER_ALLOCATION; + Element mElement_USER_SAMPLER; + Element mElement_USER_SCRIPT; + Element mElement_USER_MESH; + Element mElement_USER_PROGRAM_FRAGMENT; + Element mElement_USER_PROGRAM_VERTEX; + Element mElement_USER_PROGRAM_RASTER; + Element mElement_USER_PROGRAM_STORE; + Element mElement_A_8; Element mElement_RGB_565; Element mElement_RGB_888; diff --git a/graphics/java/android/renderscript/Script.java b/graphics/java/android/renderscript/Script.java index 57ccfa3..0d21368 100644 --- a/graphics/java/android/renderscript/Script.java +++ b/graphics/java/android/renderscript/Script.java @@ -42,6 +42,10 @@ public class Script extends BaseObj { } } + protected void invoke(int slot) { + mRS.nScriptInvoke(mID, slot); + } + Script(int id, RenderScript rs) { super(rs); mID = id; @@ -145,5 +149,48 @@ public class Script extends BaseObj { } + + public static class FieldBase { + protected Element mElement; + protected Type mType; + protected Allocation mAllocation; + + protected void init(RenderScript rs, int dimx) { + mAllocation = Allocation.createSized(rs, mElement, dimx); + mType = mAllocation.getType(); + } + + protected FieldBase() { + } + + public Element getElement() { + return mElement; + } + + public Type getType() { + return mType; + } + + public Allocation getAllocation() { + return mAllocation; + } + + //@Override + public void updateAllocation() { + } + + + // + /* + public class ScriptField_UserField + extends android.renderscript.Script.FieldBase { + + protected + + } + + */ + + } } diff --git a/graphics/java/android/renderscript/ScriptC.java b/graphics/java/android/renderscript/ScriptC.java index bb99e23..f5d5b2f 100644 --- a/graphics/java/android/renderscript/ScriptC.java +++ b/graphics/java/android/renderscript/ScriptC.java @@ -37,6 +37,47 @@ public class ScriptC extends Script { super(id, rs); } + protected ScriptC(RenderScript rs, Resources resources, int resourceID, boolean isRoot) { + super(0, rs); + mID = internalCreate(rs, resources, resourceID, isRoot); + } + + + private static synchronized int internalCreate(RenderScript rs, Resources resources, int resourceID, boolean isRoot) { + byte[] pgm; + int pgmLength; + InputStream is = resources.openRawResource(resourceID); + try { + try { + pgm = new byte[1024]; + pgmLength = 0; + while(true) { + int bytesLeft = pgm.length - pgmLength; + if (bytesLeft == 0) { + byte[] buf2 = new byte[pgm.length * 2]; + System.arraycopy(pgm, 0, buf2, 0, pgm.length); + pgm = buf2; + bytesLeft = pgm.length - pgmLength; + } + int bytesRead = is.read(pgm, pgmLength, bytesLeft); + if (bytesRead <= 0) { + break; + } + pgmLength += bytesRead; + } + } finally { + is.close(); + } + } catch(IOException e) { + throw new Resources.NotFoundException(); + } + + rs.nScriptCBegin(); + rs.nScriptCSetScript(pgm, 0, pgmLength); + rs.nScriptSetRoot(isRoot); + return rs.nScriptCCreate(); + } + public static class Builder extends Script.Builder { byte[] mProgram; int mProgramLength; diff --git a/graphics/java/android/renderscript/Short2.java b/graphics/java/android/renderscript/Short2.java new file mode 100644 index 0000000..426801f --- /dev/null +++ b/graphics/java/android/renderscript/Short2.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.renderscript; + +import java.lang.Math; +import android.util.Log; + + +/** + * @hide + * + **/ +public class Short2 { + public Short2() { + } + + public short x; + public short y; +} + + + + diff --git a/graphics/java/android/renderscript/Short3.java b/graphics/java/android/renderscript/Short3.java new file mode 100644 index 0000000..7b9c305 --- /dev/null +++ b/graphics/java/android/renderscript/Short3.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.renderscript; + +import java.lang.Math; +import android.util.Log; + + +/** + * @hide + * + **/ +public class Short3 { + public Short3() { + } + + public short x; + public short y; + public short z; +} + + + + diff --git a/graphics/java/android/renderscript/Short4.java b/graphics/java/android/renderscript/Short4.java new file mode 100644 index 0000000..9a474e2 --- /dev/null +++ b/graphics/java/android/renderscript/Short4.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.renderscript; + +import java.lang.Math; +import android.util.Log; + + +/** + * @hide + * + **/ +public class Short4 { + public Short4() { + } + + public short x; + public short y; + public short z; + public short w; +} + + + diff --git a/libs/rs/Android.mk b/libs/rs/Android.mk index 98464a0..0b06022 100644 --- a/libs/rs/Android.mk +++ b/libs/rs/Android.mk @@ -76,16 +76,18 @@ ifneq ($(TARGET_SIMULATOR),true) LOCAL_SRC_FILES:= \ rsAdapter.cpp \ rsAllocation.cpp \ + rsAnimation.cpp \ rsComponent.cpp \ rsContext.cpp \ rsDevice.cpp \ rsElement.cpp \ - rsFileA3D.cpp \ + rsFileA3D.cpp \ rsLight.cpp \ rsLocklessFifo.cpp \ rsObjectBase.cpp \ rsMatrix.cpp \ - rsMesh.cpp \ + rsMesh.cpp \ + rsMutex.cpp \ rsNoise.cpp \ rsProgram.cpp \ rsProgramFragment.cpp \ @@ -96,7 +98,8 @@ LOCAL_SRC_FILES:= \ rsScript.cpp \ rsScriptC.cpp \ rsScriptC_Lib.cpp \ - rsShaderCache.cpp \ + rsShaderCache.cpp \ + rsSignal.cpp \ rsSimpleMesh.cpp \ rsThreadIO.cpp \ rsType.cpp \ diff --git a/libs/rs/RenderScript.h b/libs/rs/RenderScript.h index d280f50..7415ba9 100644 --- a/libs/rs/RenderScript.h +++ b/libs/rs/RenderScript.h @@ -30,6 +30,7 @@ extern "C" { typedef void * RsAdapter1D; typedef void * RsAdapter2D; typedef void * RsAllocation; +typedef void * RsAnimation; typedef void * RsContext; typedef void * RsDevice; typedef void * RsElement; @@ -205,7 +206,27 @@ enum RsPrimitive { enum RsError { RS_ERROR_NONE, RS_ERROR_BAD_SHADER, - RS_ERROR_BAD_SCRIPT + RS_ERROR_BAD_SCRIPT, + RS_ERROR_BAD_VALUE, + RS_ERROR_OUT_OF_MEMORY +}; + +enum RsAnimationInterpolation { + RS_ANIMATION_INTERPOLATION_STEP, + RS_ANIMATION_INTERPOLATION_LINEAR, + RS_ANIMATION_INTERPOLATION_BEZIER, + RS_ANIMATION_INTERPOLATION_CARDINAL, + RS_ANIMATION_INTERPOLATION_HERMITE, + RS_ANIMATION_INTERPOLATION_BSPLINE +}; + +enum RsAnimationEdge { + RS_ANIMATION_EDGE_UNDEFINED, + RS_ANIMATION_EDGE_CONSTANT, + RS_ANIMATION_EDGE_GRADIENT, + RS_ANIMATION_EDGE_CYCLE, + RS_ANIMATION_EDGE_OSCILLATE, + RS_ANIMATION_EDGE_CYLE_RELATIVE }; #ifndef NO_RS_FUNCS diff --git a/libs/rs/java/Fountain/res/raw/fountain2.rs b/libs/rs/java/Fountain/res/raw/fountain2.rs index 3301140..5d36e35 100644 --- a/libs/rs/java/Fountain/res/raw/fountain2.rs +++ b/libs/rs/java/Fountain/res/raw/fountain2.rs @@ -1,9 +1,9 @@ // Fountain test script #pragma version(1) -#include "rs_types.rsh" -#include "rs_math.rsh" -#include "rs_graphics.rsh" +#include "../../../../scriptc/rs_types.rsh" +#include "../../../../scriptc/rs_math.rsh" +#include "../../../../scriptc/rs_graphics.rsh" static int newPart = 0; @@ -12,15 +12,15 @@ typedef struct Control_s { int rate; int count; float r, g, b; - rs_allocation partBuffer; rs_mesh partMesh; + rs_allocation partBuffer; } Control_t; Control_t *Control; typedef struct Point_s{ float2 delta; - float2 position; - unsigned int color; + rs_position2 pos; + rs_color4u color; } Point_t; Point_t *point; @@ -33,8 +33,6 @@ int main(int launchID) { if (rate) { float rMax = ((float)rate) * 0.005f; - int x = Control->x; - int y = Control->y; int color = ((int)(Control->r * 255.f)) | ((int)(Control->g * 255.f)) << 8 | ((int)(Control->b * 255.f)) << 16 | @@ -42,9 +40,11 @@ int main(int launchID) { Point_t * np = &p[newPart]; while (rate--) { - np->delta = vec2Rand(rMax); - np->position.x = x; - np->position.y = y; + np->delta.x = rand(rMax); + np->delta.y = rand(rMax); + //np->delta = vec2Rand(rMax); + np->pos.x = Control->x; + np->pos.y = Control->y; np->color = color; newPart++; np++; @@ -57,13 +57,13 @@ int main(int launchID) { for (ct=0; ct < count; ct++) { float dy = p->delta.y + 0.15f; - float posy = p->position.y + dy; + float posy = p->pos.y + dy; if ((posy > height) && (dy > 0)) { dy *= -0.3f; } p->delta.y = dy; - p->position.x += p->delta.x; - p->position.y = posy; + p->pos.x += p->delta.x; + p->pos.y = posy; p++; } diff --git a/libs/rs/java/ImageProcessing/res/raw/threshold2.rs b/libs/rs/java/ImageProcessing/res/raw/threshold2.rs new file mode 100644 index 0000000..9f687b5 --- /dev/null +++ b/libs/rs/java/ImageProcessing/res/raw/threshold2.rs @@ -0,0 +1,49 @@ +#pragma version(1) + +#include "../../../../scriptc/rs_types.rsh" +#include "../../../../scriptc/rs_math.rsh" +#include "../../../../scriptc/rs_graphics.rsh" + +typedef struct Params_s{ + int inHeight; + int inWidth; + int outHeight; + int outWidth; + float threshold; +} Params_t; + +Params_t * Params; +rs_color4u * InPixel; +rs_color4u * OutPixel; + + +int main() { + int t = uptimeMillis(); + + rs_color4u *in = InPixel; + rs_color4u *out = OutPixel; + + int count = Params->inWidth * Params->inHeight; + int i; + float threshold = Params->threshold * 255.f; + + for (i = 0; i < count; i++) { + float luminance = 0.2125f * in->x + + 0.7154f * in->y + + 0.0721f * in->z; + if (luminance > threshold) { + *out = *in; + } else { + *((int *)out) = *((int *)in) & 0xff000000; + } + + in++; + out++; + } + + t= uptimeMillis() - t; + debugI32("Filter time", t); + + sendToClient(&count, 1, 4, 0); + return 0; +} diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec index cb9937c..08aa369 100644 --- a/libs/rs/rs.spec +++ b/libs/rs/rs.spec @@ -480,3 +480,13 @@ SimpleMeshBindVertex { param uint32_t slot } +AnimationCreate { + param const float *inValues + param const float *outValues + param uint32_t valueCount + param RsAnimationInterpolation interp + param RsAnimationEdge pre + param RsAnimationEdge post + ret RsAnimation + } + diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp index 4e8278d..e5ff1d7 100644 --- a/libs/rs/rsAllocation.cpp +++ b/libs/rs/rsAllocation.cpp @@ -170,6 +170,7 @@ void Allocation::uploadToTexture(const Context *rsc) glGenerateMipmap(GL_TEXTURE_2D); } + rsc->checkError("Allocation::uploadToTexture"); } void Allocation::deferedUploadToBufferObject(const Context *rsc) @@ -201,6 +202,7 @@ void Allocation::uploadToBufferObject(const Context *rsc) glBindBuffer(GL_ARRAY_BUFFER, mBufferID); glBufferData(GL_ARRAY_BUFFER, mType->getSizeBytes(), getPtr(), GL_DYNAMIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); + rsc->checkError("Allocation::uploadToBufferObject"); } void Allocation::uploadCheck(const Context *rsc) diff --git a/libs/rs/rsAnimation.cpp b/libs/rs/rsAnimation.cpp new file mode 100644 index 0000000..48c9334 --- /dev/null +++ b/libs/rs/rsAnimation.cpp @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2009 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. + */ + +#include "rsContext.h" +#include "rsAnimation.h" + + +using namespace android; +using namespace android::renderscript; + +/* +Animation::Animation(Context *rsc) : ObjectBase(rsc) +{ + mAllocFile = __FILE__; + mAllocLine = __LINE__; + + mValuesInput = NULL; + mValuesOutput = NULL; + mValueCount = 0; + mInterpolation = RS_ANIMATION_INTERPOLATION_STEP; + mEdgePre = RS_ANIMATION_EDGE_UNDEFINED; + mEdgePost = RS_ANIMATION_EDGE_UNDEFINED; + mInputMin = 0; + mInputMax = 0; +} + +Animation * Animation::create(Context *rsc, + const float *inValues, const float *outValues, + uint32_t valueCount, RsAnimationInterpolation interp, + RsAnimationEdge pre, RsAnimationEdge post) +{ + if (valueCount < 2) { + rsc->setError(RS_ERROR_BAD_VALUE, "Animations require more than 2 values."); + return NULL; + } + Animation *a = new Animation(rsc); + if (!a) { + rsc->setError(RS_ERROR_OUT_OF_MEMORY); + return NULL; + } + + float *vin = (float *)malloc(valueCount * sizeof(float)); + float *vout = (float *)malloc(valueCount * sizeof(float)); + a->mValuesInput = vin; + a->mValuesOutput = vout; + if (a->mValuesInput == NULL || a->mValuesOutput == NULL) { + delete a; + rsc->setError(RS_ERROR_OUT_OF_MEMORY); + return NULL; + } + + a->mEdgePre = pre; + a->mEdgePost = post; + a->mInterpolation = interp; + a->mValueCount = valueCount; + + memcpy(vin, inValues, valueCount * sizeof(float)); + memcpy(vout, outValues, valueCount * sizeof(float)); + a->mInputMin = inValues[0]; + a->mInputMax = inValues[0]; + + bool needSort = false; + for (uint32_t ct=1; ct < valueCount; ct++) { + if (a->mInputMin > vin[ct]) { + needSort = true; + a->mInputMin = vin[ct]; + } + if (a->mInputMax < vin[ct]) { + a->mInputMax = vin[ct]; + } else { + needSort = true; + } + } + + while (1) { + bool changed = false; + for (uint32_t ct=1; ct < valueCount; ct++) { + if (vin[ct-1] > vin[ct]) { + float t = vin[ct-1]; + vin[ct-1] = vin[ct]; + vin[ct] = t; + t = vout[ct-1]; + vout[ct-1] = vout[ct]; + vout[ct] = t; + changed = true; + } + } + if (!changed) break; + } + + return a; +} +*/ + + +///////////////////////////////////////// +// + +namespace android { +namespace renderscript { + +RsAnimation rsi_AnimationCreate(Context *rsc, + const float *inValues, + const float *outValues, + uint32_t valueCount, + RsAnimationInterpolation interp, + RsAnimationEdge pre, + RsAnimationEdge post) +{ + //LOGE("rsi_ElementCreate %i %i %i %i", dt, dk, norm, vecSize); + Animation *a = NULL;//Animation::create(rsc, inValues, outValues, valueCount, interp, pre, post); + if (a != NULL) { + a->incUserRef(); + } + return (RsAnimation)a; +} + + +} +} + diff --git a/libs/rs/rsAnimation.h b/libs/rs/rsAnimation.h new file mode 100644 index 0000000..b8db661 --- /dev/null +++ b/libs/rs/rsAnimation.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2009 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. + */ + +#ifndef ANDROID_RS_ANIMATION_H +#define ANDROID_RS_ANIMATION_H + +#include "rsUtils.h" +#include "rsObjectBase.h" + +// --------------------------------------------------------------------------- +namespace android { +namespace renderscript { + + +class Animation : public ObjectBase +{ +public: + ~Animation(); + + static Animation * create(Context *rsc, + const float *inValues, const float *outValues, + uint32_t valueCount, RsAnimationInterpolation, + RsAnimationEdge pre, RsAnimationEdge post); + + float eval(float) const; + + +protected: + Animation(Context *rsc); + + + + float evalInRange(float) const; + + + + const float *mValuesInput; + const float *mValuesOutput; + uint32_t mValueCount; + RsAnimationInterpolation mInterpolation; + RsAnimationEdge mEdgePre; + RsAnimationEdge mEdgePost; + + // derived + float mInputMin; + float mInputMax; +}; + + + + +} +} +#endif //ANDROID_STRUCTURED_ELEMENT_H + diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index d8a9a99..4107229 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -664,8 +664,7 @@ void Context::appendNameDefines(String8 *str) const bool Context::objDestroyOOBInit() { - int status = pthread_mutex_init(&mObjDestroy.mMutex, NULL); - if (status) { + if (!mObjDestroy.mMutex.init()) { LOGE("Context::ObjDestroyOOBInit mutex init failure"); return false; } @@ -675,9 +674,8 @@ bool Context::objDestroyOOBInit() void Context::objDestroyOOBRun() { if (mObjDestroy.mNeedToEmpty) { - int status = pthread_mutex_lock(&mObjDestroy.mMutex); - if (status) { - LOGE("Context::ObjDestroyOOBRun: error %i locking for OOBRun.", status); + if (!mObjDestroy.mMutex.lock()) { + LOGE("Context::ObjDestroyOOBRun: error locking for OOBRun."); return; } @@ -686,35 +684,25 @@ void Context::objDestroyOOBRun() } mObjDestroy.mDestroyList.clear(); mObjDestroy.mNeedToEmpty = false; - - status = pthread_mutex_unlock(&mObjDestroy.mMutex); - if (status) { - LOGE("Context::ObjDestroyOOBRun: error %i unlocking for set condition.", status); - } + mObjDestroy.mMutex.unlock(); } } void Context::objDestroyOOBDestroy() { rsAssert(!mObjDestroy.mNeedToEmpty); - pthread_mutex_destroy(&mObjDestroy.mMutex); } void Context::objDestroyAdd(ObjectBase *obj) { - int status = pthread_mutex_lock(&mObjDestroy.mMutex); - if (status) { - LOGE("Context::ObjDestroyOOBRun: error %i locking for OOBRun.", status); + if (!mObjDestroy.mMutex.lock()) { + LOGE("Context::ObjDestroyOOBRun: error locking for OOBRun."); return; } mObjDestroy.mNeedToEmpty = true; mObjDestroy.mDestroyList.add(obj); - - status = pthread_mutex_unlock(&mObjDestroy.mMutex); - if (status) { - LOGE("Context::ObjDestroyOOBRun: error %i unlocking for set condition.", status); - } + mObjDestroy.mMutex.unlock(); } uint32_t Context::getMessageToClient(void *data, size_t *receiveLen, size_t bufferLen, bool wait) diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h index 82c3687..8e755a9 100644 --- a/libs/rs/rsContext.h +++ b/libs/rs/rsContext.h @@ -18,6 +18,7 @@ #define ANDROID_RS_CONTEXT_H #include "rsUtils.h" +#include "rsMutex.h" #include "rsThreadIO.h" #include "rsType.h" @@ -161,7 +162,7 @@ public: void dumpDebug() const; void checkError(const char *) const; const char * getError(RsError *); - void setError(RsError e, const char *msg); + void setError(RsError e, const char *msg = NULL); mutable const ObjectBase * mObjHead; @@ -227,7 +228,7 @@ protected: struct ObjDestroyOOB { - pthread_mutex_t mMutex; + Mutex mMutex; Vector<ObjectBase *> mDestroyList; bool mNeedToEmpty; }; diff --git a/libs/rs/rsLocklessFifo.cpp b/libs/rs/rsLocklessFifo.cpp index c796520..76ca32e 100644 --- a/libs/rs/rsLocklessFifo.cpp +++ b/libs/rs/rsLocklessFifo.cpp @@ -17,7 +17,7 @@ #include "rsLocklessFifo.h" using namespace android; - +using namespace android::renderscript; LocklessCommandFifo::LocklessCommandFifo() { @@ -128,15 +128,19 @@ void LocklessCommandFifo::flush() //dumpState("flush 2"); } +void LocklessCommandFifo::wait() +{ + while(isEmpty() && !mInShutdown) { + mSignalToControl.set(); + mSignalToWorker.wait(); + } +} + const void * LocklessCommandFifo::get(uint32_t *command, uint32_t *bytesData) { while(1) { //dumpState("get"); - while(isEmpty() && !mInShutdown) { - mSignalToControl.set(); - mSignalToWorker.wait(); - } - + wait(); if (mInShutdown) { *command = 0; *bytesData = 0; @@ -192,79 +196,3 @@ void LocklessCommandFifo::dumpState(const char *s) const LOGV("%s put %p, get %p, buf %p, end %p", s, mPut, mGet, mBuffer, mEnd); } -LocklessCommandFifo::Signal::Signal() -{ - mSet = true; -} - -LocklessCommandFifo::Signal::~Signal() -{ - pthread_mutex_destroy(&mMutex); - pthread_cond_destroy(&mCondition); -} - -bool LocklessCommandFifo::Signal::init() -{ - int status = pthread_mutex_init(&mMutex, NULL); - if (status) { - LOGE("LocklessFifo mutex init failure"); - return false; - } - - status = pthread_cond_init(&mCondition, NULL); - if (status) { - LOGE("LocklessFifo condition init failure"); - pthread_mutex_destroy(&mMutex); - return false; - } - - return true; -} - -void LocklessCommandFifo::Signal::set() -{ - int status; - - status = pthread_mutex_lock(&mMutex); - if (status) { - LOGE("LocklessCommandFifo: error %i locking for set condition.", status); - return; - } - - mSet = true; - - status = pthread_cond_signal(&mCondition); - if (status) { - LOGE("LocklessCommandFifo: error %i on set condition.", status); - } - - status = pthread_mutex_unlock(&mMutex); - if (status) { - LOGE("LocklessCommandFifo: error %i unlocking for set condition.", status); - } -} - -void LocklessCommandFifo::Signal::wait() -{ - int status; - - status = pthread_mutex_lock(&mMutex); - if (status) { - LOGE("LocklessCommandFifo: error %i locking for condition.", status); - return; - } - - if (!mSet) { - status = pthread_cond_wait(&mCondition, &mMutex); - if (status) { - LOGE("LocklessCommandFifo: error %i waiting on condition.", status); - } - } - mSet = false; - - status = pthread_mutex_unlock(&mMutex); - if (status) { - LOGE("LocklessCommandFifo: error %i unlocking for condition.", status); - } -} - diff --git a/libs/rs/rsLocklessFifo.h b/libs/rs/rsLocklessFifo.h index d0a4356..ae906ca 100644 --- a/libs/rs/rsLocklessFifo.h +++ b/libs/rs/rsLocklessFifo.h @@ -19,8 +19,10 @@ #include "rsUtils.h" +#include "rsSignal.h" namespace android { +namespace renderscript { // A simple FIFO to be used as a producer / consumer between two @@ -37,24 +39,7 @@ public: LocklessCommandFifo(); ~LocklessCommandFifo(); - protected: - class Signal { - public: - Signal(); - ~Signal(); - - bool init(); - - void set(); - void wait(); - - protected: - bool mSet; - pthread_mutex_t mMutex; - pthread_cond_t mCondition; - }; - uint8_t * volatile mPut; uint8_t * volatile mGet; uint8_t * mBuffer; @@ -65,14 +50,14 @@ protected: Signal mSignalToWorker; Signal mSignalToControl; - - public: void * reserve(uint32_t bytes); void commit(uint32_t command, uint32_t bytes); void commitSync(uint32_t command, uint32_t bytes); void flush(); + void wait(); + const void * get(uint32_t *command, uint32_t *bytesData); void next(); @@ -88,4 +73,5 @@ private: } +} #endif diff --git a/libs/rs/rsMutex.cpp b/libs/rs/rsMutex.cpp new file mode 100644 index 0000000..37752f2 --- /dev/null +++ b/libs/rs/rsMutex.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2009 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. + */ + +#include "rsMutex.h" + +using namespace android; +using namespace android::renderscript; + + +Mutex::Mutex() +{ +} + +Mutex::~Mutex() +{ + pthread_mutex_destroy(&mMutex); +} + +bool Mutex::init() +{ + int status = pthread_mutex_init(&mMutex, NULL); + if (status) { + LOGE("Mutex::Mutex init failure"); + return false; + } + return true; +} + +bool Mutex::lock() +{ + int status; + status = pthread_mutex_lock(&mMutex); + if (status) { + LOGE("Mutex: error %i locking.", status); + return false; + } + return true; +} + +bool Mutex::unlock() +{ + int status; + status = pthread_mutex_unlock(&mMutex); + if (status) { + LOGE("Mutex error %i unlocking.", status); + return false; + } + return true; +} + + diff --git a/libs/rs/rsMutex.h b/libs/rs/rsMutex.h new file mode 100644 index 0000000..47725d7 --- /dev/null +++ b/libs/rs/rsMutex.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2009 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. + */ + +#ifndef ANDROID_RS_MUTEX_H +#define ANDROID_RS_MUTEX_H + + +#include "rsUtils.h" + +namespace android { +namespace renderscript { + +class Mutex { +public: + Mutex(); + ~Mutex(); + + bool init(); + bool lock(); + bool unlock(); + +protected: + pthread_mutex_t mMutex; +}; + +} +} + +#endif + diff --git a/libs/rs/rsSignal.cpp b/libs/rs/rsSignal.cpp new file mode 100644 index 0000000..9239bfd --- /dev/null +++ b/libs/rs/rsSignal.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2009 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. + */ + +#include "rsSignal.h" + +using namespace android; +using namespace android::renderscript; + + +Signal::Signal() +{ + mSet = true; +} + +Signal::~Signal() +{ + pthread_mutex_destroy(&mMutex); + pthread_cond_destroy(&mCondition); +} + +bool Signal::init() +{ + int status = pthread_mutex_init(&mMutex, NULL); + if (status) { + LOGE("LocklessFifo mutex init failure"); + return false; + } + + status = pthread_cond_init(&mCondition, NULL); + if (status) { + LOGE("LocklessFifo condition init failure"); + pthread_mutex_destroy(&mMutex); + return false; + } + + return true; +} + +void Signal::set() +{ + int status; + + status = pthread_mutex_lock(&mMutex); + if (status) { + LOGE("LocklessCommandFifo: error %i locking for set condition.", status); + return; + } + + mSet = true; + + status = pthread_cond_signal(&mCondition); + if (status) { + LOGE("LocklessCommandFifo: error %i on set condition.", status); + } + + status = pthread_mutex_unlock(&mMutex); + if (status) { + LOGE("LocklessCommandFifo: error %i unlocking for set condition.", status); + } +} + +void Signal::wait() +{ + int status; + + status = pthread_mutex_lock(&mMutex); + if (status) { + LOGE("LocklessCommandFifo: error %i locking for condition.", status); + return; + } + + if (!mSet) { + status = pthread_cond_wait(&mCondition, &mMutex); + if (status) { + LOGE("LocklessCommandFifo: error %i waiting on condition.", status); + } + } + mSet = false; + + status = pthread_mutex_unlock(&mMutex); + if (status) { + LOGE("LocklessCommandFifo: error %i unlocking for condition.", status); + } +} + diff --git a/libs/rs/rsSignal.h b/libs/rs/rsSignal.h new file mode 100644 index 0000000..2e760f1 --- /dev/null +++ b/libs/rs/rsSignal.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 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. + */ + +#ifndef ANDROID_RS_SIGNAL_H +#define ANDROID_RS_SIGNAL_H + + +#include "rsUtils.h" + +namespace android { +namespace renderscript { + +class Signal { +public: + Signal(); + ~Signal(); + + bool init(); + + void set(); + void wait(); + +protected: + bool mSet; + pthread_mutex_t mMutex; + pthread_cond_t mCondition; +}; + +} +} + +#endif + diff --git a/libs/rs/rsg_ScriptJavaClass.cpp b/libs/rs/rsg_ScriptJavaClass.cpp index cee9f52..0169b98 100644 --- a/libs/rs/rsg_ScriptJavaClass.cpp +++ b/libs/rs/rsg_ScriptJavaClass.cpp @@ -7,8 +7,12 @@ struct Element; struct ElementField { + // An Element Field is a combination of an Element with a name assigned. + const char *name; Element *e; + + ElementField(const char *n, Element *_e) { name = n; e = _e; @@ -20,12 +24,21 @@ struct ElementField { }; struct Element { + // An Element can take one of two forms. + // 1: Basic. It contains a single basic type and vector size. + // 2: Complex. It contains a list of fields with names. Each field + // will in turn be another element. + ElementField *fields; - size_t fieldCount; + size_t fieldCount; // If field count is 0, the element is a Basic type. const char *name; bool generated; + // The basic data type from RenderScript.h RsDataType compType; + + // The vector size of the data type for float2, float3, .... + // Allowed sizes are 2,3,4,8,16 uint32_t compVectorSize; Element() { diff --git a/libs/rs/scriptc/rs_geom.rsh b/libs/rs/scriptc/rs_geom.rsh new file mode 100644 index 0000000..6e9e9fc --- /dev/null +++ b/libs/rs/scriptc/rs_geom.rsh @@ -0,0 +1,26 @@ + +extern float3 __attribute__((overloadable)) cross(float3, float3); +extern float4 __attribute__((overloadable)) cross(float4, float4); + +//extern float __attribute__((overloadable)) dot(float, float); +extern float __attribute__((overloadable)) dot(float2, float2); +extern float __attribute__((overloadable)) dot(float3, float3); +extern float __attribute__((overloadable)) dot(float4, float4); + +//extern float __attribute__((overloadable)) distance(float, float); +extern float __attribute__((overloadable)) distance(float2, float2); +extern float __attribute__((overloadable)) distance(float3, float3); +extern float __attribute__((overloadable)) distance(float4, float4); + +//extern float __attribute__((overloadable)) length(float); +extern float __attribute__((overloadable)) length(float2); +extern float __attribute__((overloadable)) length(float3); +extern float __attribute__((overloadable)) length(float4); + +extern float2 __attribute__((overloadable)) normalize(float2); +extern float3 __attribute__((overloadable)) normalize(float3); +extern float4 __attribute__((overloadable)) normalize(float4); + + + + diff --git a/libs/rs/scriptc/rs_graphics.rsh b/libs/rs/scriptc/rs_graphics.rsh index 70cd562..0f03732 100644 --- a/libs/rs/scriptc/rs_graphics.rsh +++ b/libs/rs/scriptc/rs_graphics.rsh @@ -1,5 +1,7 @@ +extern float rand(float max); + extern float2 vec2Rand(float len); extern float3 float3Norm(float3); diff --git a/libs/rs/scriptc/rs_math.rsh b/libs/rs/scriptc/rs_math.rsh index 613c7ca..fba0f8f 100644 --- a/libs/rs/scriptc/rs_math.rsh +++ b/libs/rs/scriptc/rs_math.rsh @@ -1,264 +1,262 @@ // Float ops extern float __attribute__((overloadable)) abs(float); -extern float2 __attribute__((overloadable)) abs(float2); -extern float3 __attribute__((overloadable)) abs(float3); -extern float4 __attribute__((overloadable)) abs(float4); -extern float8 __attribute__((overloadable)) abs(float8); -extern float16 __attribute__((overloadable)) abs(float16); +//extern float2 __attribute__((overloadable)) abs(float2); +//extern float3 __attribute__((overloadable)) abs(float3); +//extern float4 __attribute__((overloadable)) abs(float4); +//extern float8 __attribute__((overloadable)) abs(float8); +//extern float16 __attribute__((overloadable)) abs(float16); extern float __attribute__((overloadable)) acos(float); -extern float2 __attribute__((overloadable)) acos(float2); -extern float3 __attribute__((overloadable)) acos(float3); -extern float4 __attribute__((overloadable)) acos(float4); -extern float8 __attribute__((overloadable)) acos(float8); -extern float16 __attribute__((overloadable)) acos(float16); +//extern float2 __attribute__((overloadable)) acos(float2); +//extern float3 __attribute__((overloadable)) acos(float3); +//extern float4 __attribute__((overloadable)) acos(float4); +//extern float8 __attribute__((overloadable)) acos(float8); +//extern float16 __attribute__((overloadable)) acos(float16); extern float __attribute__((overloadable)) asin(float); -extern float2 __attribute__((overloadable)) asin(float2); -extern float3 __attribute__((overloadable)) asin(float3); -extern float4 __attribute__((overloadable)) asin(float4); -extern float8 __attribute__((overloadable)) asin(float8); -extern float16 __attribute__((overloadable)) asin(float16); +//extern float2 __attribute__((overloadable)) asin(float2); +//extern float3 __attribute__((overloadable)) asin(float3); +//extern float4 __attribute__((overloadable)) asin(float4); +//extern float8 __attribute__((overloadable)) asin(float8); +//extern float16 __attribute__((overloadable)) asin(float16); extern float __attribute__((overloadable)) atan(float); -extern float2 __attribute__((overloadable)) atan(float2); -extern float3 __attribute__((overloadable)) atan(float3); -extern float4 __attribute__((overloadable)) atan(float4); -extern float8 __attribute__((overloadable)) atan(float8); -extern float16 __attribute__((overloadable)) atan(float16); +//extern float2 __attribute__((overloadable)) atan(float2); +//extern float3 __attribute__((overloadable)) atan(float3); +//extern float4 __attribute__((overloadable)) atan(float4); +//extern float8 __attribute__((overloadable)) atan(float8); +//extern float16 __attribute__((overloadable)) atan(float16); extern float __attribute__((overloadable)) atan2(float, float); -extern float2 __attribute__((overloadable)) atan2(float2, float2); -extern float3 __attribute__((overloadable)) atan2(float3, float3); -extern float4 __attribute__((overloadable)) atan2(float4, float4); -extern float8 __attribute__((overloadable)) atan2(float8, float8); -extern float16 __attribute__((overloadable)) atan2(float16, float16); +//extern float2 __attribute__((overloadable)) atan2(float2, float2); +//extern float3 __attribute__((overloadable)) atan2(float3, float3); +//extern float4 __attribute__((overloadable)) atan2(float4, float4); +//extern float8 __attribute__((overloadable)) atan2(float8, float8); +//extern float16 __attribute__((overloadable)) atan2(float16, float16); extern float __attribute__((overloadable)) ceil(float); -extern float2 __attribute__((overloadable)) ceil(float2); -extern float3 __attribute__((overloadable)) ceil(float3); -extern float4 __attribute__((overloadable)) ceil(float4); -extern float8 __attribute__((overloadable)) ceil(float8); -extern float16 __attribute__((overloadable)) ceil(float16); +//extern float2 __attribute__((overloadable)) ceil(float2); +//extern float3 __attribute__((overloadable)) ceil(float3); +//extern float4 __attribute__((overloadable)) ceil(float4); +//extern float8 __attribute__((overloadable)) ceil(float8); +//extern float16 __attribute__((overloadable)) ceil(float16); extern float __attribute__((overloadable)) clamp(float, float, float); -extern float2 __attribute__((overloadable)) clamp(float2, float2, float2); -extern float3 __attribute__((overloadable)) clamp(float3, float3, float3); -extern float4 __attribute__((overloadable)) clamp(float4, float4, float4); -extern float8 __attribute__((overloadable)) clamp(float8, float8, float8); -extern float16 __attribute__((overloadable)) clamp(float16, float16, float16); -extern float __attribute__((overloadable)) clamp(float, float, float); -extern float2 __attribute__((overloadable)) clamp(float2, float, float); -extern float3 __attribute__((overloadable)) clamp(float3, float, float); -extern float4 __attribute__((overloadable)) clamp(float4, float, float); -extern float8 __attribute__((overloadable)) clamp(float8, float, float); -extern float16 __attribute__((overloadable)) clamp(float16, float, float); +//extern float2 __attribute__((overloadable)) clamp(float2, float2, float2); +//extern float3 __attribute__((overloadable)) clamp(float3, float3, float3); +//extern float4 __attribute__((overloadable)) clamp(float4, float4, float4); +//extern float8 __attribute__((overloadable)) clamp(float8, float8, float8); +//extern float16 __attribute__((overloadable)) clamp(float16, float16, float16); +//extern float2 __attribute__((overloadable)) clamp(float2, float, float); +//extern float3 __attribute__((overloadable)) clamp(float3, float, float); +//extern float4 __attribute__((overloadable)) clamp(float4, float, float); +//extern float8 __attribute__((overloadable)) clamp(float8, float, float); +//extern float16 __attribute__((overloadable)) clamp(float16, float, float); extern float __attribute__((overloadable)) copysign(float, float); -extern float2 __attribute__((overloadable)) copysign(float2, float2); -extern float3 __attribute__((overloadable)) copysign(float3, float3); -extern float4 __attribute__((overloadable)) copysign(float4, float4); -extern float8 __attribute__((overloadable)) copysign(float8, float8); -extern float16 __attribute__((overloadable)) copysign(float16, float16); +//extern float2 __attribute__((overloadable)) copysign(float2, float2); +//extern float3 __attribute__((overloadable)) copysign(float3, float3); +//extern float4 __attribute__((overloadable)) copysign(float4, float4); +//extern float8 __attribute__((overloadable)) copysign(float8, float8); +//extern float16 __attribute__((overloadable)) copysign(float16, float16); extern float __attribute__((overloadable)) cos(float); -extern float2 __attribute__((overloadable)) cos(float2); -extern float3 __attribute__((overloadable)) cos(float3); -extern float4 __attribute__((overloadable)) cos(float4); -extern float8 __attribute__((overloadable)) cos(float8); -extern float16 __attribute__((overloadable)) cos(float16); +//extern float2 __attribute__((overloadable)) cos(float2); +//extern float3 __attribute__((overloadable)) cos(float3); +//extern float4 __attribute__((overloadable)) cos(float4); +//extern float8 __attribute__((overloadable)) cos(float8); +//extern float16 __attribute__((overloadable)) cos(float16); extern float __attribute__((overloadable)) degrees(float); -extern float2 __attribute__((overloadable)) degrees(float2); -extern float3 __attribute__((overloadable)) degrees(float3); -extern float4 __attribute__((overloadable)) degrees(float4); -extern float8 __attribute__((overloadable)) degrees(float8); -extern float16 __attribute__((overloadable)) degrees(float16); +//extern float2 __attribute__((overloadable)) degrees(float2); +//extern float3 __attribute__((overloadable)) degrees(float3); +//extern float4 __attribute__((overloadable)) degrees(float4); +//extern float8 __attribute__((overloadable)) degrees(float8); +//extern float16 __attribute__((overloadable)) degrees(float16); extern float __attribute__((overloadable)) exp(float); -extern float2 __attribute__((overloadable)) exp(float2); -extern float3 __attribute__((overloadable)) exp(float3); -extern float4 __attribute__((overloadable)) exp(float4); -extern float8 __attribute__((overloadable)) exp(float8); -extern float16 __attribute__((overloadable)) exp(float16); +//extern float2 __attribute__((overloadable)) exp(float2); +//extern float3 __attribute__((overloadable)) exp(float3); +//extern float4 __attribute__((overloadable)) exp(float4); +//extern float8 __attribute__((overloadable)) exp(float8); +//extern float16 __attribute__((overloadable)) exp(float16); extern float __attribute__((overloadable)) exp2(float); -extern float2 __attribute__((overloadable)) exp2(float2); -extern float3 __attribute__((overloadable)) exp2(float3); -extern float4 __attribute__((overloadable)) exp2(float4); -extern float8 __attribute__((overloadable)) exp2(float8); -extern float16 __attribute__((overloadable)) exp2(float16); +//extern float2 __attribute__((overloadable)) exp2(float2); +//extern float3 __attribute__((overloadable)) exp2(float3); +//extern float4 __attribute__((overloadable)) exp2(float4); +//extern float8 __attribute__((overloadable)) exp2(float8); +//extern float16 __attribute__((overloadable)) exp2(float16); extern float __attribute__((overloadable)) exp10(float); -extern float2 __attribute__((overloadable)) exp10(float2); -extern float3 __attribute__((overloadable)) exp10(float3); -extern float4 __attribute__((overloadable)) exp10(float4); -extern float8 __attribute__((overloadable)) exp10(float8); -extern float16 __attribute__((overloadable)) exp10(float16); +//extern float2 __attribute__((overloadable)) exp10(float2); +//extern float3 __attribute__((overloadable)) exp10(float3); +//extern float4 __attribute__((overloadable)) exp10(float4); +//extern float8 __attribute__((overloadable)) exp10(float8); +//extern float16 __attribute__((overloadable)) exp10(float16); extern float __attribute__((overloadable)) fabs(float); -extern float2 __attribute__((overloadable)) fabs(float2); -extern float3 __attribute__((overloadable)) fabs(float3); -extern float4 __attribute__((overloadable)) fabs(float4); -extern float8 __attribute__((overloadable)) fabs(float8); -extern float16 __attribute__((overloadable)) fabs(float16); +//extern float2 __attribute__((overloadable)) fabs(float2); +//extern float3 __attribute__((overloadable)) fabs(float3); +//extern float4 __attribute__((overloadable)) fabs(float4); +//extern float8 __attribute__((overloadable)) fabs(float8); +//extern float16 __attribute__((overloadable)) fabs(float16); extern float __attribute__((overloadable)) floor(float); -extern float2 __attribute__((overloadable)) floor(float2); -extern float3 __attribute__((overloadable)) floor(float3); -extern float4 __attribute__((overloadable)) floor(float4); -extern float8 __attribute__((overloadable)) floor(float8); -extern float16 __attribute__((overloadable)) floor(float16); +//extern float2 __attribute__((overloadable)) floor(float2); +//extern float3 __attribute__((overloadable)) floor(float3); +//extern float4 __attribute__((overloadable)) floor(float4); +//extern float8 __attribute__((overloadable)) floor(float8); +//extern float16 __attribute__((overloadable)) floor(float16); extern float __attribute__((overloadable)) fmax(float, float); -extern float2 __attribute__((overloadable)) fmax(float2, float2); -extern float3 __attribute__((overloadable)) fmax(float3, float3); -extern float4 __attribute__((overloadable)) fmax(float4, float4); -extern float8 __attribute__((overloadable)) fmax(float8, float8); -extern float16 __attribute__((overloadable)) fmax(float16, float16); -extern float2 __attribute__((overloadable)) fmax(float2, float); -extern float3 __attribute__((overloadable)) fmax(float3, float); -extern float4 __attribute__((overloadable)) fmax(float4, float); -extern float8 __attribute__((overloadable)) fmax(float8, float); -extern float16 __attribute__((overloadable)) fmax(float16, float); +//extern float2 __attribute__((overloadable)) fmax(float2, float2); +//extern float3 __attribute__((overloadable)) fmax(float3, float3); +//extern float4 __attribute__((overloadable)) fmax(float4, float4); +//extern float8 __attribute__((overloadable)) fmax(float8, float8); +//extern float16 __attribute__((overloadable)) fmax(float16, float16); +//extern float2 __attribute__((overloadable)) fmax(float2, float); +//extern float3 __attribute__((overloadable)) fmax(float3, float); +//extern float4 __attribute__((overloadable)) fmax(float4, float); +//extern float8 __attribute__((overloadable)) fmax(float8, float); +//extern float16 __attribute__((overloadable)) fmax(float16, float); extern float __attribute__((overloadable)) fmin(float, float); -extern float2 __attribute__((overloadable)) fmin(float2, float2); -extern float3 __attribute__((overloadable)) fmin(float3, float3); -extern float4 __attribute__((overloadable)) fmin(float4, float4); -extern float8 __attribute__((overloadable)) fmin(float8, float8); -extern float16 __attribute__((overloadable)) fmin(float16, float16); -extern float2 __attribute__((overloadable)) fmin(float2, float); -extern float3 __attribute__((overloadable)) fmin(float3, float); -extern float4 __attribute__((overloadable)) fmin(float4, float); -extern float8 __attribute__((overloadable)) fmin(float8, float); -extern float16 __attribute__((overloadable)) fmin(float16, float); +//extern float2 __attribute__((overloadable)) fmin(float2, float2); +//extern float3 __attribute__((overloadable)) fmin(float3, float3); +//extern float4 __attribute__((overloadable)) fmin(float4, float4); +//extern float8 __attribute__((overloadable)) fmin(float8, float8); +//extern float16 __attribute__((overloadable)) fmin(float16, float16); +//extern float2 __attribute__((overloadable)) fmin(float2, float); +//extern float3 __attribute__((overloadable)) fmin(float3, float); +//extern float4 __attribute__((overloadable)) fmin(float4, float); +//extern float8 __attribute__((overloadable)) fmin(float8, float); +//extern float16 __attribute__((overloadable)) fmin(float16, float); extern float __attribute__((overloadable)) fmod(float, float); -extern float2 __attribute__((overloadable)) fmod(float2, float2); -extern float3 __attribute__((overloadable)) fmod(float3, float3); -extern float4 __attribute__((overloadable)) fmod(float4, float4); -extern float8 __attribute__((overloadable)) fmod(float8, float8); -extern float16 __attribute__((overloadable)) fmod(float16, float16); +//extern float2 __attribute__((overloadable)) fmod(float2, float2); +//extern float3 __attribute__((overloadable)) fmod(float3, float3); +//extern float4 __attribute__((overloadable)) fmod(float4, float4); +//extern float8 __attribute__((overloadable)) fmod(float8, float8); +//extern float16 __attribute__((overloadable)) fmod(float16, float16); extern float __attribute__((overloadable)) log(float); -extern float2 __attribute__((overloadable)) log(float2); -extern float3 __attribute__((overloadable)) log(float3); -extern float4 __attribute__((overloadable)) log(float4); -extern float8 __attribute__((overloadable)) log(float8); -extern float16 __attribute__((overloadable)) log(float16); +//extern float2 __attribute__((overloadable)) log(float2); +//extern float3 __attribute__((overloadable)) log(float3); +//extern float4 __attribute__((overloadable)) log(float4); +//extern float8 __attribute__((overloadable)) log(float8); +//extern float16 __attribute__((overloadable)) log(float16); extern float __attribute__((overloadable)) log2(float); -extern float2 __attribute__((overloadable)) log2(float2); -extern float3 __attribute__((overloadable)) log2(float3); -extern float4 __attribute__((overloadable)) log2(float4); -extern float8 __attribute__((overloadable)) log2(float8); -extern float16 __attribute__((overloadable)) log2(float16); +//extern float2 __attribute__((overloadable)) log2(float2); +//extern float3 __attribute__((overloadable)) log2(float3); +//extern float4 __attribute__((overloadable)) log2(float4); +//extern float8 __attribute__((overloadable)) log2(float8); +//extern float16 __attribute__((overloadable)) log2(float16); extern float __attribute__((overloadable)) log10(float); -extern float2 __attribute__((overloadable)) log10(float2); -extern float3 __attribute__((overloadable)) log10(float3); -extern float4 __attribute__((overloadable)) log10(float4); -extern float8 __attribute__((overloadable)) log10(float8); -extern float16 __attribute__((overloadable)) log10(float16); +//extern float2 __attribute__((overloadable)) log10(float2); +//extern float3 __attribute__((overloadable)) log10(float3); +//extern float4 __attribute__((overloadable)) log10(float4); +//extern float8 __attribute__((overloadable)) log10(float8); +//extern float16 __attribute__((overloadable)) log10(float16); extern float __attribute__((overloadable)) max(float, float); -extern float2 __attribute__((overloadable)) max(float2, float2); -extern float3 __attribute__((overloadable)) max(float3, float3); -extern float4 __attribute__((overloadable)) max(float4, float4); -extern float8 __attribute__((overloadable)) max(float8, float8); -extern float16 __attribute__((overloadable)) max(float16, float16); +//extern float2 __attribute__((overloadable)) max(float2, float2); +//extern float3 __attribute__((overloadable)) max(float3, float3); +//extern float4 __attribute__((overloadable)) max(float4, float4); +//extern float8 __attribute__((overloadable)) max(float8, float8); +//extern float16 __attribute__((overloadable)) max(float16, float16); extern float __attribute__((overloadable)) min(float, float); -extern float2 __attribute__((overloadable)) min(float2, float2); -extern float3 __attribute__((overloadable)) min(float3, float3); -extern float4 __attribute__((overloadable)) min(float4, float4); -extern float8 __attribute__((overloadable)) min(float8, float8); -extern float16 __attribute__((overloadable)) min(float16, float16); +//extern float2 __attribute__((overloadable)) min(float2, float2); +//extern float3 __attribute__((overloadable)) min(float3, float3); +//extern float4 __attribute__((overloadable)) min(float4, float4); +//extern float8 __attribute__((overloadable)) min(float8, float8); +//extern float16 __attribute__((overloadable)) min(float16, float16); extern float __attribute__((overloadable)) mix(float, float, float); -extern float2 __attribute__((overloadable)) mix(float2, float2, float2); -extern float3 __attribute__((overloadable)) mix(float3, float3, float3); -extern float4 __attribute__((overloadable)) mix(float4, float4, float4); -extern float8 __attribute__((overloadable)) mix(float8, float8, float8); -extern float16 __attribute__((overloadable)) mix(float16, float16, float16); -extern float __attribute__((overloadable)) mix(float, float, float); -extern float2 __attribute__((overloadable)) mix(float2, float2, float); -extern float3 __attribute__((overloadable)) mix(float3, float3, float); -extern float4 __attribute__((overloadable)) mix(float4, float4, float); -extern float8 __attribute__((overloadable)) mix(float8, float8, float); -extern float16 __attribute__((overloadable)) mix(float16, float16, float); +//extern float2 __attribute__((overloadable)) mix(float2, float2, float2); +//extern float3 __attribute__((overloadable)) mix(float3, float3, float3); +//extern float4 __attribute__((overloadable)) mix(float4, float4, float4); +//extern float8 __attribute__((overloadable)) mix(float8, float8, float8); +//extern float16 __attribute__((overloadable)) mix(float16, float16, float16); +//extern float2 __attribute__((overloadable)) mix(float2, float2, float); +//extern float3 __attribute__((overloadable)) mix(float3, float3, float); +//extern float4 __attribute__((overloadable)) mix(float4, float4, float); +//extern float8 __attribute__((overloadable)) mix(float8, float8, float); +//extern float16 __attribute__((overloadable)) mix(float16, float16, float); extern float __attribute__((overloadable)) pow(float, float); -extern float2 __attribute__((overloadable)) pow(float2, float2); -extern float3 __attribute__((overloadable)) pow(float3, float3); -extern float4 __attribute__((overloadable)) pow(float4, float4); -extern float8 __attribute__((overloadable)) pow(float8, float8); -extern float16 __attribute__((overloadable)) pow(float16, float16); +//extern float2 __attribute__((overloadable)) pow(float2, float2); +//extern float3 __attribute__((overloadable)) pow(float3, float3); +//extern float4 __attribute__((overloadable)) pow(float4, float4); +//extern float8 __attribute__((overloadable)) pow(float8, float8); +//extern float16 __attribute__((overloadable)) pow(float16, float16); extern float __attribute__((overloadable)) radians(float); -extern float2 __attribute__((overloadable)) radians(float2); -extern float3 __attribute__((overloadable)) radians(float3); -extern float4 __attribute__((overloadable)) radians(float4); -extern float8 __attribute__((overloadable)) radians(float8); -extern float16 __attribute__((overloadable)) radians(float16); +//extern float2 __attribute__((overloadable)) radians(float2); +//extern float3 __attribute__((overloadable)) radians(float3); +//extern float4 __attribute__((overloadable)) radians(float4); +//extern float8 __attribute__((overloadable)) radians(float8); +//extern float16 __attribute__((overloadable)) radians(float16); extern float __attribute__((overloadable)) rint(float); -extern float2 __attribute__((overloadable)) rint(float2); -extern float3 __attribute__((overloadable)) rint(float3); -extern float4 __attribute__((overloadable)) rint(float4); -extern float8 __attribute__((overloadable)) rint(float8); -extern float16 __attribute__((overloadable)) rint(float16); +//extern float2 __attribute__((overloadable)) rint(float2); +//extern float3 __attribute__((overloadable)) rint(float3); +//extern float4 __attribute__((overloadable)) rint(float4); +//extern float8 __attribute__((overloadable)) rint(float8); +//extern float16 __attribute__((overloadable)) rint(float16); extern float __attribute__((overloadable)) round(float); -extern float2 __attribute__((overloadable)) round(float2); -extern float3 __attribute__((overloadable)) round(float3); -extern float4 __attribute__((overloadable)) round(float4); -extern float8 __attribute__((overloadable)) round(float8); -extern float16 __attribute__((overloadable)) round(float16); +//extern float2 __attribute__((overloadable)) round(float2); +//extern float3 __attribute__((overloadable)) round(float3); +//extern float4 __attribute__((overloadable)) round(float4); +//extern float8 __attribute__((overloadable)) round(float8); +//extern float16 __attribute__((overloadable)) round(float16); extern float __attribute__((overloadable)) rsqrt(float); -extern float2 __attribute__((overloadable)) rsqrt(float2); -extern float3 __attribute__((overloadable)) rsqrt(float3); -extern float4 __attribute__((overloadable)) rsqrt(float4); -extern float8 __attribute__((overloadable)) rsqrt(float8); -extern float16 __attribute__((overloadable)) rsqrt(float16); +//extern float2 __attribute__((overloadable)) rsqrt(float2); +//extern float3 __attribute__((overloadable)) rsqrt(float3); +//extern float4 __attribute__((overloadable)) rsqrt(float4); +//extern float8 __attribute__((overloadable)) rsqrt(float8); +//extern float16 __attribute__((overloadable)) rsqrt(float16); extern float __attribute__((overloadable)) sign(float); -extern float2 __attribute__((overloadable)) sign(float2); -extern float3 __attribute__((overloadable)) sign(float3); -extern float4 __attribute__((overloadable)) sign(float4); -extern float8 __attribute__((overloadable)) sign(float8); -extern float16 __attribute__((overloadable)) sign(float16); +//extern float2 __attribute__((overloadable)) sign(float2); +//extern float3 __attribute__((overloadable)) sign(float3); +//extern float4 __attribute__((overloadable)) sign(float4); +//extern float8 __attribute__((overloadable)) sign(float8); +//extern float16 __attribute__((overloadable)) sign(float16); extern float __attribute__((overloadable)) sin(float); -extern float2 __attribute__((overloadable)) sin(float2); -extern float3 __attribute__((overloadable)) sin(float3); -extern float4 __attribute__((overloadable)) sin(float4); -extern float8 __attribute__((overloadable)) sin(float8); -extern float16 __attribute__((overloadable)) sin(float16); +//extern float2 __attribute__((overloadable)) sin(float2); +//extern float3 __attribute__((overloadable)) sin(float3); +//extern float4 __attribute__((overloadable)) sin(float4); +//extern float8 __attribute__((overloadable)) sin(float8); +//extern float16 __attribute__((overloadable)) sin(float16); extern float __attribute__((overloadable)) sqrt(float); -extern float2 __attribute__((overloadable)) sqrt(float2); -extern float3 __attribute__((overloadable)) sqrt(float3); -extern float4 __attribute__((overloadable)) sqrt(float4); -extern float8 __attribute__((overloadable)) sqrt(float8); -extern float16 __attribute__((overloadable)) sqrt(float16); +//extern float2 __attribute__((overloadable)) sqrt(float2); +//extern float3 __attribute__((overloadable)) sqrt(float3); +//extern float4 __attribute__((overloadable)) sqrt(float4); +//extern float8 __attribute__((overloadable)) sqrt(float8); +//extern float16 __attribute__((overloadable)) sqrt(float16); extern float __attribute__((overloadable)) tan(float); -extern float2 __attribute__((overloadable)) tan(float2); -extern float3 __attribute__((overloadable)) tan(float3); -extern float4 __attribute__((overloadable)) tan(float4); -extern float8 __attribute__((overloadable)) tan(float8); -extern float16 __attribute__((overloadable)) tan(float16); +//extern float2 __attribute__((overloadable)) tan(float2); +//extern float3 __attribute__((overloadable)) tan(float3); +//extern float4 __attribute__((overloadable)) tan(float4); +//extern float8 __attribute__((overloadable)) tan(float8); +//extern float16 __attribute__((overloadable)) tan(float16); extern float __attribute__((overloadable)) trunc(float); -extern float2 __attribute__((overloadable)) trunc(float2); -extern float3 __attribute__((overloadable)) trunc(float3); -extern float4 __attribute__((overloadable)) trunc(float4); -extern float8 __attribute__((overloadable)) trunc(float8); -extern float16 __attribute__((overloadable)) trunc(float16); +//extern float2 __attribute__((overloadable)) trunc(float2); +//extern float3 __attribute__((overloadable)) trunc(float3); +//extern float4 __attribute__((overloadable)) trunc(float4); +//extern float8 __attribute__((overloadable)) trunc(float8); +//extern float16 __attribute__((overloadable)) trunc(float16); @@ -268,11 +266,11 @@ extern float16 __attribute__((overloadable)) trunc(float16); // Int ops extern int __attribute__((overloadable)) abs(int); -extern int2 __attribute__((overloadable)) abs(int2); -extern int3 __attribute__((overloadable)) abs(int3); -extern int4 __attribute__((overloadable)) abs(int4); -extern int8 __attribute__((overloadable)) abs(int8); -extern int16 __attribute__((overloadable)) abs(int16); +//extern int2 __attribute__((overloadable)) abs(int2); +//extern int3 __attribute__((overloadable)) abs(int3); +//extern int4 __attribute__((overloadable)) abs(int4); +//extern int8 __attribute__((overloadable)) abs(int8); +//extern int16 __attribute__((overloadable)) abs(int16); diff --git a/libs/rs/scriptc/rs_types.rsh b/libs/rs/scriptc/rs_types.rsh index 4198a74..b710146 100644 --- a/libs/rs/scriptc/rs_types.rsh +++ b/libs/rs/scriptc/rs_types.rsh @@ -68,4 +68,29 @@ typedef int int8 __attribute__((ext_vector_type(8))); typedef int int16 __attribute__((ext_vector_type(16))); +// RS_KIND_POSITION +typedef float rs_position1; +typedef float2 rs_position2; +typedef float3 rs_position3; +typedef float4 rs_position4; + +// RS_KIND_COLOR +typedef float3 rs_color3f; +typedef float4 rs_color4f; +typedef uchar4 rs_color4u; + +// RS_KIND_NORMAL +typedef float3 rs_normal; + +// RS_KIND_POINT_SIZE +typedef float rs_point_size; + +// RS_KIND_TEXTURE +typedef float rs_texture_coord1; +typedef float2 rs_texture_coord2; +typedef float3 rs_texture_coord3; +typedef float4 rs_texture_coord4; + +// RS_KIND_INDEX +typedef ushort rs_index; diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index 9e4a16b..28bc599 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -117,6 +117,37 @@ public class LocationManager { */ public static final String KEY_LOCATION_CHANGED = "location"; + /** + * Broadcast intent action indicating that the GPS has either been + * enabled or disabled. An intent extra provides this state as a boolean, + * where {@code true} means enabled. + * @see #EXTRA_GPS_ENABLED + * + * {@hide} + */ + public static final String GPS_ENABLED_CHANGE_ACTION = + "android.location.GPS_ENABLED_CHANGE"; + + /** + * Broadcast intent action indicating that the GPS has either started or + * stopped receiving GPS fixes. An intent extra provides this state as a + * boolean, where {@code true} means that the GPS is actively receiving fixes. + * @see #EXTRA_GPS_ENABLED + * + * {@hide} + */ + public static final String GPS_FIX_CHANGE_ACTION = + "android.location.GPS_FIX_CHANGE"; + + /** + * The lookup key for a boolean that indicates whether GPS is enabled or + * disabled. {@code true} means GPS is enabled. Retrieve it with + * {@link android.content.Intent#getBooleanExtra(String,boolean)}. + * + * {@hide} + */ + public static final String EXTRA_GPS_ENABLED = "enabled"; + // Map from LocationListeners to their associated ListenerTransport objects private HashMap<LocationListener,ListenerTransport> mListeners = new HashMap<LocationListener,ListenerTransport>(); diff --git a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java index a5466d1..d3a71b3 100755 --- a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java +++ b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java @@ -23,6 +23,7 @@ import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; +import android.location.LocationManager; import android.os.Bundle; import android.os.RemoteException; import android.util.Log; @@ -81,7 +82,7 @@ public class GpsNetInitiatedHandler { private final Context mContext; // parent gps location provider - private final GpsLocationProvider mGpsLocationProvider; + private final LocationManager mLocationManager; // configuration of notificaiton behavior private boolean mPlaySounds = false; @@ -93,25 +94,25 @@ public class GpsNetInitiatedHandler { public static class GpsNiNotification { - int notificationId; - int niType; - boolean needNotify; - boolean needVerify; - boolean privacyOverride; - int timeout; - int defaultResponse; - String requestorId; - String text; - int requestorIdEncoding; - int textEncoding; - Bundle extras; + public int notificationId; + public int niType; + public boolean needNotify; + public boolean needVerify; + public boolean privacyOverride; + public int timeout; + public int defaultResponse; + public String requestorId; + public String text; + public int requestorIdEncoding; + public int textEncoding; + public Bundle extras; }; public static class GpsNiResponse { - /* User reponse, one of the values in GpsUserResponseType */ - int userResponse; - /* Optional extra data to pass with the user response */ - Bundle extras; + /* User reponse, one of the values in GpsUserResponseType */ + int userResponse; + /* Optional extra data to pass with the user response */ + Bundle extras; }; /** @@ -122,63 +123,57 @@ public class GpsNetInitiatedHandler { */ private Notification mNiNotification; - public GpsNetInitiatedHandler(Context context, GpsLocationProvider gpsLocationProvider) { - mContext = context; - mGpsLocationProvider = gpsLocationProvider; + public GpsNetInitiatedHandler(Context context) { + mContext = context; + mLocationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); } // Handles NI events from HAL public void handleNiNotification(GpsNiNotification notif) { - if (DEBUG) Log.d(TAG, "handleNiNotification" + " notificationId: " + notif.notificationId - + " requestorId: " + notif.requestorId + " text: " + notif.text); - - // Notify and verify with immediate pop-up - if (notif.needNotify && notif.needVerify && mPopupImmediately) - { - // Popup the dialog box now - openNiDialog(notif); - } - - // Notify only, or delayed pop-up (change mPopupImmediately to FALSE) - if (notif.needNotify && !notif.needVerify || - notif.needNotify && notif.needVerify && !mPopupImmediately) - { - // Show the notification - - // if mPopupImmediately == FALSE and needVerify == TRUE, a dialog will be opened - // when the user opens the notification message - - setNiNotification(notif); - } - - // ACCEPT cases: 1. Notify, no verify; 2. no notify, no verify; 3. privacy override. - if ( notif.needNotify && !notif.needVerify || - !notif.needNotify && !notif.needVerify || - notif.privacyOverride) - { - try { - mGpsLocationProvider.getNetInitiatedListener().sendNiResponse(notif.notificationId, GPS_NI_RESPONSE_ACCEPT); - } - catch (RemoteException e) - { - Log.e(TAG, e.getMessage()); - } - } - - ////////////////////////////////////////////////////////////////////////// - // A note about timeout - // According to the protocol, in the need_notify and need_verify case, - // a default response should be sent when time out. - // - // In some GPS hardware, the GPS driver (under HAL) can handle the timeout case - // and this class GpsNetInitiatedHandler does not need to do anything. - // - // However, the UI should at least close the dialog when timeout. Further, - // for more general handling, timeout response should be added to the Handler here. - // + if (DEBUG) Log.d(TAG, "handleNiNotification" + " notificationId: " + notif.notificationId + + " requestorId: " + notif.requestorId + " text: " + notif.text); + + // Notify and verify with immediate pop-up + if (notif.needNotify && notif.needVerify && mPopupImmediately) + { + // Popup the dialog box now + openNiDialog(notif); + } + + // Notify only, or delayed pop-up (change mPopupImmediately to FALSE) + if (notif.needNotify && !notif.needVerify || + notif.needNotify && notif.needVerify && !mPopupImmediately) + { + // Show the notification + + // if mPopupImmediately == FALSE and needVerify == TRUE, a dialog will be opened + // when the user opens the notification message + + setNiNotification(notif); + } + + // ACCEPT cases: 1. Notify, no verify; 2. no notify, no verify; 3. privacy override. + if ( notif.needNotify && !notif.needVerify || + !notif.needNotify && !notif.needVerify || + notif.privacyOverride) + { + mLocationManager.sendNiResponse(notif.notificationId, GPS_NI_RESPONSE_ACCEPT); + } + + ////////////////////////////////////////////////////////////////////////// + // A note about timeout + // According to the protocol, in the need_notify and need_verify case, + // a default response should be sent when time out. + // + // In some GPS hardware, the GPS driver (under HAL) can handle the timeout case + // and this class GpsNetInitiatedHandler does not need to do anything. + // + // However, the UI should at least close the dialog when timeout. Further, + // for more general handling, timeout response should be added to the Handler here. + // } - + // Sets the NI notification. private synchronized void setNiNotification(GpsNiNotification notif) { NotificationManager notificationManager = (NotificationManager) mContext @@ -186,272 +181,272 @@ public class GpsNetInitiatedHandler { if (notificationManager == null) { return; } - - String title = getNotifTitle(notif); - String message = getNotifMessage(notif); - + + String title = getNotifTitle(notif); + String message = getNotifMessage(notif); + if (DEBUG) Log.d(TAG, "setNiNotification, notifyId: " + notif.notificationId + - ", title: " + title + - ", message: " + message); - - // Construct Notification - if (mNiNotification == null) { - mNiNotification = new Notification(); - mNiNotification.icon = com.android.internal.R.drawable.stat_sys_gps_on; /* Change notification icon here */ - mNiNotification.when = 0; + ", title: " + title + + ", message: " + message); + + // Construct Notification + if (mNiNotification == null) { + mNiNotification = new Notification(); + mNiNotification.icon = com.android.internal.R.drawable.stat_sys_gps_on; /* Change notification icon here */ + mNiNotification.when = 0; } - + if (mPlaySounds) { - mNiNotification.defaults |= Notification.DEFAULT_SOUND; + mNiNotification.defaults |= Notification.DEFAULT_SOUND; } else { - mNiNotification.defaults &= ~Notification.DEFAULT_SOUND; + mNiNotification.defaults &= ~Notification.DEFAULT_SOUND; } - + mNiNotification.flags = Notification.FLAG_ONGOING_EVENT; mNiNotification.tickerText = getNotifTicker(notif); - + // if not to popup dialog immediately, pending intent will open the dialog - Intent intent = !mPopupImmediately ? getDlgIntent(notif) : new Intent(); + Intent intent = !mPopupImmediately ? getDlgIntent(notif) : new Intent(); PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent, 0); mNiNotification.setLatestEventInfo(mContext, title, message, pi); - + if (visible) { notificationManager.notify(notif.notificationId, mNiNotification); } else { notificationManager.cancel(notif.notificationId); } } - + // Opens the notification dialog and waits for user input - private void openNiDialog(GpsNiNotification notif) + private void openNiDialog(GpsNiNotification notif) { - Intent intent = getDlgIntent(notif); - - if (DEBUG) Log.d(TAG, "openNiDialog, notifyId: " + notif.notificationId + - ", requestorId: " + notif.requestorId + - ", text: " + notif.text); + Intent intent = getDlgIntent(notif); - mContext.startActivity(intent); + if (DEBUG) Log.d(TAG, "openNiDialog, notifyId: " + notif.notificationId + + ", requestorId: " + notif.requestorId + + ", text: " + notif.text); + + mContext.startActivity(intent); } - + // Construct the intent for bringing up the dialog activity, which shows the // notification and takes user input private Intent getDlgIntent(GpsNiNotification notif) { - Intent intent = new Intent(); - String title = getDialogTitle(notif); - String message = getDialogMessage(notif); - - // directly bring up the NI activity - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.setClass(mContext, com.android.internal.app.NetInitiatedActivity.class); - - // put data in the intent - intent.putExtra(NI_INTENT_KEY_NOTIF_ID, notif.notificationId); - intent.putExtra(NI_INTENT_KEY_TITLE, title); - intent.putExtra(NI_INTENT_KEY_MESSAGE, message); - intent.putExtra(NI_INTENT_KEY_TIMEOUT, notif.timeout); - intent.putExtra(NI_INTENT_KEY_DEFAULT_RESPONSE, notif.defaultResponse); - - if (DEBUG) Log.d(TAG, "generateIntent, title: " + title + ", message: " + message + - ", timeout: " + notif.timeout); - - return intent; + Intent intent = new Intent(); + String title = getDialogTitle(notif); + String message = getDialogMessage(notif); + + // directly bring up the NI activity + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.setClass(mContext, com.android.internal.app.NetInitiatedActivity.class); + + // put data in the intent + intent.putExtra(NI_INTENT_KEY_NOTIF_ID, notif.notificationId); + intent.putExtra(NI_INTENT_KEY_TITLE, title); + intent.putExtra(NI_INTENT_KEY_MESSAGE, message); + intent.putExtra(NI_INTENT_KEY_TIMEOUT, notif.timeout); + intent.putExtra(NI_INTENT_KEY_DEFAULT_RESPONSE, notif.defaultResponse); + + if (DEBUG) Log.d(TAG, "generateIntent, title: " + title + ", message: " + message + + ", timeout: " + notif.timeout); + + return intent; } - + // Converts a string (or Hex string) to a char array static byte[] stringToByteArray(String original, boolean isHex) { - int length = isHex ? original.length() / 2 : original.length(); - byte[] output = new byte[length]; - int i; - - if (isHex) - { - for (i = 0; i < length; i++) - { - output[i] = (byte) Integer.parseInt(original.substring(i*2, i*2+2), 16); - } - } - else { - for (i = 0; i < length; i++) - { - output[i] = (byte) original.charAt(i); - } - } - - return output; + int length = isHex ? original.length() / 2 : original.length(); + byte[] output = new byte[length]; + int i; + + if (isHex) + { + for (i = 0; i < length; i++) + { + output[i] = (byte) Integer.parseInt(original.substring(i*2, i*2+2), 16); + } + } + else { + for (i = 0; i < length; i++) + { + output[i] = (byte) original.charAt(i); + } + } + + return output; } - + /** * Unpacks an byte array containing 7-bit packed characters into a String. - * + * * @param input a 7-bit packed char array * @return the unpacked String */ static String decodeGSMPackedString(byte[] input) { - final char CHAR_CR = 0x0D; - int nStridx = 0; - int nPckidx = 0; - int num_bytes = input.length; - int cPrev = 0; - int cCurr = 0; - byte nShift; - byte nextChar; - byte[] stringBuf = new byte[input.length * 2]; - String result = ""; - - while(nPckidx < num_bytes) - { - nShift = (byte) (nStridx & 0x07); - cCurr = input[nPckidx++]; - if (cCurr < 0) cCurr += 256; - - /* A 7-bit character can be split at the most between two bytes of packed - ** data. - */ - nextChar = (byte) (( (cCurr << nShift) | (cPrev >> (8-nShift)) ) & 0x7F); - stringBuf[nStridx++] = nextChar; - - /* Special case where the whole of the next 7-bit character fits inside - ** the current byte of packed data. - */ - if(nShift == 6) - { - /* If the next 7-bit character is a CR (0x0D) and it is the last - ** character, then it indicates a padding character. Drop it. - */ - if (nPckidx == num_bytes || (cCurr >> 1) == CHAR_CR) - { - break; - } - - nextChar = (byte) (cCurr >> 1); - stringBuf[nStridx++] = nextChar; - } - - cPrev = cCurr; - } - - try{ - result = new String(stringBuf, 0, nStridx, "US-ASCII"); - } - catch (UnsupportedEncodingException e) - { - Log.e(TAG, e.getMessage()); - } - - return result; + final char CHAR_CR = 0x0D; + int nStridx = 0; + int nPckidx = 0; + int num_bytes = input.length; + int cPrev = 0; + int cCurr = 0; + byte nShift; + byte nextChar; + byte[] stringBuf = new byte[input.length * 2]; + String result = ""; + + while(nPckidx < num_bytes) + { + nShift = (byte) (nStridx & 0x07); + cCurr = input[nPckidx++]; + if (cCurr < 0) cCurr += 256; + + /* A 7-bit character can be split at the most between two bytes of packed + ** data. + */ + nextChar = (byte) (( (cCurr << nShift) | (cPrev >> (8-nShift)) ) & 0x7F); + stringBuf[nStridx++] = nextChar; + + /* Special case where the whole of the next 7-bit character fits inside + ** the current byte of packed data. + */ + if(nShift == 6) + { + /* If the next 7-bit character is a CR (0x0D) and it is the last + ** character, then it indicates a padding character. Drop it. + */ + if (nPckidx == num_bytes || (cCurr >> 1) == CHAR_CR) + { + break; + } + + nextChar = (byte) (cCurr >> 1); + stringBuf[nStridx++] = nextChar; + } + + cPrev = cCurr; + } + + try { + result = new String(stringBuf, 0, nStridx, "US-ASCII"); + } + catch (UnsupportedEncodingException e) + { + Log.e(TAG, e.getMessage()); + } + + return result; } - + static String decodeUTF8String(byte[] input) { - String decoded = ""; - try { - decoded = new String(input, "UTF-8"); - } - catch (UnsupportedEncodingException e) - { - Log.e(TAG, e.getMessage()); - } - return decoded; + String decoded = ""; + try { + decoded = new String(input, "UTF-8"); + } + catch (UnsupportedEncodingException e) + { + Log.e(TAG, e.getMessage()); + } + return decoded; } - + static String decodeUCS2String(byte[] input) { - String decoded = ""; - try { - decoded = new String(input, "UTF-16"); - } - catch (UnsupportedEncodingException e) - { - Log.e(TAG, e.getMessage()); - } - return decoded; + String decoded = ""; + try { + decoded = new String(input, "UTF-16"); + } + catch (UnsupportedEncodingException e) + { + Log.e(TAG, e.getMessage()); + } + return decoded; } - + /** Decode NI string - * + * * @param original The text string to be decoded * @param isHex Specifies whether the content of the string has been encoded as a Hex string. Encoding - * a string as Hex can allow zeros inside the coded text. + * a string as Hex can allow zeros inside the coded text. * @param coding Specifies the coding scheme of the string, such as GSM, UTF8, UCS2, etc. This coding scheme - * needs to match those used passed to HAL from the native GPS driver. Decoding is done according + * needs to match those used passed to HAL from the native GPS driver. Decoding is done according * to the <code> coding </code>, after a Hex string is decoded. Generally, if the - * notification strings don't need further decoding, <code> coding </code> encoding can be + * notification strings don't need further decoding, <code> coding </code> encoding can be * set to -1, and <code> isHex </code> can be false. * @return the decoded string */ static private String decodeString(String original, boolean isHex, int coding) { - String decoded = original; - byte[] input = stringToByteArray(original, isHex); - - switch (coding) { - case GPS_ENC_NONE: - decoded = original; - break; - - case GPS_ENC_SUPL_GSM_DEFAULT: - decoded = decodeGSMPackedString(input); - break; - - case GPS_ENC_SUPL_UTF8: - decoded = decodeUTF8String(input); - break; - - case GPS_ENC_SUPL_UCS2: - decoded = decodeUCS2String(input); - break; - - case GPS_ENC_UNKNOWN: - decoded = original; - break; - - default: - Log.e(TAG, "Unknown encoding " + coding + " for NI text " + original); - break; - } - return decoded; + String decoded = original; + byte[] input = stringToByteArray(original, isHex); + + switch (coding) { + case GPS_ENC_NONE: + decoded = original; + break; + + case GPS_ENC_SUPL_GSM_DEFAULT: + decoded = decodeGSMPackedString(input); + break; + + case GPS_ENC_SUPL_UTF8: + decoded = decodeUTF8String(input); + break; + + case GPS_ENC_SUPL_UCS2: + decoded = decodeUCS2String(input); + break; + + case GPS_ENC_UNKNOWN: + decoded = original; + break; + + default: + Log.e(TAG, "Unknown encoding " + coding + " for NI text " + original); + break; + } + return decoded; } - + // change this to configure notification display static private String getNotifTicker(GpsNiNotification notif) { - String ticker = String.format("Position request! ReqId: [%s] ClientName: [%s]", - decodeString(notif.requestorId, mIsHexInput, notif.requestorIdEncoding), - decodeString(notif.text, mIsHexInput, notif.textEncoding)); - return ticker; + String ticker = String.format("Position request! ReqId: [%s] ClientName: [%s]", + decodeString(notif.requestorId, mIsHexInput, notif.requestorIdEncoding), + decodeString(notif.text, mIsHexInput, notif.textEncoding)); + return ticker; } - + // change this to configure notification display static private String getNotifTitle(GpsNiNotification notif) { - String title = String.format("Position Request"); - return title; + String title = String.format("Position Request"); + return title; } - + // change this to configure notification display static private String getNotifMessage(GpsNiNotification notif) { - String message = String.format( - "NI Request received from [%s] for client [%s]!", - decodeString(notif.requestorId, mIsHexInput, notif.requestorIdEncoding), - decodeString(notif.text, mIsHexInput, notif.textEncoding)); - return message; + String message = String.format( + "NI Request received from [%s] for client [%s]!", + decodeString(notif.requestorId, mIsHexInput, notif.requestorIdEncoding), + decodeString(notif.text, mIsHexInput, notif.textEncoding)); + return message; } - + // change this to configure dialog display (for verification) static public String getDialogTitle(GpsNiNotification notif) { - return getNotifTitle(notif); + return getNotifTitle(notif); } - + // change this to configure dialog display (for verification) static private String getDialogMessage(GpsNiNotification notif) { - return getNotifMessage(notif); + return getNotifMessage(notif); } - + } diff --git a/preloaded-classes b/preloaded-classes index 5672c66..a12c0a0 100644 --- a/preloaded-classes +++ b/preloaded-classes @@ -269,7 +269,6 @@ android.location.ILocationManager$Stub android.location.ILocationManager$Stub$Proxy android.location.Location android.location.LocationManager -android.location.LocationProviderInterface android.media.AudioFormat android.media.AudioManager android.media.AudioRecord @@ -633,7 +632,6 @@ com.android.internal.appwidget.IAppWidgetService$Stub com.android.internal.content.SyncStateContentProviderHelper com.android.internal.graphics.NativeUtils com.android.internal.location.DummyLocationProvider -com.android.internal.location.GpsLocationProvider com.android.internal.logging.AndroidHandler com.android.internal.os.AndroidPrintStream com.android.internal.os.BinderInternal diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java index ef57056..b92480f 100644 --- a/services/java/com/android/server/LocationManagerService.java +++ b/services/java/com/android/server/LocationManagerService.java @@ -16,17 +16,6 @@ package com.android.server; -import java.io.FileDescriptor; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Observable; -import java.util.Observer; -import java.util.Set; - import android.app.Activity; import android.app.PendingIntent; import android.content.BroadcastReceiver; @@ -50,7 +39,6 @@ import android.location.INetInitiatedListener; import android.location.Location; import android.location.LocationManager; import android.location.LocationProvider; -import android.location.LocationProviderInterface; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; @@ -68,12 +56,25 @@ import android.util.Log; import android.util.Slog; import android.util.PrintWriterPrinter; -import com.android.internal.location.GeocoderProxy; -import com.android.internal.location.GpsLocationProvider; import com.android.internal.location.GpsNetInitiatedHandler; -import com.android.internal.location.LocationProviderProxy; -import com.android.internal.location.MockProvider; -import com.android.internal.location.PassiveProvider; + +import com.android.server.location.GeocoderProxy; +import com.android.server.location.GpsLocationProvider; +import com.android.server.location.LocationProviderInterface; +import com.android.server.location.LocationProviderProxy; +import com.android.server.location.MockProvider; +import com.android.server.location.PassiveProvider; + +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Observable; +import java.util.Observer; +import java.util.Set; /** * The service class that manages LocationProviders and issues location @@ -461,10 +462,11 @@ public class LocationManagerService extends ILocationManager.Stub implements Run mEnabledProviders.add(passiveProvider.getName()); // initialize external network location and geocoder services + PackageManager pm = mContext. getPackageManager(); Resources resources = mContext.getResources(); String serviceName = resources.getString( com.android.internal.R.string.config_networkLocationProvider); - if (serviceName != null) { + if (serviceName != null && pm.resolveService(new Intent(serviceName), 0) != null) { mNetworkLocationProvider = new LocationProviderProxy(mContext, LocationManager.NETWORK_PROVIDER, serviceName, mLocationHandler); @@ -472,7 +474,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run } serviceName = resources.getString(com.android.internal.R.string.config_geocodeProvider); - if (serviceName != null) { + if (serviceName != null && pm.resolveService(new Intent(serviceName), 0) != null) { mGeocodeProvider = new GeocoderProxy(mContext, serviceName); } diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java index e4d7623..76e0d74 100644 --- a/services/java/com/android/server/WifiService.java +++ b/services/java/com/android/server/WifiService.java @@ -268,7 +268,7 @@ public class WifiService extends IWifiManager.Stub { boolean wifiEnabled = getPersistedWifiEnabled() || testAndClearWifiSavedState(); Slog.i(TAG, "WifiService starting up with Wi-Fi " + (wifiEnabled ? "enabled" : "disabled")); - setWifiEnabledBlocking(wifiEnabled, true, Process.myUid()); + setWifiEnabled(wifiEnabled); } private void updateTetherState(ArrayList<String> available, ArrayList<String> tethered) { @@ -1857,10 +1857,10 @@ public class WifiService extends IWifiManager.Stub { switch (msg.what) { case MESSAGE_ENABLE_WIFI: + setWifiEnabledBlocking(true, msg.arg1 == 1, msg.arg2); if (mWifiWatchdogService == null) { mWifiWatchdogService = new WifiWatchdogService(mContext, mWifiStateTracker); } - setWifiEnabledBlocking(true, msg.arg1 == 1, msg.arg2); sWakeLock.release(); break; @@ -1878,10 +1878,7 @@ public class WifiService extends IWifiManager.Stub { // a non-zero msg.arg1 value means the "enabled" setting // should be persisted setWifiEnabledBlocking(false, msg.arg1 == 1, msg.arg2); - if (mWifiWatchdogService != null) { - mWifiWatchdogService.quit(); - mWifiWatchdogService = null; - } + mWifiWatchdogService = null; sWakeLock.release(); break; diff --git a/services/java/com/android/server/WifiWatchdogService.java b/services/java/com/android/server/WifiWatchdogService.java index e2c523d..87f8a6e 100644 --- a/services/java/com/android/server/WifiWatchdogService.java +++ b/services/java/com/android/server/WifiWatchdogService.java @@ -251,7 +251,6 @@ public class WifiWatchdogService { private void registerForWifiBroadcasts() { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); - intentFilter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION); intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); mContext.registerReceiver(mReceiver, intentFilter); } @@ -276,7 +275,7 @@ public class WifiWatchdogService { /** * Unregister broadcasts and quit the watchdog thread */ - public void quit() { + private void quit() { unregisterForWifiBroadcasts(); mContext.getContentResolver().unregisterContentObserver(mContentObserver); mHandler.removeAllActions(); @@ -1117,9 +1116,6 @@ public class WifiWatchdogService { if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) { handleNetworkStateChanged( (NetworkInfo) intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO)); - } else if (action.equals(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION)) { - handleSupplicantConnectionChanged( - intent.getBooleanExtra(WifiManager.EXTRA_SUPPLICANT_CONNECTED, false)); } else if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) { handleWifiStateChanged(intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_UNKNOWN)); @@ -1153,15 +1149,9 @@ public class WifiWatchdogService { } } - private void handleSupplicantConnectionChanged(boolean connected) { - if (!connected) { - onDisconnected(); - } - } - private void handleWifiStateChanged(int wifiState) { if (wifiState == WifiManager.WIFI_STATE_DISABLED) { - onDisconnected(); + quit(); } else if (wifiState == WifiManager.WIFI_STATE_ENABLED) { onEnabled(); } diff --git a/location/java/com/android/internal/location/GeocoderProxy.java b/services/java/com/android/server/location/GeocoderProxy.java index b06297b..3c05da2 100644 --- a/location/java/com/android/internal/location/GeocoderProxy.java +++ b/services/java/com/android/server/location/GeocoderProxy.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.internal.location; +package com.android.server.location; import android.content.ComponentName; import android.content.Context; diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java index 15d692c..daa198f 100755 --- a/location/java/com/android/internal/location/GpsLocationProvider.java +++ b/services/java/com/android/server/location/GpsLocationProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.internal.location; +package com.android.server.location; import android.app.AlarmManager; import android.app.PendingIntent; @@ -30,7 +30,6 @@ import android.location.INetInitiatedListener; import android.location.Location; import android.location.LocationManager; import android.location.LocationProvider; -import android.location.LocationProviderInterface; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.SntpClient; @@ -77,37 +76,6 @@ public class GpsLocationProvider implements LocationProviderInterface { private static final boolean DEBUG = false; private static final boolean VERBOSE = false; - /** - * Broadcast intent action indicating that the GPS has either been - * enabled or disabled. An intent extra provides this state as a boolean, - * where {@code true} means enabled. - * @see #EXTRA_ENABLED - * - * {@hide} - */ - public static final String GPS_ENABLED_CHANGE_ACTION = - "android.location.GPS_ENABLED_CHANGE"; - - /** - * Broadcast intent action indicating that the GPS has either started or - * stopped receiving GPS fixes. An intent extra provides this state as a - * boolean, where {@code true} means that the GPS is actively receiving fixes. - * @see #EXTRA_ENABLED - * - * {@hide} - */ - public static final String GPS_FIX_CHANGE_ACTION = - "android.location.GPS_FIX_CHANGE"; - - /** - * The lookup key for a boolean that indicates whether GPS is enabled or - * disabled. {@code true} means GPS is enabled. Retrieve it with - * {@link android.content.Intent#getBooleanExtra(String,boolean)}. - * - * {@hide} - */ - public static final String EXTRA_ENABLED = "enabled"; - // these need to match GpsPositionMode enum in gps.h private static final int GPS_POSITION_MODE_STANDALONE = 0; private static final int GPS_POSITION_MODE_MS_BASED = 1; @@ -348,7 +316,7 @@ public class GpsLocationProvider implements LocationProviderInterface { public GpsLocationProvider(Context context, ILocationManager locationManager) { mContext = context; mLocationManager = locationManager; - mNIHandler = new GpsNetInitiatedHandler(context, this); + mNIHandler = new GpsNetInitiatedHandler(context); mLocation.setExtras(mLocationExtras); @@ -1031,8 +999,8 @@ public class GpsLocationProvider implements LocationProviderInterface { } // send an intent to notify that the GPS is receiving fixes. - Intent intent = new Intent(GPS_FIX_CHANGE_ACTION); - intent.putExtra(EXTRA_ENABLED, true); + Intent intent = new Intent(LocationManager.GPS_FIX_CHANGE_ACTION); + intent.putExtra(LocationManager.EXTRA_GPS_ENABLED, true); mContext.sendBroadcast(intent); updateStatus(LocationProvider.AVAILABLE, mSvCount); } @@ -1108,8 +1076,8 @@ public class GpsLocationProvider implements LocationProviderInterface { } // send an intent to notify that the GPS has been enabled or disabled. - Intent intent = new Intent(GPS_ENABLED_CHANGE_ACTION); - intent.putExtra(EXTRA_ENABLED, mNavigating); + Intent intent = new Intent(LocationManager.GPS_ENABLED_CHANGE_ACTION); + intent.putExtra(LocationManager.EXTRA_GPS_ENABLED, mNavigating); mContext.sendBroadcast(intent); } @@ -1165,8 +1133,8 @@ public class GpsLocationProvider implements LocationProviderInterface { if (mNavigating && mStatus == LocationProvider.AVAILABLE && mLastFixTime > 0 && System.currentTimeMillis() - mLastFixTime > RECENT_FIX_TIMEOUT * 1000) { // send an intent to notify that the GPS is no longer receiving fixes. - Intent intent = new Intent(GPS_FIX_CHANGE_ACTION); - intent.putExtra(EXTRA_ENABLED, false); + Intent intent = new Intent(LocationManager.GPS_FIX_CHANGE_ACTION); + intent.putExtra(LocationManager.EXTRA_GPS_ENABLED, false); mContext.sendBroadcast(intent); updateStatus(LocationProvider.TEMPORARILY_UNAVAILABLE, mSvCount); } diff --git a/location/java/com/android/internal/location/GpsXtraDownloader.java b/services/java/com/android/server/location/GpsXtraDownloader.java index 978bda2..bc96980 100644 --- a/location/java/com/android/internal/location/GpsXtraDownloader.java +++ b/services/java/com/android/server/location/GpsXtraDownloader.java @@ -14,7 +14,13 @@ * limitations under the License. */ -package com.android.internal.location; +package com.android.server.location; + +import android.content.Context; +import android.net.Proxy; +import android.net.http.AndroidHttpClient; +import android.util.Config; +import android.util.Log; import org.apache.http.HttpEntity; import org.apache.http.HttpHost; @@ -30,14 +36,6 @@ import java.io.IOException; import java.util.Properties; import java.util.Random; -import android.content.Context; -import android.net.Proxy; -import android.net.http.AndroidHttpClient; -import android.util.Config; -import android.util.Log; - - - /** * A class for downloading GPS XTRA data. * diff --git a/location/java/android/location/LocationProviderInterface.java b/services/java/com/android/server/location/LocationProviderInterface.java index 5ffe15c..a472143 100644 --- a/location/java/android/location/LocationProviderInterface.java +++ b/services/java/com/android/server/location/LocationProviderInterface.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.location; +package com.android.server.location; import android.location.Location; import android.net.NetworkInfo; diff --git a/location/java/com/android/internal/location/LocationProviderProxy.java b/services/java/com/android/server/location/LocationProviderProxy.java index 31ec09a..3e118f9 100644 --- a/location/java/com/android/internal/location/LocationProviderProxy.java +++ b/services/java/com/android/server/location/LocationProviderProxy.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.internal.location; +package com.android.server.location; import android.content.ComponentName; import android.content.Context; @@ -22,7 +22,6 @@ import android.content.Intent; import android.content.ServiceConnection; import android.location.ILocationProvider; import android.location.Location; -import android.location.LocationProviderInterface; import android.net.NetworkInfo; import android.os.Bundle; import android.os.Handler; @@ -31,6 +30,8 @@ import android.os.RemoteException; import android.os.SystemClock; import android.util.Log; +import com.android.internal.location.DummyLocationProvider; + /** * A class for proxying location providers implemented as services. * diff --git a/location/java/com/android/internal/location/MockProvider.java b/services/java/com/android/server/location/MockProvider.java index d912740..e3f3346 100644 --- a/location/java/com/android/internal/location/MockProvider.java +++ b/services/java/com/android/server/location/MockProvider.java @@ -14,12 +14,11 @@ * limitations under the License. */ -package com.android.internal.location; +package com.android.server.location; import android.location.ILocationManager; import android.location.Location; import android.location.LocationProvider; -import android.location.LocationProviderInterface; import android.net.NetworkInfo; import android.os.Bundle; import android.os.RemoteException; diff --git a/location/java/com/android/internal/location/PassiveProvider.java b/services/java/com/android/server/location/PassiveProvider.java index ab90937..5ed1558 100644 --- a/location/java/com/android/internal/location/PassiveProvider.java +++ b/services/java/com/android/server/location/PassiveProvider.java @@ -14,13 +14,12 @@ * limitations under the License. */ -package com.android.internal.location; +package com.android.server.location; import android.location.ILocationManager; import android.location.Location; import android.location.LocationManager; import android.location.LocationProvider; -import android.location.LocationProviderInterface; import android.net.NetworkInfo; import android.os.Bundle; import android.os.RemoteException; diff --git a/services/java/com/android/server/status/StatusBarPolicy.java b/services/java/com/android/server/status/StatusBarPolicy.java index 55840e2..efb1a06 100644 --- a/services/java/com/android/server/status/StatusBarPolicy.java +++ b/services/java/com/android/server/status/StatusBarPolicy.java @@ -30,6 +30,7 @@ import android.content.IntentFilter; import android.content.res.TypedArray; import android.graphics.PixelFormat; import android.graphics.drawable.Drawable; +import android.location.LocationManager; import android.media.AudioManager; import android.media.Ringtone; import android.media.RingtoneManager; @@ -62,7 +63,6 @@ import android.widget.TextView; import com.android.internal.R; import com.android.internal.app.IBatteryStats; -import com.android.internal.location.GpsLocationProvider; import com.android.internal.telephony.IccCard; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.cdma.EriInfo; @@ -387,8 +387,8 @@ public class StatusBarPolicy { action.equals(WifiManager.RSSI_CHANGED_ACTION)) { updateWifi(intent); } - else if (action.equals(GpsLocationProvider.GPS_ENABLED_CHANGE_ACTION) || - action.equals(GpsLocationProvider.GPS_FIX_CHANGE_ACTION)) { + else if (action.equals(LocationManager.GPS_ENABLED_CHANGE_ACTION) || + action.equals(LocationManager.GPS_FIX_CHANGE_ACTION)) { updateGps(intent); } else if (action.equals(AudioManager.RINGER_MODE_CHANGED_ACTION) || @@ -533,8 +533,8 @@ public class StatusBarPolicy { filter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION); filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); filter.addAction(WifiManager.RSSI_CHANGED_ACTION); - filter.addAction(GpsLocationProvider.GPS_ENABLED_CHANGE_ACTION); - filter.addAction(GpsLocationProvider.GPS_FIX_CHANGE_ACTION); + filter.addAction(LocationManager.GPS_ENABLED_CHANGE_ACTION); + filter.addAction(LocationManager.GPS_FIX_CHANGE_ACTION); filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); filter.addAction(TtyIntent.TTY_ENABLED_CHANGE_ACTION); mContext.registerReceiver(mIntentReceiver, filter, null, mHandler); @@ -1286,13 +1286,13 @@ public class StatusBarPolicy { private final void updateGps(Intent intent) { final String action = intent.getAction(); - final boolean enabled = intent.getBooleanExtra(GpsLocationProvider.EXTRA_ENABLED, false); + final boolean enabled = intent.getBooleanExtra(LocationManager.EXTRA_GPS_ENABLED, false); - if (action.equals(GpsLocationProvider.GPS_FIX_CHANGE_ACTION) && enabled) { + if (action.equals(LocationManager.GPS_FIX_CHANGE_ACTION) && enabled) { // GPS is getting fixes mService.updateIcon(mGpsIcon, mGpsFixIconData, null); mService.setIconVisibility(mGpsIcon, true); - } else if (action.equals(GpsLocationProvider.GPS_ENABLED_CHANGE_ACTION) && !enabled) { + } else if (action.equals(LocationManager.GPS_ENABLED_CHANGE_ACTION) && !enabled) { // GPS is off mService.setIconVisibility(mGpsIcon, false); } else { diff --git a/services/jni/Android.mk b/services/jni/Android.mk index 9d2760e..b90e327 100644 --- a/services/jni/Android.mk +++ b/services/jni/Android.mk @@ -9,6 +9,7 @@ LOCAL_SRC_FILES:= \ com_android_server_SensorService.cpp \ com_android_server_SystemServer.cpp \ com_android_server_VibratorService.cpp \ + com_android_server_location_GpsLocationProvider.cpp \ onload.cpp LOCAL_C_INCLUDES += \ diff --git a/core/jni/android_location_GpsLocationProvider.cpp b/services/jni/com_android_server_location_GpsLocationProvider.cpp index a3be309..003f109 100755 --- a/core/jni/android_location_GpsLocationProvider.cpp +++ b/services/jni/com_android_server_location_GpsLocationProvider.cpp @@ -523,9 +523,9 @@ static JNINativeMethod sMethods[] = { {"native_get_internal_state", "()Ljava/lang/String;", (void*)android_location_GpsLocationProvider_get_internal_state}, }; -int register_android_location_GpsLocationProvider(JNIEnv* env) +int register_android_server_location_GpsLocationProvider(JNIEnv* env) { - return jniRegisterNativeMethods(env, "com/android/internal/location/GpsLocationProvider", sMethods, NELEM(sMethods)); + return jniRegisterNativeMethods(env, "com/android/server/location/GpsLocationProvider", sMethods, NELEM(sMethods)); } } /* namespace android */ diff --git a/services/jni/onload.cpp b/services/jni/onload.cpp index c16fdb8..d11e7e1 100644 --- a/services/jni/onload.cpp +++ b/services/jni/onload.cpp @@ -11,6 +11,7 @@ int register_android_server_LightsService(JNIEnv* env); int register_android_server_SensorService(JNIEnv* env); int register_android_server_VibratorService(JNIEnv* env); int register_android_server_SystemServer(JNIEnv* env); +int register_android_server_location_GpsLocationProvider(JNIEnv* env); }; using namespace android; @@ -33,6 +34,7 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) register_android_server_SensorService(env); register_android_server_VibratorService(env); register_android_server_SystemServer(env); + register_android_server_location_GpsLocationProvider(env); return JNI_VERSION_1_4; } |
