Merge "Add glOrtho equivalent to the OpenGL ES 2.0 renderer."
diff --git a/api/current.xml b/api/current.xml
index 851e9c2..b9c9fe9 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -58339,6 +58339,17 @@
visibility="public"
>
</method>
+<method name="getWrappedCursor"
+ return="android.database.Cursor"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="isAfterLast"
return="boolean"
abstract="false"
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 7625c04..2fb746c 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -1131,7 +1131,7 @@
try {
// If the intent was created from a suggestion, it will always have an explicit
// component here.
- Log.i(LOG_TAG, "Starting (as ourselves) " + intent.toURI());
+ Log.i(LOG_TAG, "Starting (as ourselves) " + intent.toUri(0));
getContext().startActivity(intent);
// If the search switches to a different activity,
// SearchDialogWrapper#performActivityResuming
diff --git a/core/java/android/bluetooth/BluetoothClass.java b/core/java/android/bluetooth/BluetoothClass.java
index c7fea9e..0c9bab2 100644
--- a/core/java/android/bluetooth/BluetoothClass.java
+++ b/core/java/android/bluetooth/BluetoothClass.java
@@ -259,6 +259,8 @@
public static final int PROFILE_A2DP = 1;
/** @hide */
public static final int PROFILE_OPP = 2;
+ /** @hide */
+ public static final int PROFILE_HID = 3;
/**
* Check class bits for possible bluetooth profile support.
@@ -324,6 +326,8 @@
default:
return false;
}
+ } else if (profile == PROFILE_HID) {
+ return (getDeviceClass() & Device.Major.PERIPHERAL) == Device.Major.PERIPHERAL;
} else {
return false;
}
diff --git a/core/java/android/bluetooth/BluetoothUuid.java b/core/java/android/bluetooth/BluetoothUuid.java
index 1909e03..f1ee907 100644
--- a/core/java/android/bluetooth/BluetoothUuid.java
+++ b/core/java/android/bluetooth/BluetoothUuid.java
@@ -50,7 +50,7 @@
public static final ParcelUuid ObexObjectPush =
ParcelUuid.fromString("00001105-0000-1000-8000-00805f9b34fb");
public static final ParcelUuid Hid =
- ParcelUuid.fromString("00000011-0000-1000-8000-00805f9b34fb");
+ ParcelUuid.fromString("00001124-0000-1000-8000-00805f9b34fb");
public static final ParcelUuid[] RESERVED_UUIDS = {
AudioSink, AudioSource, AdvAudioDist, HSP, Handsfree, AvrcpController, AvrcpTarget,
diff --git a/core/java/android/database/CursorWrapper.java b/core/java/android/database/CursorWrapper.java
index 2ac9470..3c3bd43 100644
--- a/core/java/android/database/CursorWrapper.java
+++ b/core/java/android/database/CursorWrapper.java
@@ -17,22 +17,28 @@
package android.database;
import android.content.ContentResolver;
-import android.database.CharArrayBuffer;
import android.net.Uri;
import android.os.Bundle;
-import java.util.Map;
-
/**
- * Wrapper class for Cursor that delegates all calls to the actual cursor object
+ * Wrapper class for Cursor that delegates all calls to the actual cursor object. The primary
+ * use for this class is to extend a cursor while overriding only a subset of its methods.
*/
-
public class CursorWrapper implements Cursor {
+ private final Cursor mCursor;
+
public CursorWrapper(Cursor cursor) {
mCursor = cursor;
}
+ /**
+ * @return the wrapped cursor
+ */
+ public Cursor getWrappedCursor() {
+ return mCursor;
+ }
+
public void close() {
mCursor.close();
}
@@ -189,7 +195,5 @@
public void unregisterDataSetObserver(DataSetObserver observer) {
mCursor.unregisterDataSetObserver(observer);
}
-
- private Cursor mCursor;
}
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index e33463b..79d9631 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -956,11 +956,14 @@
}
sqliteDatabase.setPageSize(sBlockSize);
- // set journal_mode to truncate
- String s = DatabaseUtils.stringForQuery(sqliteDatabase, "PRAGMA journal_mode=TRUNCATE",
- null);
- if (!s.equalsIgnoreCase("TRUNCATE")) {
- Log.e(TAG, "setting journal_mode to TRUNCATE failed");
+ // set journal_mode to truncate for non-memory databases
+ if (!path.equalsIgnoreCase(":memory:")) {
+ String s = DatabaseUtils.stringForQuery(sqliteDatabase, "PRAGMA journal_mode=TRUNCATE",
+ null);
+ if (!s.equalsIgnoreCase("TRUNCATE")) {
+ Log.e(TAG, "setting journal_mode to TRUNCATE failed for db: " + path +
+ " (on pragma set journal_mode, sqlite returned:" + s);
+ }
}
// add this database to the list of databases opened in this process
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 1ab3931..4ec5363 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3588,7 +3588,7 @@
ContentValues values = new ContentValues();
if (title != null) values.put(TITLE, title);
if (folder != null) values.put(FOLDER, folder);
- values.put(INTENT, intent.toURI());
+ values.put(INTENT, intent.toUri(0));
if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
values.put(ORDERING, ordering);
return cr.insert(CONTENT_URI, values);
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index e68632d..ec99b0d 100644
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -1265,7 +1265,7 @@
if (mInputDevices.get(device) == null) {
return BluetoothInputDevice.STATE_DISCONNECTED;
}
- return mInputDevices.get(device.getAddress());
+ return mInputDevices.get(device);
}
public synchronized BluetoothDevice[] getConnectedInputDevices() {
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index c186aba..de0a846 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -5662,6 +5662,8 @@
* to the user. This will not move the cursor if it represents more than
* one character (a selection range). This will only work if the
* TextView contains spannable text; otherwise it will do nothing.
+ *
+ * @return True if the cursor was actually moved, false otherwise.
*/
public boolean moveCursorToVisibleOffset() {
if (!(mText instanceof Spannable)) {
@@ -6566,25 +6568,37 @@
}
class CommitSelectionReceiver extends ResultReceiver {
- int mNewStart;
- int mNewEnd;
-
- CommitSelectionReceiver() {
+ private final int mPrevStart, mPrevEnd;
+ private final int mNewStart, mNewEnd;
+
+ public CommitSelectionReceiver(int mPrevStart, int mPrevEnd, int mNewStart, int mNewEnd) {
super(getHandler());
+ this.mPrevStart = mPrevStart;
+ this.mPrevEnd = mPrevEnd;
+ this.mNewStart = mNewStart;
+ this.mNewEnd = mNewEnd;
}
-
+
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
- if (resultCode != InputMethodManager.RESULT_SHOWN) {
- final int len = mText.length();
- if (mNewStart > len) {
- mNewStart = len;
- }
- if (mNewEnd > len) {
- mNewEnd = len;
- }
- Selection.setSelection((Spannable)mText, mNewStart, mNewEnd);
+ int start = mNewStart;
+ int end = mNewEnd;
+
+ // Move the cursor to the new position, unless this tap was actually
+ // use to show the IMM. Leave cursor unchanged in that case.
+ if (resultCode == InputMethodManager.RESULT_SHOWN) {
+ start = mPrevStart;
+ end = mPrevEnd;
}
+
+ final int len = mText.length();
+ if (start > len) {
+ start = len;
+ }
+ if (end > len) {
+ end = len;
+ }
+ Selection.setSelection((Spannable)mText, start, end);
}
}
@@ -6597,7 +6611,7 @@
mTouchFocusSelected = false;
mScrolled = false;
}
-
+
final boolean superResult = super.onTouchEvent(event);
/*
@@ -6610,7 +6624,8 @@
return superResult;
}
- if ((mMovement != null || onCheckIsTextEditor()) && mText instanceof Spannable && mLayout != null) {
+ if ((mMovement != null || onCheckIsTextEditor()) &&
+ mText instanceof Spannable && mLayout != null) {
boolean handled = false;
@@ -6625,28 +6640,14 @@
if (action == MotionEvent.ACTION_UP && isFocused() && !mScrolled) {
InputMethodManager imm = (InputMethodManager)
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
-
- // This is going to be gross... if tapping on the text view
- // causes the IME to be displayed, we don't want the selection
- // to change. But the selection has already changed, and
- // we won't know right away whether the IME is getting
- // displayed, so...
-
- int newSelStart = Selection.getSelectionStart(mText);
- int newSelEnd = Selection.getSelectionEnd(mText);
- CommitSelectionReceiver csr = null;
+
+ final int newSelStart = Selection.getSelectionStart(mText);
+ final int newSelEnd = Selection.getSelectionEnd(mText);
+
if (newSelStart != oldSelStart || newSelEnd != oldSelEnd) {
- csr = new CommitSelectionReceiver();
- csr.mNewStart = newSelStart;
- csr.mNewEnd = newSelEnd;
- }
-
- if (imm.showSoftInput(this, 0, csr) && csr != null) {
- // The IME might get shown -- revert to the old
- // selection, and change to the new when we finally
- // find out of it is okay.
- Selection.setSelection((Spannable)mText, oldSelStart, oldSelEnd);
- handled = true;
+ CommitSelectionReceiver csr = new CommitSelectionReceiver(
+ oldSelStart, oldSelEnd, newSelStart, newSelEnd);
+ handled = imm.showSoftInput(this, 0, csr);
}
}
}
diff --git a/core/java/com/android/internal/widget/ContactHeaderWidget.java b/core/java/com/android/internal/widget/ContactHeaderWidget.java
deleted file mode 100644
index a514089..0000000
--- a/core/java/com/android/internal/widget/ContactHeaderWidget.java
+++ /dev/null
@@ -1,727 +0,0 @@
-/*
- * 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 com.android.internal.widget;
-
-import com.android.internal.R;
-
-import android.Manifest;
-import android.content.AsyncQueryHandler;
-import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.res.Resources;
-import android.content.res.Resources.NotFoundException;
-import android.database.Cursor;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.net.Uri;
-import android.os.SystemClock;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.Data;
-import android.provider.ContactsContract.PhoneLookup;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.StatusUpdates;
-import android.provider.ContactsContract.CommonDataKinds.Email;
-import android.provider.ContactsContract.CommonDataKinds.Photo;
-import android.text.TextUtils;
-import android.text.format.DateUtils;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.CheckBox;
-import android.widget.QuickContactBadge;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-/**
- * Header used across system for displaying a title bar with contact info. You
- * can bind specific values on the header, or use helper methods like
- * {@link #bindFromContactLookupUri(Uri)} to populate asynchronously.
- * <p>
- * The parent must request the {@link Manifest.permission#READ_CONTACTS}
- * permission to access contact data.
- */
-public class ContactHeaderWidget extends FrameLayout implements View.OnClickListener {
-
- private static final String TAG = "ContactHeaderWidget";
-
- private TextView mDisplayNameView;
- private View mAggregateBadge;
- private TextView mPhoneticNameView;
- private CheckBox mStarredView;
- private QuickContactBadge mPhotoView;
- private ImageView mPresenceView;
- private TextView mStatusView;
- private TextView mStatusAttributionView;
- private int mNoPhotoResource;
- private QueryHandler mQueryHandler;
-
- protected Uri mContactUri;
-
- protected String[] mExcludeMimes = null;
-
- protected ContentResolver mContentResolver;
-
- /**
- * Interface for callbacks invoked when the user interacts with a header.
- */
- public interface ContactHeaderListener {
- public void onPhotoClick(View view);
- public void onDisplayNameClick(View view);
- }
-
- private ContactHeaderListener mListener;
-
-
- private interface ContactQuery {
- //Projection used for the summary info in the header.
- String[] COLUMNS = new String[] {
- Contacts._ID,
- Contacts.LOOKUP_KEY,
- Contacts.PHOTO_ID,
- Contacts.DISPLAY_NAME,
- Contacts.PHONETIC_NAME,
- Contacts.STARRED,
- Contacts.CONTACT_PRESENCE,
- Contacts.CONTACT_STATUS,
- Contacts.CONTACT_STATUS_TIMESTAMP,
- Contacts.CONTACT_STATUS_RES_PACKAGE,
- Contacts.CONTACT_STATUS_LABEL,
- };
- int _ID = 0;
- int LOOKUP_KEY = 1;
- int PHOTO_ID = 2;
- int DISPLAY_NAME = 3;
- int PHONETIC_NAME = 4;
- //TODO: We need to figure out how we're going to get the phonetic name.
- //static final int HEADER_PHONETIC_NAME_COLUMN_INDEX
- int STARRED = 5;
- int CONTACT_PRESENCE_STATUS = 6;
- int CONTACT_STATUS = 7;
- int CONTACT_STATUS_TIMESTAMP = 8;
- int CONTACT_STATUS_RES_PACKAGE = 9;
- int CONTACT_STATUS_LABEL = 10;
- }
-
- private interface PhotoQuery {
- String[] COLUMNS = new String[] {
- Photo.PHOTO
- };
-
- int PHOTO = 0;
- }
-
- //Projection used for looking up contact id from phone number
- protected static final String[] PHONE_LOOKUP_PROJECTION = new String[] {
- PhoneLookup._ID,
- PhoneLookup.LOOKUP_KEY,
- };
- protected static final int PHONE_LOOKUP_CONTACT_ID_COLUMN_INDEX = 0;
- protected static final int PHONE_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX = 1;
-
- //Projection used for looking up contact id from email address
- protected static final String[] EMAIL_LOOKUP_PROJECTION = new String[] {
- RawContacts.CONTACT_ID,
- Contacts.LOOKUP_KEY,
- };
- protected static final int EMAIL_LOOKUP_CONTACT_ID_COLUMN_INDEX = 0;
- protected static final int EMAIL_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX = 1;
-
- protected static final String[] CONTACT_LOOKUP_PROJECTION = new String[] {
- Contacts._ID,
- };
- protected static final int CONTACT_LOOKUP_ID_COLUMN_INDEX = 0;
-
- private static final int TOKEN_CONTACT_INFO = 0;
- private static final int TOKEN_PHONE_LOOKUP = 1;
- private static final int TOKEN_EMAIL_LOOKUP = 2;
- private static final int TOKEN_PHOTO_QUERY = 3;
-
- public ContactHeaderWidget(Context context) {
- this(context, null);
- }
-
- public ContactHeaderWidget(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public ContactHeaderWidget(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
-
- mContentResolver = mContext.getContentResolver();
-
- LayoutInflater inflater =
- (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- inflater.inflate(R.layout.contact_header, this);
-
- mDisplayNameView = (TextView) findViewById(R.id.name);
- mAggregateBadge = findViewById(R.id.aggregate_badge);
-
- mPhoneticNameView = (TextView) findViewById(R.id.phonetic_name);
-
- mStarredView = (CheckBox)findViewById(R.id.star);
- mStarredView.setOnClickListener(this);
-
- mPhotoView = (QuickContactBadge) findViewById(R.id.photo);
-
- mPresenceView = (ImageView) findViewById(R.id.presence);
-
- mStatusView = (TextView)findViewById(R.id.status);
- mStatusAttributionView = (TextView)findViewById(R.id.status_date);
-
- // Set the photo with a random "no contact" image
- long now = SystemClock.elapsedRealtime();
- int num = (int) now & 0xf;
- if (num < 9) {
- // Leaning in from right, common
- mNoPhotoResource = R.drawable.ic_contact_picture;
- } else if (num < 14) {
- // Leaning in from left uncommon
- mNoPhotoResource = R.drawable.ic_contact_picture_2;
- } else {
- // Coming in from the top, rare
- mNoPhotoResource = R.drawable.ic_contact_picture_3;
- }
-
- resetAsyncQueryHandler();
- }
-
- public void enableClickListeners() {
- mDisplayNameView.setOnClickListener(this);
- mPhotoView.setOnClickListener(this);
- }
-
- /**
- * Set the given {@link ContactHeaderListener} to handle header events.
- */
- public void setContactHeaderListener(ContactHeaderListener listener) {
- mListener = listener;
- }
-
- private void performPhotoClick() {
- if (mListener != null) {
- mListener.onPhotoClick(mPhotoView);
- }
- }
-
- private void performDisplayNameClick() {
- if (mListener != null) {
- mListener.onDisplayNameClick(mDisplayNameView);
- }
- }
-
- private class QueryHandler extends AsyncQueryHandler {
-
- public QueryHandler(ContentResolver cr) {
- super(cr);
- }
-
- @Override
- protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
- try{
- if (this != mQueryHandler) {
- Log.d(TAG, "onQueryComplete: discard result, the query handler is reset!");
- return;
- }
-
- switch (token) {
- case TOKEN_PHOTO_QUERY: {
- //Set the photo
- Bitmap photoBitmap = null;
- if (cursor != null && cursor.moveToFirst()
- && !cursor.isNull(PhotoQuery.PHOTO)) {
- byte[] photoData = cursor.getBlob(PhotoQuery.PHOTO);
- photoBitmap = BitmapFactory.decodeByteArray(photoData, 0,
- photoData.length, null);
- }
-
- if (photoBitmap == null) {
- photoBitmap = loadPlaceholderPhoto(null);
- }
- setPhoto(photoBitmap);
- if (cookie != null && cookie instanceof Uri) {
- mPhotoView.assignContactUri((Uri) cookie);
- }
- invalidate();
- break;
- }
- case TOKEN_CONTACT_INFO: {
- if (cursor != null && cursor.moveToFirst()) {
- bindContactInfo(cursor);
- final Uri lookupUri = Contacts.getLookupUri(
- cursor.getLong(ContactQuery._ID),
- cursor.getString(ContactQuery.LOOKUP_KEY));
-
- final long photoId = cursor.getLong(ContactQuery.PHOTO_ID);
-
- setPhotoId(photoId, lookupUri);
- } else {
- // shouldn't really happen
- setDisplayName(null, null);
- setSocialSnippet(null);
- setPhoto(loadPlaceholderPhoto(null));
- }
- break;
- }
- case TOKEN_PHONE_LOOKUP: {
- if (cursor != null && cursor.moveToFirst()) {
- long contactId = cursor.getLong(PHONE_LOOKUP_CONTACT_ID_COLUMN_INDEX);
- String lookupKey = cursor.getString(
- PHONE_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
- bindFromContactUriInternal(Contacts.getLookupUri(contactId, lookupKey),
- false /* don't reset query handler */);
- } else {
- String phoneNumber = (String) cookie;
- setDisplayName(phoneNumber, null);
- setSocialSnippet(null);
- setPhoto(loadPlaceholderPhoto(null));
- mPhotoView.assignContactFromPhone(phoneNumber, true);
- }
- break;
- }
- case TOKEN_EMAIL_LOOKUP: {
- if (cursor != null && cursor.moveToFirst()) {
- long contactId = cursor.getLong(EMAIL_LOOKUP_CONTACT_ID_COLUMN_INDEX);
- String lookupKey = cursor.getString(
- EMAIL_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
- bindFromContactUriInternal(Contacts.getLookupUri(contactId, lookupKey),
- false /* don't reset query handler */);
- } else {
- String emailAddress = (String) cookie;
- setDisplayName(emailAddress, null);
- setSocialSnippet(null);
- setPhoto(loadPlaceholderPhoto(null));
- mPhotoView.assignContactFromEmail(emailAddress, true);
- }
- break;
- }
- }
- } finally {
- if (cursor != null) {
- cursor.close();
- }
- }
- }
- }
-
- /**
- * Turn on/off showing of the aggregate badge element.
- */
- public void showAggregateBadge(boolean showBagde) {
- mAggregateBadge.setVisibility(showBagde ? View.VISIBLE : View.GONE);
- }
-
- /**
- * Turn on/off showing of the star element.
- */
- public void showStar(boolean showStar) {
- mStarredView.setVisibility(showStar ? View.VISIBLE : View.GONE);
- }
-
- /**
- * Manually set the starred state of this header widget. This doesn't change
- * the underlying {@link Contacts} value, only the UI state.
- */
- public void setStared(boolean starred) {
- mStarredView.setChecked(starred);
- }
-
- /**
- * Manually set the presence.
- */
- public void setPresence(int presence) {
- mPresenceView.setImageResource(StatusUpdates.getPresenceIconResourceId(presence));
- }
-
- /**
- * Manually set the presence. If presence is null, it is hidden.
- * This doesn't change the underlying {@link Contacts} value, only the UI state.
- * @hide
- */
- public void setPresence(Integer presence) {
- if (presence == null) {
- showPresence(false);
- } else {
- showPresence(true);
- setPresence(presence.intValue());
- }
- }
-
- /**
- * Turn on/off showing the presence.
- * @hide this is here for consistency with setStared/showStar and should be public
- */
- public void showPresence(boolean showPresence) {
- mPresenceView.setVisibility(showPresence ? View.VISIBLE : View.GONE);
- }
-
- /**
- * Manually set the contact uri without loading any data
- */
- public void setContactUri(Uri uri) {
- setContactUri(uri, true);
- }
-
- /**
- * Manually set the contact uri without loading any data
- */
- public void setContactUri(Uri uri, boolean sendToQuickContact) {
- mContactUri = uri;
- if (sendToQuickContact) {
- mPhotoView.assignContactUri(uri);
- }
- }
-
- /**
- * Manually set the photo to display in the header. This doesn't change the
- * underlying {@link Contacts}, only the UI state.
- */
- public void setPhoto(Bitmap bitmap) {
- mPhotoView.setImageBitmap(bitmap);
- }
-
- /**
- * Manually set the photo given its id. If the id is 0, a placeholder picture will
- * be loaded. For any other Id, an async query is started
- * @hide
- */
- public void setPhotoId(final long photoId, final Uri lookupUri) {
- if (photoId == 0) {
- setPhoto(loadPlaceholderPhoto(null));
- mPhotoView.assignContactUri(lookupUri);
- invalidate();
- } else {
- startPhotoQuery(photoId, lookupUri,
- false /* don't reset query handler */);
- }
- }
-
- /**
- * Manually set the display name and phonetic name to show in the header.
- * This doesn't change the underlying {@link Contacts}, only the UI state.
- */
- public void setDisplayName(CharSequence displayName, CharSequence phoneticName) {
- mDisplayNameView.setText(displayName);
- if (!TextUtils.isEmpty(phoneticName)) {
- mPhoneticNameView.setText(phoneticName);
- mPhoneticNameView.setVisibility(View.VISIBLE);
- } else {
- mPhoneticNameView.setVisibility(View.GONE);
- }
- }
-
- /**
- * Manually set the social snippet text to display in the header. This doesn't change the
- * underlying {@link Contacts}, only the UI state.
- */
- public void setSocialSnippet(CharSequence snippet) {
- if (snippet == null) {
- mStatusView.setVisibility(View.GONE);
- mStatusAttributionView.setVisibility(View.GONE);
- } else {
- mStatusView.setText(snippet);
- mStatusView.setVisibility(View.VISIBLE);
- }
- }
-
- /**
- * Manually set the status attribution text to display in the header.
- * This doesn't change the underlying {@link Contacts}, only the UI state.
- * @hide
- */
- public void setStatusAttribution(CharSequence attribution) {
- if (attribution != null) {
- mStatusAttributionView.setText(attribution);
- mStatusAttributionView.setVisibility(View.VISIBLE);
- } else {
- mStatusAttributionView.setVisibility(View.GONE);
- }
- }
-
- /**
- * Set a list of specific MIME-types to exclude and not display. For
- * example, this can be used to hide the {@link Contacts#CONTENT_ITEM_TYPE}
- * profile icon.
- */
- public void setExcludeMimes(String[] excludeMimes) {
- mExcludeMimes = excludeMimes;
- mPhotoView.setExcludeMimes(excludeMimes);
- }
-
- /**
- * Manually set all the status values to display in the header.
- * This doesn't change the underlying {@link Contacts}, only the UI state.
- * @hide
- * @param status The status of the contact. If this is either null or empty,
- * the status is cleared and the other parameters are ignored.
- * @param statusTimestamp The timestamp (retrieved via a call to
- * {@link System#currentTimeMillis()}) of the last status update.
- * This value can be null if it is not known.
- * @param statusLabel The id of a resource string that specifies the current
- * status. This value can be null if no Label should be used.
- * @param statusResPackage The name of the resource package containing the resource string
- * referenced in the parameter statusLabel.
- */
- public void setStatus(final String status, final Long statusTimestamp,
- final Integer statusLabel, final String statusResPackage) {
- if (TextUtils.isEmpty(status)) {
- setSocialSnippet(null);
- return;
- }
-
- setSocialSnippet(status);
-
- final CharSequence timestampDisplayValue;
-
- if (statusTimestamp != null) {
- // Set the date/time field by mixing relative and absolute
- // times.
- int flags = DateUtils.FORMAT_ABBREV_RELATIVE;
-
- timestampDisplayValue = DateUtils.getRelativeTimeSpanString(
- statusTimestamp.longValue(), System.currentTimeMillis(),
- DateUtils.MINUTE_IN_MILLIS, flags);
- } else {
- timestampDisplayValue = null;
- }
-
-
- String labelDisplayValue = null;
-
- if (statusLabel != null) {
- Resources resources;
- if (TextUtils.isEmpty(statusResPackage)) {
- resources = getResources();
- } else {
- PackageManager pm = getContext().getPackageManager();
- try {
- resources = pm.getResourcesForApplication(statusResPackage);
- } catch (NameNotFoundException e) {
- Log.w(TAG, "Contact status update resource package not found: "
- + statusResPackage);
- resources = null;
- }
- }
-
- if (resources != null) {
- try {
- labelDisplayValue = resources.getString(statusLabel.intValue());
- } catch (NotFoundException e) {
- Log.w(TAG, "Contact status update resource not found: " + statusResPackage + "@"
- + statusLabel.intValue());
- }
- }
- }
-
- final CharSequence attribution;
- if (timestampDisplayValue != null && labelDisplayValue != null) {
- attribution = getContext().getString(
- R.string.contact_status_update_attribution_with_date,
- timestampDisplayValue, labelDisplayValue);
- } else if (timestampDisplayValue == null && labelDisplayValue != null) {
- attribution = getContext().getString(
- R.string.contact_status_update_attribution,
- labelDisplayValue);
- } else if (timestampDisplayValue != null) {
- attribution = timestampDisplayValue;
- } else {
- attribution = null;
- }
- setStatusAttribution(attribution);
- }
-
- /**
- * Convenience method for binding all available data from an existing
- * contact.
- *
- * @param contactLookupUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
- */
- public void bindFromContactLookupUri(Uri contactLookupUri) {
- bindFromContactUriInternal(contactLookupUri, true /* reset query handler */);
- }
-
- /**
- * Convenience method for binding all available data from an existing
- * contact.
- *
- * @param contactUri a {Contacts.CONTENT_URI} style URI.
- * @param resetQueryHandler whether to use a new AsyncQueryHandler or not.
- */
- private void bindFromContactUriInternal(Uri contactUri, boolean resetQueryHandler) {
- mContactUri = contactUri;
- startContactQuery(contactUri, resetQueryHandler);
- }
-
- /**
- * Convenience method for binding all available data from an existing
- * contact.
- *
- * @param emailAddress The email address used to do a reverse lookup in
- * the contacts database. If more than one contact contains this email
- * address, one of them will be chosen to bind to.
- */
- public void bindFromEmail(String emailAddress) {
- resetAsyncQueryHandler();
-
- mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP, emailAddress,
- Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(emailAddress)),
- EMAIL_LOOKUP_PROJECTION, null, null, null);
- }
-
- /**
- * Convenience method for binding all available data from an existing
- * contact.
- *
- * @param number The phone number used to do a reverse lookup in
- * the contacts database. If more than one contact contains this phone
- * number, one of them will be chosen to bind to.
- */
- public void bindFromPhoneNumber(String number) {
- resetAsyncQueryHandler();
-
- mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP, number,
- Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number)),
- PHONE_LOOKUP_PROJECTION, null, null, null);
- }
-
- /**
- * startContactQuery
- *
- * internal method to query contact by Uri.
- *
- * @param contactUri the contact uri
- * @param resetQueryHandler whether to use a new AsyncQueryHandler or not
- */
- private void startContactQuery(Uri contactUri, boolean resetQueryHandler) {
- if (resetQueryHandler) {
- resetAsyncQueryHandler();
- }
-
- mQueryHandler.startQuery(TOKEN_CONTACT_INFO, contactUri, contactUri, ContactQuery.COLUMNS,
- null, null, null);
- }
-
- /**
- * startPhotoQuery
- *
- * internal method to query contact photo by photo id and uri.
- *
- * @param photoId the photo id.
- * @param lookupKey the lookup uri.
- * @param resetQueryHandler whether to use a new AsyncQueryHandler or not.
- */
- protected void startPhotoQuery(long photoId, Uri lookupKey, boolean resetQueryHandler) {
- if (resetQueryHandler) {
- resetAsyncQueryHandler();
- }
-
- mQueryHandler.startQuery(TOKEN_PHOTO_QUERY, lookupKey,
- ContentUris.withAppendedId(Data.CONTENT_URI, photoId), PhotoQuery.COLUMNS,
- null, null, null);
- }
-
- /**
- * Method to force this widget to forget everything it knows about the contact.
- * We need to stop any existing async queries for phone, email, contact, and photos.
- */
- public void wipeClean() {
- resetAsyncQueryHandler();
-
- setDisplayName(null, null);
- setPhoto(loadPlaceholderPhoto(null));
- setSocialSnippet(null);
- setPresence(0);
- mContactUri = null;
- mExcludeMimes = null;
- }
-
-
- private void resetAsyncQueryHandler() {
- // the api AsyncQueryHandler.cancelOperation() doesn't really work. Since we really
- // need the old async queries to be cancelled, let's do it the hard way.
- mQueryHandler = new QueryHandler(mContentResolver);
- }
-
- /**
- * Bind the contact details provided by the given {@link Cursor}.
- */
- protected void bindContactInfo(Cursor c) {
- final String displayName = c.getString(ContactQuery.DISPLAY_NAME);
- final String phoneticName = c.getString(ContactQuery.PHONETIC_NAME);
- this.setDisplayName(displayName, phoneticName);
-
- final boolean starred = c.getInt(ContactQuery.STARRED) != 0;
- setStared(starred);
-
- //Set the presence status
- if (!c.isNull(ContactQuery.CONTACT_PRESENCE_STATUS)) {
- int presence = c.getInt(ContactQuery.CONTACT_PRESENCE_STATUS);
- setPresence(presence);
- showPresence(true);
- } else {
- showPresence(false);
- }
-
- //Set the status update
- final String status = c.getString(ContactQuery.CONTACT_STATUS);
- final Long statusTimestamp = c.isNull(ContactQuery.CONTACT_STATUS_TIMESTAMP)
- ? null
- : c.getLong(ContactQuery.CONTACT_STATUS_TIMESTAMP);
- final Integer statusLabel = c.isNull(ContactQuery.CONTACT_STATUS_LABEL)
- ? null
- : c.getInt(ContactQuery.CONTACT_STATUS_LABEL);
- final String statusResPackage = c.getString(ContactQuery.CONTACT_STATUS_RES_PACKAGE);
-
- setStatus(status, statusTimestamp, statusLabel, statusResPackage);
- }
-
- public void onClick(View view) {
- switch (view.getId()) {
- case R.id.star: {
- // Toggle "starred" state
- // Make sure there is a contact
- if (mContactUri != null) {
- final ContentValues values = new ContentValues(1);
- values.put(Contacts.STARRED, mStarredView.isChecked());
- mContentResolver.update(mContactUri, values, null, null);
- }
- break;
- }
- case R.id.photo: {
- performPhotoClick();
- break;
- }
- case R.id.name: {
- performDisplayNameClick();
- break;
- }
- }
- }
-
- private Bitmap loadPlaceholderPhoto(BitmapFactory.Options options) {
- if (mNoPhotoResource == 0) {
- return null;
- }
- return BitmapFactory.decodeResource(mContext.getResources(),
- mNoPhotoResource, options);
- }
-}
diff --git a/core/res/res/drawable-hdpi/ic_aggregated.png b/core/res/res/drawable-hdpi/ic_aggregated.png
deleted file mode 100644
index 7ca15b1..0000000
--- a/core/res/res/drawable-hdpi/ic_aggregated.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_aggregated.png b/core/res/res/drawable-mdpi/ic_aggregated.png
deleted file mode 100644
index 7c2e2b0..0000000
--- a/core/res/res/drawable-mdpi/ic_aggregated.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/layout/contact_header.xml b/core/res/res/layout/contact_header.xml
deleted file mode 100644
index bf467d3..0000000
--- a/core/res/res/layout/contact_header.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/banner"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:background="@drawable/title_bar_medium"
- android:paddingRight="5dip">
-
- <android.widget.QuickContactBadge android:id="@+id/photo"
- android:layout_gravity="center_vertical"
- android:layout_marginRight="8dip"
- android:layout_marginLeft="-1dip"
- style="@*android:style/Widget.QuickContactBadge.WindowSmall" />
- />
-
- <LinearLayout
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical"
- android:layout_gravity="center_vertical" >
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <ImageView
- android:id="@+id/aggregate_badge"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingRight="3dip"
- android:paddingTop="3dip"
- android:src="@drawable/ic_aggregated"
- android:visibility="gone"
- />
-
- <TextView android:id="@+id/name"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="end"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textStyle="bold"
- android:shadowColor="#BB000000"
- android:shadowRadius="2.75"
- />
- </LinearLayout>
-
- <TextView android:id="@+id/phonetic_name"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:singleLine="true"
- android:ellipsize="end"
- android:layout_marginTop="-2dip"
- android:visibility="gone"
- />
-
- <TextView android:id="@+id/status"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:singleLine="true"
- android:ellipsize="end"
- android:layout_marginTop="-2dip"
- android:visibility="gone"
- />
-
- <TextView android:id="@+id/status_date"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textSize="12sp"
- android:layout_marginTop="-2dip"
- android:visibility="gone"
- />
- </LinearLayout>
-
- <ImageView
- android:id="@+id/presence"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:paddingLeft="3dip"
- android:paddingRight="6dip"
- android:visibility="gone"
- />
-
- <CheckBox
- android:id="@+id/star"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:visibility="gone"
- android:contentDescription="@string/description_star"
- style="?android:attr/starStyle" />
-
-</LinearLayout>
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index 92462c8..8aaf761 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -571,8 +571,8 @@
<string name="password_keyboard_label_symbol_key" msgid="992280756256536042">"?123"</string>
<string name="password_keyboard_label_alpha_key" msgid="8001096175167485649">"ABC"</string>
<string name="password_keyboard_label_alt_key" msgid="1284820942620288678">"ALT"</string>
- <string name="hour_ampm" msgid="4329881288269772723">"<xliff:g id="HOUR">%-l</xliff:g><xliff:g id="AMPM">%P</xliff:g>"</string>
- <string name="hour_cap_ampm" msgid="1829009197680861107">"<xliff:g id="HOUR">%-l</xliff:g><xliff:g id="AMPM">%p</xliff:g>"</string>
+ <string name="hour_ampm" msgid="4329881288269772723">"<xliff:g id="AMPM">%P</xliff:g> <xliff:g id="HOUR">%-l</xliff:g>:00"</string>
+ <string name="hour_cap_ampm" msgid="1829009197680861107">"<xliff:g id="AMPM">%p</xliff:g> <xliff:g id="HOUR">%-l</xliff:g>:00"</string>
<string name="status_bar_clear_all_button" msgid="7774721344716731603">"지우기"</string>
<string name="status_bar_no_notifications_title" msgid="4755261167193833213">"알림 없음"</string>
<string name="status_bar_ongoing_events_title" msgid="1682504513316879202">"진행 중"</string>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 2d9cc2e..1fc6491 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1421,12 +1421,6 @@
<!-- Custom organization type -->
<string name="orgTypeCustom">Custom</string>
- <!-- Attbution of a contact status update, when the time of update is unknown -->
- <string name="contact_status_update_attribution">via <xliff:g id="source" example="Google Talk">%1$s</xliff:g></string>
-
- <!-- Attbution of a contact status update, when the time of update is known -->
- <string name="contact_status_update_attribution_with_date"><xliff:g id="date" example="3 hours ago">%1$s</xliff:g> via <xliff:g id="source" example="Google Talk">%2$s</xliff:g></string>
-
<!-- Instructions telling the user to enter their SIM PIN to unlock the keyguard.
Displayed in one line in a large font. -->
<string name="keyguard_password_enter_pin_code">Enter PIN code</string>
@@ -2270,12 +2264,6 @@
<!-- Label for <input type="submit"> button in html -->
<string name="submit">Submit</string>
- <!-- String describing the Star/Favorite checkbox
-
- Used by AccessibilityService to announce the purpose of the view.
- -->
- <string name="description_star">favorite</string>
-
<!-- Strings for car mode notification -->
<!-- Shown when car mode is enabled -->
<string name="car_mode_disable_notification_title">Car mode enabled</string>
diff --git a/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java b/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java
index 4d228c4..b098b5c 100644
--- a/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java
+++ b/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java
@@ -78,7 +78,7 @@
try {
mDatabase.setConnectionPoolSize(0);
fail("IllegalStateException expected");
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException e) {
assertTrue(e.getMessage().contains("less than the current max value"));
}
// set pool size to a valid value
@@ -88,7 +88,7 @@
try {
mDatabase.setConnectionPoolSize(1);
fail("IllegalStateException expected");
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException e) {
assertTrue(e.getMessage().contains("less than the current max value"));
}
}
diff --git a/graphics/java/android/renderscript/Element.java b/graphics/java/android/renderscript/Element.java
index 22291e6..308d663 100644
--- a/graphics/java/android/renderscript/Element.java
+++ b/graphics/java/android/renderscript/Element.java
@@ -47,20 +47,22 @@
UNSIGNED_32 (10, 4),
//UNSIGNED_64 (11, 8),
- UNSIGNED_5_6_5 (12, 2),
- UNSIGNED_5_5_5_1 (13, 2),
- UNSIGNED_4_4_4_4 (14, 2),
+ BOOLEAN(12, 1),
- RS_ELEMENT (15, 4),
- RS_TYPE (16, 4),
- RS_ALLOCATION (17, 4),
- RS_SAMPLER (18, 4),
- RS_SCRIPT (19, 4),
- RS_MESH (20, 4),
- RS_PROGRAM_FRAGMENT (21, 4),
- RS_PROGRAM_VERTEX (22, 4),
- RS_PROGRAM_RASTER (23, 4),
- RS_PROGRAM_STORE (24, 4);
+ UNSIGNED_5_6_5 (13, 2),
+ UNSIGNED_5_5_5_1 (14, 2),
+ UNSIGNED_4_4_4_4 (15, 2),
+
+ RS_ELEMENT (16, 4),
+ RS_TYPE (17, 4),
+ RS_ALLOCATION (18, 4),
+ RS_SAMPLER (19, 4),
+ RS_SCRIPT (20, 4),
+ RS_MESH (21, 4),
+ RS_PROGRAM_FRAGMENT (22, 4),
+ RS_PROGRAM_VERTEX (23, 4),
+ RS_PROGRAM_RASTER (24, 4),
+ RS_PROGRAM_STORE (25, 4);
int mID;
int mSize;
@@ -85,6 +87,13 @@
}
}
+ public static Element BOOLEAN(RenderScript rs) {
+ if(rs.mElement_BOOLEAN == null) {
+ rs.mElement_BOOLEAN = createUser(rs, DataType.BOOLEAN);
+ }
+ return rs.mElement_BOOLEAN;
+ }
+
public static Element U8(RenderScript rs) {
if(rs.mElement_U8 == null) {
rs.mElement_U8 = createUser(rs, DataType.UNSIGNED_8);
diff --git a/graphics/java/android/renderscript/FieldPacker.java b/graphics/java/android/renderscript/FieldPacker.java
index 81a4288..d166972 100644
--- a/graphics/java/android/renderscript/FieldPacker.java
+++ b/graphics/java/android/renderscript/FieldPacker.java
@@ -244,6 +244,10 @@
addU32(v.w);
}
+ public void addBoolean(Boolean v) {
+ addI8((byte)(v ? 1 : 0));
+ }
+
public final byte[] getData() {
return mData;
}
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 70f6bd7..5f2050e 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -204,6 +204,7 @@
Element mElement_U32;
Element mElement_I32;
Element mElement_F32;
+ Element mElement_BOOLEAN;
Element mElement_ELEMENT;
Element mElement_TYPE;
diff --git a/libs/rs/RenderScript.h b/libs/rs/RenderScript.h
index f01eadd..6302b90 100644
--- a/libs/rs/RenderScript.h
+++ b/libs/rs/RenderScript.h
@@ -85,6 +85,8 @@
RS_TYPE_UNSIGNED_32,
RS_TYPE_UNSIGNED_64,
+ RS_TYPE_BOOLEAN,
+
RS_TYPE_UNSIGNED_5_6_5,
RS_TYPE_UNSIGNED_5_5_5_1,
RS_TYPE_UNSIGNED_4_4_4_4,
diff --git a/libs/rs/java/Film/Android.mk b/libs/rs/java/Film/Android.mk
deleted file mode 100644
index 9e6ed7e..0000000
--- a/libs/rs/java/Film/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2008 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-#LOCAL_STATIC_JAVA_LIBRARIES := android.renderscript
-
-LOCAL_PACKAGE_NAME := Film
-
-include $(BUILD_PACKAGE)
diff --git a/libs/rs/java/Film/AndroidManifest.xml b/libs/rs/java/Film/AndroidManifest.xml
deleted file mode 100644
index a5ce8a1..0000000
--- a/libs/rs/java/Film/AndroidManifest.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.film">
- <application android:label="Film">
- <activity android:name="Film"
- android:screenOrientation="portrait"
- android:theme="@android:style/Theme.Black.NoTitleBar">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/libs/rs/java/Film/res/drawable/p01.png b/libs/rs/java/Film/res/drawable/p01.png
deleted file mode 100644
index a9b9bdb..0000000
--- a/libs/rs/java/Film/res/drawable/p01.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/drawable/p02.png b/libs/rs/java/Film/res/drawable/p02.png
deleted file mode 100644
index 8162c82..0000000
--- a/libs/rs/java/Film/res/drawable/p02.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/drawable/p03.png b/libs/rs/java/Film/res/drawable/p03.png
deleted file mode 100644
index e3e26c0..0000000
--- a/libs/rs/java/Film/res/drawable/p03.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/drawable/p04.png b/libs/rs/java/Film/res/drawable/p04.png
deleted file mode 100644
index daee603..0000000
--- a/libs/rs/java/Film/res/drawable/p04.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/drawable/p05.png b/libs/rs/java/Film/res/drawable/p05.png
deleted file mode 100644
index fac5248..0000000
--- a/libs/rs/java/Film/res/drawable/p05.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/drawable/p06.png b/libs/rs/java/Film/res/drawable/p06.png
deleted file mode 100644
index 3b51261..0000000
--- a/libs/rs/java/Film/res/drawable/p06.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/drawable/p07.png b/libs/rs/java/Film/res/drawable/p07.png
deleted file mode 100644
index d8bd938..0000000
--- a/libs/rs/java/Film/res/drawable/p07.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/drawable/p08.png b/libs/rs/java/Film/res/drawable/p08.png
deleted file mode 100644
index ef175e8..0000000
--- a/libs/rs/java/Film/res/drawable/p08.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/drawable/p09.png b/libs/rs/java/Film/res/drawable/p09.png
deleted file mode 100644
index 7bf3874..0000000
--- a/libs/rs/java/Film/res/drawable/p09.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/drawable/p10.png b/libs/rs/java/Film/res/drawable/p10.png
deleted file mode 100644
index 908827d..0000000
--- a/libs/rs/java/Film/res/drawable/p10.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/drawable/p11.png b/libs/rs/java/Film/res/drawable/p11.png
deleted file mode 100644
index 1289f71..0000000
--- a/libs/rs/java/Film/res/drawable/p11.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/drawable/p12.png b/libs/rs/java/Film/res/drawable/p12.png
deleted file mode 100644
index e1af16a..0000000
--- a/libs/rs/java/Film/res/drawable/p12.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/drawable/p13.png b/libs/rs/java/Film/res/drawable/p13.png
deleted file mode 100644
index d08bcbe..0000000
--- a/libs/rs/java/Film/res/drawable/p13.png
+++ /dev/null
Binary files differ
diff --git a/libs/rs/java/Film/res/raw/filmimage.c b/libs/rs/java/Film/res/raw/filmimage.c
deleted file mode 100644
index d154c68..0000000
--- a/libs/rs/java/Film/res/raw/filmimage.c
+++ /dev/null
@@ -1,110 +0,0 @@
-// Fountain test script
-
-#pragma version(1)
-#pragma stateVertex(orthoWindow)
-#pragma stateRaster(flat)
-#pragma stateFragment(PgmFragBackground)
-#pragma stateStore(MyBlend)
-
-
-int main(void* con, int ft, int launchID) {
- int count, touch, x, y, rate, maxLife, lifeShift;
- int life;
- int ct, ct2;
- int newPart;
- int drawCount;
- int dx, dy, idx;
- int posx,posy;
- int c;
- int srcIdx;
- int dstIdx;
-
- count = loadI32(con, 0, 1);
- touch = loadI32(con, 0, 2);
- x = loadI32(con, 0, 3);
- y = loadI32(con, 0, 4);
-
- rate = 4;
- maxLife = (count / rate) - 1;
- lifeShift = 0;
- {
- life = maxLife;
- while (life > 255) {
- life = life >> 1;
- lifeShift ++;
- }
- }
-
- drawRect(con, 0, 256, 0, 512);
- contextBindProgramFragment(con, NAMED_PgmFragParts);
-
- if (touch) {
- newPart = loadI32(con, 2, 0);
- for (ct2=0; ct2<rate; ct2++) {
- dx = scriptRand(con, 0x10000) - 0x8000;
- dy = scriptRand(con, 0x10000) - 0x8000;
-
- idx = newPart * 5 + 1;
- storeI32(con, 2, idx, dx);
- storeI32(con, 2, idx + 1, dy);
- storeI32(con, 2, idx + 2, maxLife);
- storeI32(con, 2, idx + 3, x << 16);
- storeI32(con, 2, idx + 4, y << 16);
-
- newPart++;
- if (newPart >= count) {
- newPart = 0;
- }
- }
- storeI32(con, 2, 0, newPart);
- }
-
- drawCount = 0;
- for (ct=0; ct < count; ct++) {
- srcIdx = ct * 5 + 1;
-
- dx = loadI32(con, 2, srcIdx);
- dy = loadI32(con, 2, srcIdx + 1);
- life = loadI32(con, 2, srcIdx + 2);
- posx = loadI32(con, 2, srcIdx + 3);
- posy = loadI32(con, 2, srcIdx + 4);
-
- if (life) {
- if (posy < (480 << 16)) {
- dstIdx = drawCount * 9;
- c = 0xffafcf | ((life >> lifeShift) << 24);
-
- storeU32(con, 1, dstIdx, c);
- storeI32(con, 1, dstIdx + 1, posx);
- storeI32(con, 1, dstIdx + 2, posy);
-
- storeU32(con, 1, dstIdx + 3, c);
- storeI32(con, 1, dstIdx + 4, posx + 0x10000);
- storeI32(con, 1, dstIdx + 5, posy + dy * 4);
-
- storeU32(con, 1, dstIdx + 6, c);
- storeI32(con, 1, dstIdx + 7, posx - 0x10000);
- storeI32(con, 1, dstIdx + 8, posy + dy * 4);
- drawCount ++;
- } else {
- if (dy > 0) {
- dy = (-dy) >> 1;
- }
- }
-
- posx = posx + dx;
- posy = posy + dy;
- dy = dy + 0x400;
- life --;
-
- //storeI32(con, 2, srcIdx, dx);
- storeI32(con, 2, srcIdx + 1, dy);
- storeI32(con, 2, srcIdx + 2, life);
- storeI32(con, 2, srcIdx + 3, posx);
- storeI32(con, 2, srcIdx + 4, posy);
- }
- }
-
- drawTriangleArray(con, NAMED_PartBuffer, drawCount);
- return 1;
-}
diff --git a/libs/rs/java/Film/res/raw/filmstrip.c b/libs/rs/java/Film/res/raw/filmstrip.c
deleted file mode 100644
index bf75675..0000000
--- a/libs/rs/java/Film/res/raw/filmstrip.c
+++ /dev/null
@@ -1,94 +0,0 @@
-// Fountain test script
-
-#pragma version(1)
-#pragma stateVertex(PVBackground)
-#pragma stateFragment(PFBackground)
-#pragma stateStore(PSBackground)
-
-#define STATE_TRIANGLE_OFFSET_COUNT 0
-#define STATE_LAST_FOCUS 1
-
-
-// The script enviroment has 3 env allocations.
-// bank0: (r) The enviroment structure
-// bank1: (r) The position information
-// bank2: (rw) The temporary texture state
-
-int lastFocus;
-
-int main(int index)
-{
- float mat1[16];
-
- float trans = Pos->translate;
- float rot = Pos->rotate;
-
- matrixLoadScale(mat1, 2.f, 2.f, 2.f);
- matrixTranslate(mat1, 0.f, 0.f, trans);
- matrixRotate(mat1, 90.f, 0.f, 0.f, 1.f);
- matrixRotate(mat1, rot, 1.f, 0.f, 0.f);
- vpLoadModelMatrix(mat1);
-
- // Draw the lighting effect in the strip and fill the Z buffer.
- drawSimpleMesh(NAMED_mesh);
-
- // Start of images.
- bindProgramStore(NAMED_PSImages);
- bindProgramFragment(NAMED_PFImages);
- bindProgramVertex(NAMED_PVImages);
-
- float focusPos = Pos->focus;
- int focusID = 0;
- int lastFocusID = loadI32(2, STATE_LAST_FOCUS);
- int imgCount = 13;
-
- if (trans > (-.3f)) {
- focusID = -1.0f - focusPos;
- if (focusID >= imgCount) {
- focusID = -1;
- }
- } else {
- focusID = -1;
- }
-
- /*
- if (focusID != lastFocusID) {
- if (lastFocusID >= 0) {
- uploadToTexture(con, env->tex[lastFocusID], 1);
- }
- if (focusID >= 0) {
- uploadToTexture(con, env->tex[focusID], 0);
- }
- }
- */
- lastFocus = focusID;
-
- int triangleOffsetsCount = Pos->triangleOffsetCount;
-
- int imgId = 0;
- for (imgId=1; imgId <= imgCount; imgId++) {
- float pos = focusPos + imgId + 0.4f;
- int offset = (int)floorf(pos * 2.f);
- pos = pos - 0.75f;
-
- offset = offset + triangleOffsetsCount / 2;
- if (!((offset < 0) || (offset >= triangleOffsetsCount))) {
- int start = offset -2;
- int end = offset + 2;
-
- if (start < 0) {
- start = 0;
- }
- if (end >= triangleOffsetsCount) {
- end = triangleOffsetsCount-1;
- }
-
- bindTexture(NAMED_PFImages, 0, loadI32(0, imgId - 1));
- matrixLoadTranslate(mat1, -pos - loadF(5, triangleOffsetsCount / 2), 0, 0);
- vpLoadTextureMatrix(mat1);
- drawSimpleMeshRange(NAMED_mesh, loadI32(4, start), (loadI32(4, end) - loadI32(4, start)));
- }
- }
- return 0;
-}
-
diff --git a/libs/rs/java/Film/src/com/android/film/Film.java b/libs/rs/java/Film/src/com/android/film/Film.java
deleted file mode 100644
index 6e99816..0000000
--- a/libs/rs/java/Film/src/com/android/film/Film.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.film;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-
-import android.app.Activity;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.provider.Settings.System;
-import android.util.Config;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.widget.Button;
-import android.widget.ListView;
-
-import java.lang.Runtime;
-
-public class Film extends Activity {
- //EventListener mListener = new EventListener();
-
- private static final String LOG_TAG = "libRS_jni";
- private static final boolean DEBUG = false;
- private static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV;
-
- private FilmView mView;
-
- // get the current looper (from your Activity UI thread for instance
-
-
-
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
-
- // Create our Preview view and set it as the content of our
- // Activity
- mView = new FilmView(this);
- setContentView(mView);
- }
-
- @Override
- protected void onResume() {
- // Ideally a game should implement onResume() and onPause()
- // to take appropriate action when the activity looses focus
- super.onResume();
- mView.onResume();
- }
-
- @Override
- protected void onPause() {
- // Ideally a game should implement onResume() and onPause()
- // to take appropriate action when the activity looses focus
- super.onPause();
- mView.onPause();
-
- Runtime.getRuntime().exit(0);
- }
-
-
- static void log(String message) {
- if (LOG_ENABLED) {
- Log.v(LOG_TAG, message);
- }
- }
-
-
-}
-
diff --git a/libs/rs/java/Film/src/com/android/film/FilmRS.java b/libs/rs/java/Film/src/com/android/film/FilmRS.java
deleted file mode 100644
index 93438a0..0000000
--- a/libs/rs/java/Film/src/com/android/film/FilmRS.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.film;
-
-import java.io.Writer;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.util.Log;
-
-import android.renderscript.*;
-
-public class FilmRS {
- class StripPosition {
- public float translate;
- public float rotate;
- public float focus;
- public int triangleOffsetCount;
- }
- StripPosition mPos = new StripPosition();
-
-
- private final int STATE_LAST_FOCUS = 1;
-
- public FilmRS() {
- }
-
- public void init(RenderScriptGL rs, Resources res, int width, int height) {
- mRS = rs;
- mRes = res;
- initRS();
- }
-
- public void setFilmStripPosition(int x, int y)
- {
- if (x < 50) {
- x = 50;
- }
- if (x > 270) {
- x = 270;
- }
-
- float anim = ((float)x-50) / 270.f;
- mPos.translate = 2f * anim + 0.5f; // translation
- mPos.rotate = (anim * 40); // rotation
- mPos.focus = ((float)y) / 16.f - 10.f; // focusPos
- mPos.triangleOffsetCount = mFSM.mTriangleOffsetsCount;
- mAllocPos.data(mPos);
- }
-
-
- private Resources mRes;
- private RenderScriptGL mRS;
- private Script mScriptStrip;
- private Script mScriptImage;
- private Sampler mSampler;
- private ProgramStore mPSBackground;
- private ProgramStore mPSImages;
- private ProgramFragment mPFBackground;
- private ProgramFragment mPFImages;
- private ProgramVertex mPVBackground;
- private ProgramVertex mPVImages;
- private ProgramVertex.MatrixAllocation mPVA;
- private Type mStripPositionType;
-
- private Allocation mImages[];
- private Allocation mAllocIDs;
- private Allocation mAllocPos;
- private Allocation mAllocState;
- private Allocation mAllocPV;
- private Allocation mAllocOffsetsTex;
- private Allocation mAllocOffsets;
-
- private SimpleMesh mMesh;
- private Light mLight;
-
- private FilmStripMesh mFSM;
-
- private int[] mBufferIDs;
- private float[] mBufferPos = new float[3];
- private int[] mBufferState;
-
- private void initPFS() {
- ProgramStore.Builder b = new ProgramStore.Builder(mRS, null, null);
-
- b.setDepthFunc(ProgramStore.DepthFunc.LESS);
- b.setDitherEnable(true);
- b.setDepthMask(true);
- mPSBackground = b.create();
- mPSBackground.setName("PSBackground");
-
- b.setDepthFunc(ProgramStore.DepthFunc.EQUAL);
- b.setDitherEnable(false);
- b.setDepthMask(false);
- b.setBlendFunc(ProgramStore.BlendSrcFunc.ONE,
- ProgramStore.BlendDstFunc.ONE);
- mPSImages = b.create();
- mPSImages.setName("PSImages");
- }
-
- private void initPF() {
- Sampler.Builder bs = new Sampler.Builder(mRS);
- bs.setMin(Sampler.Value.LINEAR);//_MIP_LINEAR);
- bs.setMag(Sampler.Value.LINEAR);
- bs.setWrapS(Sampler.Value.CLAMP);
- bs.setWrapT(Sampler.Value.WRAP);
- mSampler = bs.create();
-
- ProgramFragment.Builder b = new ProgramFragment.Builder(mRS);
- mPFBackground = b.create();
- mPFBackground.setName("PFBackground");
-
- b = new ProgramFragment.Builder(mRS);
- b.setTexture(ProgramFragment.Builder.EnvMode.REPLACE,
- ProgramFragment.Builder.Format.RGBA, 0);
- mPFImages = b.create();
- mPFImages.bindSampler(mSampler, 0);
- mPFImages.setName("PFImages");
- }
-
- private void initPV() {
- mLight = (new Light.Builder(mRS)).create();
- mLight.setPosition(0, -0.5f, -1.0f);
-
- ProgramVertex.Builder pvb = new ProgramVertex.Builder(mRS, null, null);
- //pvb.addLight(mLight);
- mPVBackground = pvb.create();
- mPVBackground.setName("PVBackground");
-
- pvb = new ProgramVertex.Builder(mRS, null, null);
- pvb.setTextureMatrixEnable(true);
- mPVImages = pvb.create();
- mPVImages.setName("PVImages");
- }
-
- private void loadImages() {
- mBufferIDs = new int[13];
- mImages = new Allocation[13];
- mAllocIDs = Allocation.createSized(mRS,
- Element.createUser(mRS, Element.DataType.FLOAT_32),
- mBufferIDs.length);
-
- Element ie = Element.createPixel(mRS, Element.DataType.UNSIGNED_5_6_5, Element.DataKind.PIXEL_RGB);
- mImages[0] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p01, ie, true);
- mImages[1] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p02, ie, true);
- mImages[2] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p03, ie, true);
- mImages[3] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p04, ie, true);
- mImages[4] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p05, ie, true);
- mImages[5] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p06, ie, true);
- mImages[6] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p07, ie, true);
- mImages[7] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p08, ie, true);
- mImages[8] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p09, ie, true);
- mImages[9] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p10, ie, true);
- mImages[10] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p11, ie, true);
- mImages[11] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p12, ie, true);
- mImages[12] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p13, ie, true);
-
- int black[] = new int[1024];
- for(int ct=0; ct < mImages.length; ct++) {
- Allocation.Adapter2D a = mImages[ct].createAdapter2D();
-
- int size = 512;
- int mip = 0;
- while(size >= 2) {
- a.subData(0, 0, 2, size, black);
- a.subData(size-2, 0, 2, size, black);
- a.subData(0, 0, size, 2, black);
- a.subData(0, size-2, size, 2, black);
- size >>= 1;
- mip++;
- a.setConstraint(Dimension.LOD, mip);
- }
-
- mImages[ct].uploadToTexture(1);
- mBufferIDs[ct] = mImages[ct].getID();
- }
- mAllocIDs.data(mBufferIDs);
- }
-
- private void initState()
- {
- mBufferState = new int[10];
- mAllocState = Allocation.createSized(mRS,
- Element.createUser(mRS, Element.DataType.FLOAT_32),
- mBufferState.length);
- mBufferState[STATE_LAST_FOCUS] = -1;
- mAllocState.data(mBufferState);
- }
-
- private void initRS() {
- mFSM = new FilmStripMesh();
- mMesh = mFSM.init(mRS);
- mMesh.setName("mesh");
-
- initPFS();
- initPF();
- initPV();
-
- Log.e("rs", "Done loading named");
-
- ScriptC.Builder sb = new ScriptC.Builder(mRS);
- sb.setScript(mRes, R.raw.filmstrip);
- mScriptStrip = sb.create();
-
- mAllocPos = Allocation.createTyped(mRS, mStripPositionType);
-
- loadImages();
- initState();
-
- mPVA = new ProgramVertex.MatrixAllocation(mRS);
- mPVBackground.bindAllocation(mPVA);
- mPVImages.bindAllocation(mPVA);
- mPVA.setupProjectionNormalized(320, 480);
-
-
- mScriptStrip.bindAllocation(mAllocIDs, 0);
- mScriptStrip.bindAllocation(mAllocPos, 1);
- mScriptStrip.bindAllocation(mAllocState, 2);
- mScriptStrip.bindAllocation(mPVA.mAlloc, 3);
-
-
- mAllocOffsets = Allocation.createSized(mRS,
- Element.createUser(mRS, Element.DataType.SIGNED_32), mFSM.mTriangleOffsets.length);
- mAllocOffsets.data(mFSM.mTriangleOffsets);
- mScriptStrip.bindAllocation(mAllocOffsets, 4);
-
- mAllocOffsetsTex = Allocation.createSized(mRS,
- Element.createUser(mRS, Element.DataType.FLOAT_32), mFSM.mTriangleOffsetsTex.length);
- mAllocOffsetsTex.data(mFSM.mTriangleOffsetsTex);
- mScriptStrip.bindAllocation(mAllocOffsetsTex, 5);
-
- setFilmStripPosition(0, 0);
- mRS.contextBindRootScript(mScriptStrip);
- }
-}
-
-
-
diff --git a/libs/rs/java/Film/src/com/android/film/FilmStripMesh.java b/libs/rs/java/Film/src/com/android/film/FilmStripMesh.java
deleted file mode 100644
index 448cce0..0000000
--- a/libs/rs/java/Film/src/com/android/film/FilmStripMesh.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * 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 com.android.film;
-
-import java.io.Writer;
-import java.lang.Math;
-import android.util.Log;
-
-import android.renderscript.RenderScript;
-import android.renderscript.SimpleMesh;
-
-
-class FilmStripMesh {
-
- class Vertex {
- float nx;
- float ny;
- float nz;
- float s;
- float t;
- float x;
- float y;
- float z;
-
- Vertex() {
- nx = 0;
- ny = 0;
- nz = 0;
- s = 0;
- t = 0;
- x = 0;
- y = 0;
- z = 0;
- }
-
- void xyz(float _x, float _y, float _z) {
- x = _x;
- y = _y;
- z = _z;
- }
-
- void nxyz(float _x, float _y, float _z) {
- nx = _x;
- ny = _y;
- nz = _z;
- }
-
- void st(float _s, float _t) {
- s = _s;
- t = _t;
- }
-
- void computeNorm(Vertex v1, Vertex v2) {
- float dx = v1.x - v2.x;
- float dy = v1.y - v2.y;
- float dz = v1.z - v2.z;
- float len = (float)java.lang.Math.sqrt(dx*dx + dy*dy + dz*dz);
- dx /= len;
- dy /= len;
- dz /= len;
-
- nx = dx * dz;
- ny = dy * dz;
- nz = (float)java.lang.Math.sqrt(dx*dx + dy*dy);
-
- len = (float)java.lang.Math.sqrt(nx*nx + ny*ny + nz*nz);
- nx /= len;
- ny /= len;
- nz /= len;
- }
- }
-
- int[] mTriangleOffsets;
- float[] mTriangleOffsetsTex;
- int mTriangleOffsetsCount;
-
- SimpleMesh init(RenderScript rs)
- {
- float vtx[] = new float[] {
- 60.431003f, 124.482050f,
- 60.862074f, 120.872604f,
- 61.705303f, 117.336662f,
- 62.949505f, 113.921127f,
- 64.578177f, 110.671304f,
- 66.569716f, 107.630302f,
- 68.897703f, 104.838457f,
- 71.531259f, 102.332803f,
- 74.435452f, 100.146577f,
- 77.571757f, 98.308777f,
- 80.898574f, 96.843781f,
- 84.371773f, 95.771023f,
- 87.945283f, 95.104731f,
- 98.958994f, 95.267098f,
- 109.489523f, 98.497596f,
- 118.699582f, 104.539366f,
- 125.856872f, 112.912022f,
- 130.392311f, 122.949849f,
- 131.945283f, 133.854731f,
- 130.392311f, 144.759613f,
- 125.856872f, 154.797439f,
- 118.699582f, 163.170096f,
- 109.489523f, 169.211866f,
- 98.958994f, 172.442364f,
- 87.945283f, 172.604731f,
- 72.507313f, 172.672927f,
- 57.678920f, 168.377071f,
- 44.668135f, 160.067134f,
- 34.534908f, 148.420104f,
- 28.104767f, 134.384831f,
- 25.901557f, 119.104731f,
- 28.104767f, 103.824631f,
- 34.534908f, 89.789358f,
- 44.668135f, 78.142327f,
- 57.678920f, 69.832390f,
- 72.507313f, 65.536534f,
- 87.945283f, 65.604731f,
- 106.918117f, 65.688542f,
- 125.141795f, 60.409056f,
- 141.131686f, 50.196376f,
- 153.585137f, 35.882502f,
- 161.487600f, 18.633545f,
- 164.195283f, -0.145269f,
- 161.487600f, -18.924084f,
- 153.585137f, -36.173040f,
- 141.131686f, -50.486914f,
- 125.141795f, -60.699594f,
- 106.918117f, -65.979081f,
- 87.945283f, -65.895269f,
- 80f, -65.895269f,
- 60f, -65.895269f,
- 40f, -65.895269f,
- 20f, -65.895269f,
- 0f, -65.895269f,
- -20f, -65.895269f,
- -40f, -65.895269f,
- -60f, -65.895269f,
- -80f, -65.895269f,
- -87.945283f, -65.895269f,
- -106.918117f, -65.979081f,
- -125.141795f, -60.699594f,
- -141.131686f, -50.486914f,
- -153.585137f, -36.173040f,
- -161.487600f, -18.924084f,
- -164.195283f, -0.145269f,
- -161.487600f, 18.633545f,
- -153.585137f, 35.882502f,
- -141.131686f, 50.196376f,
- -125.141795f, 60.409056f,
- -106.918117f, 65.688542f,
- -87.945283f, 65.604731f,
- -72.507313f, 65.536534f,
- -57.678920f, 69.832390f,
- -44.668135f, 78.142327f,
- -34.534908f, 89.789358f,
- -28.104767f, 103.824631f,
- -25.901557f, 119.104731f,
- -28.104767f, 134.384831f,
- -34.534908f, 148.420104f,
- -44.668135f, 160.067134f,
- -57.678920f, 168.377071f,
- -72.507313f, 172.672927f,
- -87.945283f, 172.604731f,
- -98.958994f, 172.442364f,
- -109.489523f, 169.211866f,
- -118.699582f, 163.170096f,
- -125.856872f, 154.797439f,
- -130.392311f, 144.759613f,
- -131.945283f, 133.854731f,
- -130.392311f, 122.949849f,
- -125.856872f, 112.912022f,
- -118.699582f, 104.539366f,
- -109.489523f, 98.497596f,
- -98.958994f, 95.267098f,
- -87.945283f, 95.104731f,
- -84.371773f, 95.771023f,
- -80.898574f, 96.843781f,
- -77.571757f, 98.308777f,
- -74.435452f, 100.146577f,
- -71.531259f, 102.332803f,
- -68.897703f, 104.838457f,
- -66.569716f, 107.630302f,
- -64.578177f, 110.671304f,
- -62.949505f, 113.921127f,
- -61.705303f, 117.336662f,
- -60.862074f, 120.872604f,
- -60.431003f, 124.482050f
- };
-
-
- mTriangleOffsets = new int[64];
- mTriangleOffsetsTex = new float[64];
-
- mTriangleOffsets[0] = 0;
- mTriangleOffsetsCount = 1;
-
- Vertex t = new Vertex();
- t.nxyz(1, 0, 0);
- int count = vtx.length / 2;
-
- SimpleMesh.TriangleMeshBuilder tm = new SimpleMesh.TriangleMeshBuilder(
- rs, 3,
- SimpleMesh.TriangleMeshBuilder.NORMAL | SimpleMesh.TriangleMeshBuilder.TEXTURE_0);
-
- float runningS = 0;
- for (int ct=0; ct < (count-1); ct++) {
- t.x = -vtx[ct*2] / 100.f;
- t.z = vtx[ct*2+1] / 100.f;
- t.s = runningS;
- t.nx = (vtx[ct*2+3] - vtx[ct*2 +1]);
- t.ny = (vtx[ct*2+2] - vtx[ct*2 ]);
- float len = (float)java.lang.Math.sqrt(t.nx * t.nx + t.ny * t.ny);
- runningS += len / 100;
- t.nx /= len;
- t.ny /= len;
- t.y = -0.5f;
- t.t = 0;
- tm.setNormal(t.nx, t.ny, t.nz);
- tm.setTexture(t.s, t.t);
- tm.addVertex(t.x, t.y, t.z);
- //android.util.Log.e("rs", "vtx x="+t.x+" y="+t.y+" z="+t.z+" s="+t.s+" t="+t.t);
- t.y = .5f;
- t.t = 1;
- tm.setTexture(t.s, t.t);
- tm.addVertex(t.x, t.y, t.z);
- //android.util.Log.e("rs", "vtx x="+t.x+" y="+t.y+" z="+t.z+" s="+t.s+" t="+t.t);
-
- if((runningS*2) > mTriangleOffsetsCount) {
- mTriangleOffsets[mTriangleOffsetsCount] = ct*2 * 3;
- mTriangleOffsetsTex[mTriangleOffsetsCount] = t.s;
- mTriangleOffsetsCount ++;
- }
- }
-
- count = (count * 2 - 2);
- for (int ct=0; ct < (count-2); ct+= 2) {
- tm.addTriangle(ct, ct+1, ct+2);
- tm.addTriangle(ct+1, ct+3, ct+2);
- }
- return tm.create();
- }
-
-
-}
-
diff --git a/libs/rs/java/Film/src/com/android/film/FilmView.java b/libs/rs/java/Film/src/com/android/film/FilmView.java
deleted file mode 100644
index 5bc2811..0000000
--- a/libs/rs/java/Film/src/com/android/film/FilmView.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.film;
-
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.concurrent.Semaphore;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-import android.renderscript.RenderScriptGL;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.Message;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Surface;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-public class FilmView extends RSSurfaceView {
-
- public FilmView(Context context) {
- super(context);
- //setFocusable(true);
- }
-
- private RenderScriptGL mRS;
- private FilmRS mRender;
-
-
- public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
- super.surfaceChanged(holder, format, w, h);
- if (mRS == null) {
- mRS = createRenderScript(true);
- mRS.contextSetSurface(w, h, holder.getSurface());
- mRender = new FilmRS();
- mRender.init(mRS, getResources(), w, h);
- }
- }
-
- @Override
- protected void onDetachedFromWindow() {
- if(mRS != null) {
- mRS = null;
- destroyRenderScript();
- }
- }
-
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event)
- {
- // break point at here
- // this method doesn't work when 'extends View' include 'extends ScrollView'.
- return super.onKeyDown(keyCode, event);
- }
-
-
- @Override
- public boolean onTouchEvent(MotionEvent ev)
- {
- boolean ret = true;
- int act = ev.getAction();
- if (act == ev.ACTION_UP) {
- ret = false;
- }
- mRender.setFilmStripPosition((int)ev.getX(), (int)ev.getY() / 5);
- return ret;
- }
-}
-
-
diff --git a/libs/rs/java/Fountain/res/raw/fountain.rs b/libs/rs/java/Fountain/res/raw/fountain.rs
index c44a796a..4b56b1b 100644
--- a/libs/rs/java/Fountain/res/raw/fountain.rs
+++ b/libs/rs/java/Fountain/res/raw/fountain.rs
@@ -9,7 +9,7 @@
static int newPart = 0;
-float4 partColor;
+static float4 partColor;
rs_mesh partMesh;
typedef struct __attribute__((packed, aligned(4))) Point {
@@ -44,22 +44,18 @@
#pragma rs export_func(addParticles)
-void addParticles(int rate, int x, int y)
+void addParticles(int rate, float x, float y, int newColor)
{
- //rsDebug("partColor", partColor);
- //rsDebug("partColor x", partColor.x);
- //rsDebug("partColor y", partColor.y);
- //rsDebug("partColor z", partColor.z);
- //rsDebug("partColor w", partColor.w);
-
+ if (newColor) {
+ partColor.x = rsRand(0.5f, 1.0f);
+ partColor.y = rsRand(1.0f);
+ partColor.z = rsRand(1.0f);
+ }
float rMax = ((float)rate) * 0.005f;
int size = rsAllocationGetDimX(rsGetAllocation(point));
+ uchar4 c = rsPackColorTo8888(partColor);
- uchar4 c = rsPackColorTo8888(partColor.x, partColor.y, partColor.z);
-
- //rsDebug("color ", ((int *)&c)[0]);
Point_t * np = &point[newPart];
-
float2 p = {x, y};
while (rate--) {
float angle = rsRand(3.14f * 2.f);
diff --git a/libs/rs/java/Fountain/res/raw/fountain_bc.bc b/libs/rs/java/Fountain/res/raw/fountain_bc.bc
index f90d8f1..66d50b3 100644
--- a/libs/rs/java/Fountain/res/raw/fountain_bc.bc
+++ b/libs/rs/java/Fountain/res/raw/fountain_bc.bc
Binary files differ
diff --git a/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java b/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java
index 7a7866d..6f4737f 100644
--- a/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java
+++ b/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java
@@ -48,18 +48,10 @@
mRS.contextBindRootScript(mScript);
}
- Float4 tmpColor = new Float4();
boolean holdingColor = false;
- java.util.Random mRand = new java.util.Random();
public void newTouchPosition(int x, int y, int rate) {
if (rate > 0) {
- if (!holdingColor) {
- tmpColor.x = mRand.nextFloat() * 0.5f + 0.5f;
- tmpColor.y = mRand.nextFloat();
- tmpColor.z = mRand.nextFloat();
- mScript.set_partColor(tmpColor);
- }
- mScript.invoke_addParticles(rate, x, y);
+ mScript.invoke_addParticles(rate, x, y, !holdingColor ? 1 : 0);
holdingColor = true;
} else {
holdingColor = false;
diff --git a/libs/rs/java/Fountain/src/com/android/fountain/ScriptC_Fountain.java b/libs/rs/java/Fountain/src/com/android/fountain/ScriptC_Fountain.java
index 88062e8..66b5b98 100644
--- a/libs/rs/java/Fountain/src/com/android/fountain/ScriptC_Fountain.java
+++ b/libs/rs/java/Fountain/src/com/android/fountain/ScriptC_Fountain.java
@@ -63,11 +63,12 @@
}
private final static int mExportFuncIdx_addParticles = 0;
- public void invoke_addParticles(int rate, int x, int y) {
- FieldPacker addParticles_fp = new FieldPacker(12);
+ public void invoke_addParticles(int rate, float x, float y, int newColor) {
+ FieldPacker addParticles_fp = new FieldPacker(16);
addParticles_fp.addI32(rate);
- addParticles_fp.addI32(x);
- addParticles_fp.addI32(y);
+ addParticles_fp.addF32(x);
+ addParticles_fp.addF32(y);
+ addParticles_fp.addI32(newColor);
invoke(mExportFuncIdx_addParticles, addParticles_fp);
}
diff --git a/libs/rs/java/ImageProcessing/res/raw/threshold.rs b/libs/rs/java/ImageProcessing/res/raw/threshold.rs
index 93a1a36..a8eb164 100644
--- a/libs/rs/java/ImageProcessing/res/raw/threshold.rs
+++ b/libs/rs/java/ImageProcessing/res/raw/threshold.rs
@@ -10,13 +10,9 @@
int width;
int radius;
-typedef struct c4u_s {
- uint8_t r, g, b, a;
-} c4u_t;
-
-c4u_t * InPixel;
-c4u_t * OutPixel;
-c4u_t * ScratchPixel;
+uchar4 * InPixel;
+uchar4 * OutPixel;
+uchar4 * ScratchPixel;
float inBlack;
float outBlack;
@@ -31,7 +27,7 @@
static float overInWMinInB;
//static float3 gammaV;
-#pragma rs export_var(height, width, radius, InPixel, OutPixel, ScratchPixel, inBlack, outBlack, inWhite, outWhite, gamma, saturation)
+#pragma rs export_var(height, width, radius, InPixel, OutPixel, ScratchPixel, inBlack, outBlack, inWhite, outWhite, gamma, saturation, InPixel, OutPixel, ScratchPixel)
#pragma rs export_func(filter, filterBenchmark);
// Store our coefficients here
@@ -166,19 +162,21 @@
for(h = 0; h < height; h ++) {
for(w = 0; w < width; w ++) {
- c4u_t *input = InPixel + h*width + w;
+ uchar4 *input = InPixel + h*width + w;
- currentPixel.x = (float)(input->r);
- currentPixel.y = (float)(input->g);
- currentPixel.z = (float)(input->b);
+ //currentPixel.xyz = convert_float3(input.xyz);
+ currentPixel.x = (float)(input->x);
+ currentPixel.y = (float)(input->y);
+ currentPixel.z = (float)(input->z);
currentPixel = levelsSaturation(currentPixel);
- c4u_t *output = OutPixel + h*width + w;
- output->r = (uint8_t)currentPixel.x;
- output->g = (uint8_t)currentPixel.y;
- output->b = (uint8_t)currentPixel.z;
- output->a = input->a;
+ uchar4 *output = OutPixel + h*width + w;
+ //output.xyz = convert_uchar3(currentPixel.xyz);
+ output->x = (uint8_t)currentPixel.x;
+ output->y = (uint8_t)currentPixel.y;
+ output->z = (uint8_t)currentPixel.z;
+ output->w = input->w;
}
}
rsSendToClient(&count, 1, 4, 0);
@@ -205,21 +203,21 @@
validW = width - 1;
}
- c4u_t *input = InPixel + h*width + validW;
+ uchar4 *input = InPixel + h*width + validW;
float weight = gaussian[r + radius];
- currentPixel.x = (float)(input->r);
- currentPixel.y = (float)(input->g);
- currentPixel.z = (float)(input->b);
+ currentPixel.x = (float)(input->x);
+ currentPixel.y = (float)(input->y);
+ currentPixel.z = (float)(input->z);
//currentPixel.w = (float)(input->a);
blurredPixel += currentPixel*weight;
}
- c4u_t *output = ScratchPixel + h*width + w;
- output->r = (uint8_t)blurredPixel.x;
- output->g = (uint8_t)blurredPixel.y;
- output->b = (uint8_t)blurredPixel.z;
+ uchar4 *output = ScratchPixel + h*width + w;
+ output->x = (uint8_t)blurredPixel.x;
+ output->y = (uint8_t)blurredPixel.y;
+ output->z = (uint8_t)blurredPixel.z;
//output->a = (uint8_t)blurredPixel.w;
}
}
@@ -246,12 +244,12 @@
validW = width - 1;
}
- c4u_t *input = InPixel + h*width + validW;
+ uchar4 *input = InPixel + h*width + validW;
float weight = gaussian[r + radius];
- currentPixel.x = (float)(input->r);
- currentPixel.y = (float)(input->g);
- currentPixel.z = (float)(input->b);
+ currentPixel.x = (float)(input->x);
+ currentPixel.y = (float)(input->y);
+ currentPixel.z = (float)(input->z);
//currentPixel.w = (float)(input->a);
blurredPixel += currentPixel*weight;
@@ -259,10 +257,10 @@
blurredPixel = levelsSaturation(blurredPixel);
- c4u_t *output = ScratchPixel + h*width + w;
- output->r = (uint8_t)blurredPixel.x;
- output->g = (uint8_t)blurredPixel.y;
- output->b = (uint8_t)blurredPixel.z;
+ uchar4 *output = ScratchPixel + h*width + w;
+ output->x = (uint8_t)blurredPixel.x;
+ output->y = (uint8_t)blurredPixel.y;
+ output->z = (uint8_t)blurredPixel.z;
//output->a = (uint8_t)blurredPixel.w;
}
}
@@ -287,23 +285,23 @@
validH = height - 1;
}
- c4u_t *input = ScratchPixel + validH*width + w;
+ uchar4 *input = ScratchPixel + validH*width + w;
float weight = gaussian[r + radius];
- currentPixel.x = (float)(input->r);
- currentPixel.y = (float)(input->g);
- currentPixel.z = (float)(input->b);
+ currentPixel.x = (float)(input->x);
+ currentPixel.y = (float)(input->y);
+ currentPixel.z = (float)(input->z);
//currentPixel.w = (float)(input->a);
blurredPixel += currentPixel*weight;
}
- c4u_t *output = OutPixel + h*width + w;
+ uchar4 *output = OutPixel + h*width + w;
- output->r = (uint8_t)blurredPixel.x;
- output->g = (uint8_t)blurredPixel.y;
- output->b = (uint8_t)blurredPixel.z;
+ output->x = (uint8_t)blurredPixel.x;
+ output->y = (uint8_t)blurredPixel.y;
+ output->z = (uint8_t)blurredPixel.z;
//output->a = (uint8_t)blurredPixel.w;
}
}
diff --git a/libs/rs/java/ImageProcessing/res/raw/threshold_bc.bc b/libs/rs/java/ImageProcessing/res/raw/threshold_bc.bc
index 4cf0629..fd60f76 100644
--- a/libs/rs/java/ImageProcessing/res/raw/threshold_bc.bc
+++ b/libs/rs/java/ImageProcessing/res/raw/threshold_bc.bc
Binary files differ
diff --git a/libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java b/libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
index b39d141..7bf6596 100644
--- a/libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
+++ b/libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
@@ -285,7 +285,7 @@
long t = java.lang.System.currentTimeMillis();
if (true) {
- mScript.invokable_Filter();
+ mScript.invoke_filter();
mRS.finish();
} else {
javaFilter();
@@ -355,7 +355,7 @@
public void surfaceCreated(SurfaceHolder holder) {
createScript();
- mScript.invokable_Filter();
+ mScript.invoke_filter();
mRS.finish();
}
@@ -373,7 +373,7 @@
mOutPixelsAllocation = Allocation.createBitmapRef(mRS, mBitmapOut);
mScratchPixelsAllocation = Allocation.createBitmapRef(mRS, mBitmapScratch);
- mScript = new ScriptC_Threshold(mRS, getResources(), false);
+ mScript = new ScriptC_Threshold(mRS, getResources(), R.raw.threshold_bc, false);
mScript.set_width(mBitmapIn.getWidth());
mScript.set_height(mBitmapIn.getHeight());
mScript.set_radius(mRadius);
@@ -413,7 +413,7 @@
long t = java.lang.System.currentTimeMillis();
- mScript.invokable_FilterBenchmark();
+ mScript.invoke_filterBenchmark();
mRS.finish();
t = java.lang.System.currentTimeMillis() - t;
@@ -426,7 +426,7 @@
mRadius = oldRadius;
mScript.set_radius(mRadius);
- mScript.invokable_Filter();
+ mScript.invoke_filter();
mRS.finish();
}
}
diff --git a/libs/rs/java/ImageProcessing/src/com/android/rs/image/ScriptC_Threshold.java b/libs/rs/java/ImageProcessing/src/com/android/rs/image/ScriptC_Threshold.java
index 42adb27..ea363d3 100644
--- a/libs/rs/java/ImageProcessing/src/com/android/rs/image/ScriptC_Threshold.java
+++ b/libs/rs/java/ImageProcessing/src/com/android/rs/image/ScriptC_Threshold.java
@@ -1,115 +1,175 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.android.rs.image;
-import android.content.res.Resources;
import android.renderscript.*;
+import android.content.res.Resources;
import android.util.Log;
-public class ScriptC_Threshold
- extends android.renderscript.ScriptC
-{
- private final static int mFieldIndex_height = 0;
- private final static int mFieldIndex_width = 1;
- private final static int mFieldIndex_radius = 2;
- private final static int mFieldIndex_InPixel = 3;
- private final static int mFieldIndex_OutPixel = 4;
- private final static int mFieldIndex_ScratchPixel = 5;
-
- private final static int mFieldIndex_inBlack = 6;
- private final static int mFieldIndex_outBlack = 7;
- private final static int mFieldIndex_inWhite = 8;
- private final static int mFieldIndex_outWhite = 9;
- private final static int mFieldIndex_gamma = 10;
-
- private final static int mFieldIndex_saturation = 11;
- private final static int mFieldIndex_hue = 12;
-
- private Allocation mField_InPixel;
- private Allocation mField_OutPixel;
- private Allocation mField_ScratchPixel;
-
- public ScriptC_Threshold(RenderScript rs, Resources resources, boolean isRoot) {
- super(rs, resources, R.raw.threshold_bc, isRoot);
+public class ScriptC_Threshold extends ScriptC {
+ // Constructor
+ public ScriptC_Threshold(RenderScript rs, Resources resources, int id, boolean isRoot) {
+ super(rs, resources, id, isRoot);
}
- public void bind_InPixel(Allocation f) {
- if (f != null) {
- //if (f.getType().getElement() != Element.ATTRIB_COLOR_U8_4(mRS)) {
- //throw new IllegalArgumentException("Element type mismatch.");
- //}
- }
- bindAllocation(f, mFieldIndex_InPixel);
- mField_InPixel = f;
- }
- public Allocation get_InPixel() {
- return mField_InPixel;
- }
-
- public void bind_OutPixel(Allocation f) {
- if (f != null) {
- //if (f.getType().getElement() != Element.ATTRIB_COLOR_U8_4(mRS)) {
- //throw new IllegalArgumentException("Element type mismatch.");
- //}
- }
- bindAllocation(f, mFieldIndex_OutPixel);
- mField_OutPixel = f;
- }
- public void bind_ScratchPixel(Allocation f) {
- if (f != null) {
- //if (f.getType().getElement() != Element.ATTRIB_COLOR_U8_4(mRS)) {
- //throw new IllegalArgumentException("Element type mismatch.");
- //}
- }
- bindAllocation(f, mFieldIndex_ScratchPixel);
- mField_ScratchPixel = f;
- }
- public Allocation get_OutPixel() {
- return mField_OutPixel;
- }
-
+ private final static int mExportVarIdx_height = 0;
+ private int mExportVar_height;
public void set_height(int v) {
- setVar(mFieldIndex_height, v);
+ mExportVar_height = v;
+ setVar(mExportVarIdx_height, v);
}
+ public int get_height() {
+ return mExportVar_height;
+ }
+
+ private final static int mExportVarIdx_width = 1;
+ private int mExportVar_width;
public void set_width(int v) {
- setVar(mFieldIndex_width, v);
+ mExportVar_width = v;
+ setVar(mExportVarIdx_width, v);
}
+ public int get_width() {
+ return mExportVar_width;
+ }
+
+ private final static int mExportVarIdx_radius = 2;
+ private int mExportVar_radius;
public void set_radius(int v) {
- setVar(mFieldIndex_radius, v);
+ mExportVar_radius = v;
+ setVar(mExportVarIdx_radius, v);
}
+ public int get_radius() {
+ return mExportVar_radius;
+ }
+
+ private final static int mExportVarIdx_InPixel = 3;
+ private Allocation mExportVar_InPixel;
+ public void bind_InPixel(Allocation v) {
+ mExportVar_InPixel = v;
+ if(v == null) bindAllocation(null, mExportVarIdx_InPixel);
+ else bindAllocation(v, mExportVarIdx_InPixel);
+ }
+
+ public Allocation get_InPixel() {
+ return mExportVar_InPixel;
+ }
+
+ private final static int mExportVarIdx_OutPixel = 4;
+ private Allocation mExportVar_OutPixel;
+ public void bind_OutPixel(Allocation v) {
+ mExportVar_OutPixel = v;
+ if(v == null) bindAllocation(null, mExportVarIdx_OutPixel);
+ else bindAllocation(v, mExportVarIdx_OutPixel);
+ }
+
+ public Allocation get_OutPixel() {
+ return mExportVar_OutPixel;
+ }
+
+ private final static int mExportVarIdx_ScratchPixel = 5;
+ private Allocation mExportVar_ScratchPixel;
+ public void bind_ScratchPixel(Allocation v) {
+ mExportVar_ScratchPixel = v;
+ if(v == null) bindAllocation(null, mExportVarIdx_ScratchPixel);
+ else bindAllocation(v, mExportVarIdx_ScratchPixel);
+ }
+
+ public Allocation get_ScratchPixel() {
+ return mExportVar_ScratchPixel;
+ }
+
+ private final static int mExportVarIdx_inBlack = 6;
+ private float mExportVar_inBlack;
public void set_inBlack(float v) {
- setVar(mFieldIndex_inBlack, v);
+ mExportVar_inBlack = v;
+ setVar(mExportVarIdx_inBlack, v);
}
+
+ public float get_inBlack() {
+ return mExportVar_inBlack;
+ }
+
+ private final static int mExportVarIdx_outBlack = 7;
+ private float mExportVar_outBlack;
public void set_outBlack(float v) {
- setVar(mFieldIndex_outBlack, v);
+ mExportVar_outBlack = v;
+ setVar(mExportVarIdx_outBlack, v);
}
+
+ public float get_outBlack() {
+ return mExportVar_outBlack;
+ }
+
+ private final static int mExportVarIdx_inWhite = 8;
+ private float mExportVar_inWhite;
public void set_inWhite(float v) {
- setVar(mFieldIndex_inWhite, v);
+ mExportVar_inWhite = v;
+ setVar(mExportVarIdx_inWhite, v);
}
+
+ public float get_inWhite() {
+ return mExportVar_inWhite;
+ }
+
+ private final static int mExportVarIdx_outWhite = 9;
+ private float mExportVar_outWhite;
public void set_outWhite(float v) {
- setVar(mFieldIndex_outWhite, v);
+ mExportVar_outWhite = v;
+ setVar(mExportVarIdx_outWhite, v);
}
+
+ public float get_outWhite() {
+ return mExportVar_outWhite;
+ }
+
+ private final static int mExportVarIdx_gamma = 10;
+ private float mExportVar_gamma;
public void set_gamma(float v) {
- setVar(mFieldIndex_gamma, v);
+ mExportVar_gamma = v;
+ setVar(mExportVarIdx_gamma, v);
}
+ public float get_gamma() {
+ return mExportVar_gamma;
+ }
+
+ private final static int mExportVarIdx_saturation = 11;
+ private float mExportVar_saturation;
public void set_saturation(float v) {
- setVar(mFieldIndex_saturation, v);
- }
- public void set_hue(float v) {
- setVar(mFieldIndex_hue, v);
+ mExportVar_saturation = v;
+ setVar(mExportVarIdx_saturation, v);
}
- private final static int mInvokableIndex_Filter = 4;
- public void invokable_Filter() {
- invoke(mInvokableIndex_Filter);
+ public float get_saturation() {
+ return mExportVar_saturation;
}
- private final static int mInvokableIndex_FilterBenchmark = 5;
- public void invokable_FilterBenchmark() {
- invoke(mInvokableIndex_FilterBenchmark);
+ private final static int mExportFuncIdx_filter = 0;
+ public void invoke_filter() {
+ invoke(mExportFuncIdx_filter);
}
+
+ private final static int mExportFuncIdx_filterBenchmark = 1;
+ public void invoke_filterBenchmark() {
+ invoke(mExportFuncIdx_filterBenchmark);
+ }
+
}
diff --git a/libs/rs/java/ModelViewer/res/raw/modelviewer_bc.bc b/libs/rs/java/ModelViewer/res/raw/modelviewer_bc.bc
index b02250b..367a3f4 100644
--- a/libs/rs/java/ModelViewer/res/raw/modelviewer_bc.bc
+++ b/libs/rs/java/ModelViewer/res/raw/modelviewer_bc.bc
Binary files differ
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/ModelViewerRS.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/ModelViewerRS.java
index dd52955..e581520 100644
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/ModelViewerRS.java
+++ b/libs/rs/java/ModelViewer/src/com/android/modelviewer/ModelViewerRS.java
@@ -57,7 +57,7 @@
private SimpleMesh mMesh;
- private ScriptC_ModelViewer mScript;
+ private ScriptC_Modelviewer mScript;
int mLastX;
int mLastY;
@@ -130,7 +130,7 @@
private void initRS() {
- mScript = new ScriptC_ModelViewer(mRS, mRes, true);
+ mScript = new ScriptC_Modelviewer(mRS, mRes, R.raw.modelviewer_bc, true);
initPFS();
initPF();
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/ScriptC_ModelViewer.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/ScriptC_ModelViewer.java
deleted file mode 100644
index f617c77..0000000
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/ScriptC_ModelViewer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-
-package com.android.modelviewer;
-
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.util.Log;
-
-
-
-public class ScriptC_ModelViewer
- extends android.renderscript.ScriptC
-{
- public ScriptC_ModelViewer(RenderScript rs, Resources resources, boolean isRoot) {
- super(rs, resources, R.raw.modelviewer_bc, isRoot);
- }
-
- public void set_gPVBackground(ProgramVertex v) {
- setVar(0, v.getID());
- }
-
- public void set_gPFBackground(ProgramFragment v) {
- setVar(1, v.getID());
- }
-
- public void set_gTGrid(Allocation v) {
- setVar(2, v.getID());
- }
-
- public void set_gTestMesh(SimpleMesh v) {
- setVar(3, v.getID());
- }
-
- public void set_gPFSBackground(ProgramStore v) {
- setVar(4, v.getID());
- }
-
- public void set_gRotate(float v) {
- setVar(5, v);
- }
-
-}
-
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/ScriptC_Modelviewer.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/ScriptC_Modelviewer.java
new file mode 100644
index 0000000..7a965b8
--- /dev/null
+++ b/libs/rs/java/ModelViewer/src/com/android/modelviewer/ScriptC_Modelviewer.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.modelviewer;
+
+import android.renderscript.*;
+import android.content.res.Resources;
+import android.util.Log;
+
+public class ScriptC_Modelviewer extends ScriptC {
+ // Constructor
+ public ScriptC_Modelviewer(RenderScript rs, Resources resources, int id, boolean isRoot) {
+ super(rs, resources, id, isRoot);
+ }
+
+ private final static int mExportVarIdx_gPVBackground = 0;
+ private ProgramVertex mExportVar_gPVBackground;
+ public void set_gPVBackground(ProgramVertex v) {
+ mExportVar_gPVBackground = v;
+ setVar(mExportVarIdx_gPVBackground, (v == null) ? 0 : v.getID());
+ }
+
+ public ProgramVertex get_gPVBackground() {
+ return mExportVar_gPVBackground;
+ }
+
+ private final static int mExportVarIdx_gPFBackground = 1;
+ private ProgramFragment mExportVar_gPFBackground;
+ public void set_gPFBackground(ProgramFragment v) {
+ mExportVar_gPFBackground = v;
+ setVar(mExportVarIdx_gPFBackground, (v == null) ? 0 : v.getID());
+ }
+
+ public ProgramFragment get_gPFBackground() {
+ return mExportVar_gPFBackground;
+ }
+
+ private final static int mExportVarIdx_gTGrid = 2;
+ private Allocation mExportVar_gTGrid;
+ public void set_gTGrid(Allocation v) {
+ mExportVar_gTGrid = v;
+ setVar(mExportVarIdx_gTGrid, (v == null) ? 0 : v.getID());
+ }
+
+ public Allocation get_gTGrid() {
+ return mExportVar_gTGrid;
+ }
+
+ private final static int mExportVarIdx_gTestMesh = 3;
+ private SimpleMesh mExportVar_gTestMesh;
+ public void set_gTestMesh(SimpleMesh v) {
+ mExportVar_gTestMesh = v;
+ setVar(mExportVarIdx_gTestMesh, (v == null) ? 0 : v.getID());
+ }
+
+ public SimpleMesh get_gTestMesh() {
+ return mExportVar_gTestMesh;
+ }
+
+ private final static int mExportVarIdx_gPFSBackground = 4;
+ private ProgramStore mExportVar_gPFSBackground;
+ public void set_gPFSBackground(ProgramStore v) {
+ mExportVar_gPFSBackground = v;
+ setVar(mExportVarIdx_gPFSBackground, (v == null) ? 0 : v.getID());
+ }
+
+ public ProgramStore get_gPFSBackground() {
+ return mExportVar_gPFSBackground;
+ }
+
+ private final static int mExportVarIdx_gRotate = 5;
+ private float mExportVar_gRotate;
+ public void set_gRotate(float v) {
+ mExportVar_gRotate = v;
+ setVar(mExportVarIdx_gRotate, v);
+ }
+
+ public float get_gRotate() {
+ return mExportVar_gRotate;
+ }
+
+}
+
diff --git a/libs/rs/rsComponent.cpp b/libs/rs/rsComponent.cpp
index b120c21..8e509ad 100644
--- a/libs/rs/rsComponent.cpp
+++ b/libs/rs/rsComponent.cpp
@@ -152,6 +152,10 @@
case RS_TYPE_UNSIGNED_64:
mTypeBits = 64;
break;
+
+ case RS_TYPE_BOOLEAN:
+ mTypeBits = 8;
+ break;
}
mBits = mTypeBits * mVectorSize;
@@ -192,82 +196,6 @@
return 0;
}
-static const char * gCTypeStrings[] = {
- 0,
- 0,//"F16",
- "float",
- "double",
- "char",
- "short",
- "int",
- 0,//"S64",
- "char",//U8",
- "short",//U16",
- "int",//U32",
- 0,//"U64",
- 0,//"UP_565",
- 0,//"UP_5551",
- 0,//"UP_4444",
- 0,//"ELEMENT",
- 0,//"TYPE",
- 0,//"ALLOCATION",
- 0,//"SAMPLER",
- 0,//"SCRIPT",
- 0,//"MESH",
- 0,//"PROGRAM_FRAGMENT",
- 0,//"PROGRAM_VERTEX",
- 0,//"PROGRAM_RASTER",
- 0,//"PROGRAM_STORE",
-};
-
-static const char * gCVecTypeStrings[] = {
- 0,
- 0,//"F16",
- "vecF32",
- "vecF64",
- "vecI8",
- "vecI16",
- "vecI32",
- 0,//"S64",
- "vecU8",//U8",
- "vecU16",//U16",
- "vecU32",//U32",
- 0,//"U64",
- 0,//"UP_565",
- 0,//"UP_5551",
- 0,//"UP_4444",
- 0,//"ELEMENT",
- 0,//"TYPE",
- 0,//"ALLOCATION",
- 0,//"SAMPLER",
- 0,//"SCRIPT",
- 0,//"MESH",
- 0,//"PROGRAM_FRAGMENT",
- 0,//"PROGRAM_VERTEX",
- 0,//"PROGRAM_RASTER",
- 0,//"PROGRAM_STORE",
-};
-
-String8 Component::getCType() const
-{
- char buf[64];
- if (mVectorSize == 1) {
- return String8(gCTypeStrings[mType]);
- }
-
- // Yuck, acc WAR
- // Appears to have problems packing chars
- if (mVectorSize == 4 && mType == RS_TYPE_UNSIGNED_8) {
- return String8("int");
- }
-
-
- String8 s(gCVecTypeStrings[mType]);
- sprintf(buf, "_%i_t", mVectorSize);
- s.append(buf);
- return s;
-}
-
String8 Component::getGLSLType() const
{
if (mType == RS_TYPE_SIGNED_32) {
@@ -302,6 +230,7 @@
"U16",
"U32",
"U64",
+ "BOOLEAN",
"UP_565",
"UP_5551",
"UP_4444",
diff --git a/libs/rs/rsComponent.h b/libs/rs/rsComponent.h
index 0f93a91..15fd5dd 100644
--- a/libs/rs/rsComponent.h
+++ b/libs/rs/rsComponent.h
@@ -35,7 +35,6 @@
uint32_t getGLType() const;
uint32_t getGLFormat() const;
- String8 getCType() const;
String8 getGLSLType() const;
void dumpLOGV(const char *prefix) const;
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp
index 8fbf004..aa20275 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -232,45 +232,6 @@
return e;
}
-String8 Element::getCStructBody(uint32_t indent) const
-{
- String8 si;
- for (uint32_t ct=0; ct < indent; ct++) {
- si.append(" ");
- }
-
- String8 s(si);
- s.append("{\n");
- for (uint32_t ct = 0; ct < mFieldCount; ct++) {
- s.append(si);
- s.append(mFields[ct].e->getCType(indent+4));
- s.append(" ");
- s.append(mFields[ct].name);
- s.append(";\n");
- }
- s.append(si);
- s.append("}");
- return s;
-}
-
-String8 Element::getCType(uint32_t indent) const
-{
- String8 s;
- for (uint32_t ct=0; ct < indent; ct++) {
- s.append(" ");
- }
-
- if (!mFieldCount) {
- // Basic component.
- s.append(mComponent.getCType());
- } else {
- s.append("struct ");
- s.append(getCStructBody(indent));
- }
-
- return s;
-}
-
String8 Element::getGLSLType(uint32_t indent) const
{
String8 s;
diff --git a/libs/rs/rsElement.h b/libs/rs/rsElement.h
index 5c4f5c4..90e7cc8 100644
--- a/libs/rs/rsElement.h
+++ b/libs/rs/rsElement.h
@@ -54,8 +54,6 @@
RsDataKind getKind() const {return mComponent.getKind();}
uint32_t getBits() const {return mBits;}
- String8 getCType(uint32_t indent=0) const;
- String8 getCStructBody(uint32_t indent=0) const;
String8 getGLSLType(uint32_t indent=0) const;
void dumpLOGV(const char *prefix) const;
diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp
index e7292c0..b8d1461 100644
--- a/libs/rs/rsProgramVertex.cpp
+++ b/libs/rs/rsProgramVertex.cpp
@@ -138,6 +138,11 @@
const Element *e = mConstantTypes[ct]->getElement();
for (uint32_t field=0; field < e->getFieldCount(); field++) {
const Element *f = e->getField(field);
+ const char *fn = e->getFieldName(field);
+
+ if (fn[0] == '#') {
+ continue;
+ }
// Cannot be complex
rsAssert(!f->getFieldCount());
@@ -150,7 +155,7 @@
rsAssert(0);
}
- mShader.append(e->getFieldName(field));
+ mShader.append(fn);
mShader.append(";\n");
}
}
diff --git a/libs/rs/rsScriptC_LibGL.cpp b/libs/rs/rsScriptC_LibGL.cpp
index f0de908..052e144 100644
--- a/libs/rs/rsScriptC_LibGL.cpp
+++ b/libs/rs/rsScriptC_LibGL.cpp
@@ -345,8 +345,6 @@
{ "rsgGetWidth", (void *)&SC_getWidth },
{ "rsgGetHeight", (void *)&SC_getHeight },
- { "_Z18rsgUploadToTextureii", (void *)&SC_uploadToTexture2 },
- { "_Z18rsgUploadToTexturei", (void *)&SC_uploadToTexture },
{ "_Z18rsgUploadToTexture13rs_allocationi", (void *)&SC_uploadToTexture2 },
{ "_Z18rsgUploadToTexture13rs_allocation", (void *)&SC_uploadToTexture },
{ "rsgUploadToBufferObject", (void *)&SC_uploadToBufferObject },
@@ -358,8 +356,6 @@
{ "rsgDrawSpriteScreenspace", (void *)&SC_drawSpriteScreenspace },
{ "_Z17rsgDrawSimpleMesh7rs_mesh", (void *)&SC_drawSimpleMesh },
{ "_Z17rsgDrawSimpleMesh7rs_meshii", (void *)&SC_drawSimpleMeshRange },
- { "_Z17rsgDrawSimpleMeshi", (void *)&SC_drawSimpleMesh },
- { "_Z17rsgDrawSimpleMeshiii", (void *)&SC_drawSimpleMeshRange },
{ "rsgClearColor", (void *)&SC_ClearColor },
{ "rsgClearDepth", (void *)&SC_ClearDepth },
@@ -370,7 +366,6 @@
{ "updateSimpleMesh", (void *)&SC_updateSimpleMesh },
// misc
- //{ "pfClearColor", (void *)&SC_ClearColor },
{ "color", (void *)&SC_color },
{ NULL, NULL }
diff --git a/libs/rs/scriptc/rs_cl.rsh b/libs/rs/scriptc/rs_cl.rsh
index 69e7902..64844a4 100644
--- a/libs/rs/scriptc/rs_cl.rsh
+++ b/libs/rs/scriptc/rs_cl.rsh
@@ -7,15 +7,15 @@
// Conversions
#define CVT_FUNC_2(typeout, typein) \
static typeout##2 __attribute__((overloadable)) convert_##typeout##2(typein##2 v) { \
- typeout##2 r = {v.x, v.y}; \
+ typeout##2 r = {(typeout)v.x, (typeout)v.y}; \
return r; \
} \
static typeout##3 __attribute__((overloadable)) convert_##typeout##3(typein##3 v) { \
- typeout##3 r = {v.x, v.y, v.z}; \
+ typeout##3 r = {(typeout)v.x, (typeout)v.y, (typeout)v.z}; \
return r; \
} \
static typeout##4 __attribute__((overloadable)) convert_##typeout##4(typein##4 v) { \
- typeout##4 r = {v.x, v.y, v.z, v.w}; \
+ typeout##4 r = {(typeout)v.x, (typeout)v.y, (typeout)v.z, (typeout)v.w}; \
return r; \
}
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index 7cb01d0..a7a37f8 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -485,13 +485,13 @@
copybit_device_t* const copybit = blitengine;
if (copybit) {
copybit_image_t simg;
- simg.w = src->width;
+ simg.w = src->stride;
simg.h = src->height;
simg.format = src->format;
simg.handle = const_cast<native_handle_t*>(src->handle);
copybit_image_t dimg;
- dimg.w = dst->width;
+ dimg.w = dst->stride;
dimg.h = dst->height;
dimg.format = dst->format;
dimg.handle = const_cast<native_handle_t*>(dst->handle);
diff --git a/preloaded-classes b/preloaded-classes
index da5502d..9686fc9 100644
--- a/preloaded-classes
+++ b/preloaded-classes
@@ -684,7 +684,6 @@
com.android.internal.view.menu.MenuBuilder
com.android.internal.view.menu.MenuItemImpl
com.android.internal.view.menu.SubMenuBuilder
-com.android.internal.widget.ContactHeaderWidget
com.android.internal.widget.DialogTitle
com.android.internal.widget.EditableInputConnection
com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
diff --git a/services/java/com/android/server/ProcessStats.java b/services/java/com/android/server/ProcessStats.java
index a02c4e7..4fa89d9 100644
--- a/services/java/com/android/server/ProcessStats.java
+++ b/services/java/com/android/server/ProcessStats.java
@@ -687,7 +687,7 @@
break;
}
}
- return new String(mBuffer, 0, 0, i);
+ return new String(mBuffer, 0, i);
}
} catch (java.io.FileNotFoundException e) {
} catch (java.io.IOException e) {
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java
index 8fc4d57..b1ca7852 100644
--- a/services/java/com/android/server/TelephonyRegistry.java
+++ b/services/java/com/android/server/TelephonyRegistry.java
@@ -233,6 +233,7 @@
if (!checkNotifyPermission("notifyCallState()")) {
return;
}
+ ArrayList<IBinder> removeList = new ArrayList<IBinder>();
synchronized (mRecords) {
mCallState = state;
mCallIncomingNumber = incomingNumber;
@@ -241,10 +242,11 @@
try {
r.callback.onCallStateChanged(state, incomingNumber);
} catch (RemoteException ex) {
- remove(r.binder);
+ removeList.add(r.binder);
}
}
}
+ for (IBinder b : removeList) remove(b);
}
broadcastCallStateChanged(state, incomingNumber);
}
@@ -268,6 +270,7 @@
if (!checkNotifyPermission("notifySignalStrength()")) {
return;
}
+ ArrayList<IBinder> removeList = new ArrayList<IBinder>();
synchronized (mRecords) {
mSignalStrength = signalStrength;
for (Record r : mRecords) {
@@ -280,10 +283,11 @@
r.callback.onSignalStrengthChanged((gsmSignalStrength == 99 ? -1
: gsmSignalStrength));
} catch (RemoteException ex) {
- remove(r.binder);
+ removeList.add(r.binder);
}
}
}
+ for (IBinder b : removeList) remove(b);
}
broadcastSignalStrengthChanged(signalStrength);
}
@@ -292,6 +296,7 @@
if (!checkNotifyPermission("notifyMessageWaitingChanged()")) {
return;
}
+ ArrayList<IBinder> removeList = new ArrayList<IBinder>();
synchronized (mRecords) {
mMessageWaiting = mwi;
for (Record r : mRecords) {
@@ -299,10 +304,11 @@
try {
r.callback.onMessageWaitingIndicatorChanged(mwi);
} catch (RemoteException ex) {
- remove(r.binder);
+ removeList.add(r.binder);
}
}
}
+ for (IBinder b : removeList) remove(b);
}
}
@@ -310,6 +316,7 @@
if (!checkNotifyPermission("notifyCallForwardingChanged()")) {
return;
}
+ ArrayList<IBinder> removeList = new ArrayList<IBinder>();
synchronized (mRecords) {
mCallForwarding = cfi;
for (Record r : mRecords) {
@@ -317,10 +324,11 @@
try {
r.callback.onCallForwardingIndicatorChanged(cfi);
} catch (RemoteException ex) {
- remove(r.binder);
+ removeList.add(r.binder);
}
}
}
+ for (IBinder b : removeList) remove(b);
}
}
@@ -328,6 +336,7 @@
if (!checkNotifyPermission("notifyDataActivity()" )) {
return;
}
+ ArrayList<IBinder> removeList = new ArrayList<IBinder>();
synchronized (mRecords) {
mDataActivity = state;
for (Record r : mRecords) {
@@ -335,10 +344,11 @@
try {
r.callback.onDataActivity(state);
} catch (RemoteException ex) {
- remove(r.binder);
+ removeList.add(r.binder);
}
}
}
+ for (IBinder b : removeList) remove(b);
}
}
@@ -376,15 +386,17 @@
modified = true;
}
if (modified) {
+ ArrayList<IBinder> removeList = new ArrayList<IBinder>();
for (Record r : mRecords) {
if ((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) {
try {
r.callback.onDataConnectionStateChanged(state, networkType);
} catch (RemoteException ex) {
- remove(r.binder);
+ removeList.add(r.binder);
}
}
}
+ for (IBinder b : removeList) remove(b);
}
}
broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn,
diff --git a/services/java/com/android/server/ThrottleService.java b/services/java/com/android/server/ThrottleService.java
index 2645e42..d841cb3 100644
--- a/services/java/com/android/server/ThrottleService.java
+++ b/services/java/com/android/server/ThrottleService.java
@@ -312,22 +312,6 @@
}
}, new IntentFilter(ACTION_RESET));
- // use a new thread as we don't want to stall the system for file writes
- mThread = new HandlerThread(TAG);
- mThread.start();
- mHandler = new MyHandler(mThread.getLooper());
- mHandler.obtainMessage(EVENT_REBOOT_RECOVERY).sendToTarget();
-
- mInterfaceObserver = new InterfaceObserver(mHandler, EVENT_IFACE_UP, mIface);
- try {
- mNMService.registerObserver(mInterfaceObserver);
- } catch (RemoteException e) {
- Slog.e(TAG, "Could not register InterfaceObserver " + e);
- }
-
- mSettingsObserver = new SettingsObserver(mHandler, EVENT_POLICY_CHANGED);
- mSettingsObserver.observe(mContext);
-
FileInputStream stream = null;
try {
Properties properties = new Properties();
@@ -344,6 +328,22 @@
} catch (Exception e) {}
}
}
+
+ // use a new thread as we don't want to stall the system for file writes
+ mThread = new HandlerThread(TAG);
+ mThread.start();
+ mHandler = new MyHandler(mThread.getLooper());
+ mHandler.obtainMessage(EVENT_REBOOT_RECOVERY).sendToTarget();
+
+ mInterfaceObserver = new InterfaceObserver(mHandler, EVENT_IFACE_UP, mIface);
+ try {
+ mNMService.registerObserver(mInterfaceObserver);
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Could not register InterfaceObserver " + e);
+ }
+
+ mSettingsObserver = new SettingsObserver(mHandler, EVENT_POLICY_CHANGED);
+ mSettingsObserver.observe(mContext);
}
diff --git a/telephony/java/com/android/internal/telephony/IccUtils.java b/telephony/java/com/android/internal/telephony/IccUtils.java
index 95bce13..005ae37 100644
--- a/telephony/java/com/android/internal/telephony/IccUtils.java
+++ b/telephony/java/com/android/internal/telephony/IccUtils.java
@@ -51,6 +51,8 @@
ret.append((char)('0' + v));
v = (data[i] >> 4) & 0xf;
+ // Some PLMNs have 'f' as high nibble, ignore it
+ if (v == 0xf) continue;
if (v > 9) break;
ret.append((char)('0' + v));
}
diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java
index 5bd9e39..f1d2488 100644
--- a/telephony/java/com/android/internal/telephony/RIL.java
+++ b/telephony/java/com/android/internal/telephony/RIL.java
@@ -2338,7 +2338,7 @@
case RIL_UNSOL_RESTRICTED_STATE_CHANGED: ret = responseInts(p); break;
case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED: ret = responseVoid(p); break;
case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS: ret = responseCdmaSms(p); break;
- case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS: ret = responseString(p); break;
+ case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS: ret = responseRaw(p); break;
case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL: ret = responseVoid(p); break;
case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break;
case RIL_UNSOL_CDMA_CALL_WAITING: ret = responseCdmaCallWaiting(p); break;
diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java
index d711a80..d99a348 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java
@@ -93,6 +93,7 @@
static final int SPN_RULE_SHOW_PLMN = 0x02;
// From TS 51.011 EF[SPDI] section
+ static final int TAG_SPDI = 0xA3;
static final int TAG_SPDI_PLMN_LIST = 0x80;
// Full Name IEI from TS 24.008
@@ -1426,8 +1427,12 @@
byte[] plmnEntries = null;
- // There should only be one TAG_SPDI_PLMN_LIST
for ( ; tlv.isValidObject() ; tlv.nextObject()) {
+ // Skip SPDI tag, if existant
+ if (tlv.getTag() == TAG_SPDI) {
+ tlv = new SimTlv(tlv.getData(), 0, tlv.getData().length);
+ }
+ // There should only be one TAG_SPDI_PLMN_LIST
if (tlv.getTag() == TAG_SPDI_PLMN_LIST) {
plmnEntries = tlv.getData();
break;
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java
index 5ca5975..5b4faf97 100644
--- a/wifi/java/android/net/wifi/WifiStateTracker.java
+++ b/wifi/java/android/net/wifi/WifiStateTracker.java
@@ -1424,7 +1424,7 @@
int netId = -1;
String[] lines = reply.split("\n");
for (String line : lines) {
- String[] prop = line.split(" *= *");
+ String[] prop = line.split(" *= *", 2);
if (prop.length < 2)
continue;
String name = prop[0];