Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit afe02f8d authored by The Android Automerger's avatar The Android Automerger
Browse files

Merge branch 'eclair' into eclair-release

parents 5e512d91 30998a59
Loading
Loading
Loading
Loading
+42 −9
Original line number Diff line number Diff line
@@ -172,6 +172,10 @@ public class BluetoothService extends IBluetooth.Stub {

    public boolean isEnabled() {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        return isEnabledInternal();
    }

    private boolean isEnabledInternal() {
        return mBluetoothState == BluetoothAdapter.STATE_ON;
    }

@@ -328,7 +332,7 @@ public class BluetoothService extends IBluetooth.Stub {
        public void handleMessage(Message msg) {
            switch (msg.what) {
            case MESSAGE_REGISTER_SDP_RECORDS:
                if (!isEnabled()) {
                if (!isEnabledInternal()) {
                    return;
                }
                // SystemService.start() forks sdptool to register service
@@ -375,7 +379,7 @@ public class BluetoothService extends IBluetooth.Stub {
                break;
            case MESSAGE_DISCOVERABLE_TIMEOUT:
                int mode = msg.arg1;
                if (isEnabled()) {
                if (isEnabledInternal()) {
                    // TODO: Switch back to the previous scan mode
                    // This is ok for now, because we only use
                    // CONNECTABLE and CONNECTABLE_DISCOVERABLE
@@ -675,7 +679,9 @@ public class BluetoothService extends IBluetooth.Stub {
    }

    /*package*/synchronized void getAllProperties() {

        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        if (!isEnabledInternal()) return;
        mAdapterProperties.clear();

        String properties[] = (String [])getAdapterPropertiesNative();
@@ -734,16 +740,19 @@ public class BluetoothService extends IBluetooth.Stub {
    // The following looks dirty.
    private boolean setPropertyString(String key, String value) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        if (!isEnabledInternal()) return false;
        return setAdapterPropertyStringNative(key, value);
    }

    private boolean setPropertyInteger(String key, int value) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        if (!isEnabledInternal()) return false;
        return setAdapterPropertyIntegerNative(key, value);
    }

    private boolean setPropertyBoolean(String key, boolean value) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        if (!isEnabledInternal()) return false;
        return setAdapterPropertyBooleanNative(key, value ? 1 : 0);
    }

@@ -852,7 +861,7 @@ public class BluetoothService extends IBluetooth.Stub {

    public synchronized int getScanMode() {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        if (!isEnabled())
        if (!isEnabledInternal())
            return BluetoothAdapter.SCAN_MODE_NONE;

        boolean pairable = getProperty("Pairable").equals("true");
@@ -863,15 +872,16 @@ public class BluetoothService extends IBluetooth.Stub {
    public synchronized boolean startDiscovery() {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH_ADMIN permission");
        if (!isEnabled()) {
            return false;
        }
        if (!isEnabledInternal()) return false;

        return startDiscoveryNative();
    }

    public synchronized boolean cancelDiscovery() {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH_ADMIN permission");
        if (!isEnabledInternal()) return false;

        return stopDiscoveryNative();
    }

@@ -887,6 +897,8 @@ public class BluetoothService extends IBluetooth.Stub {
    public synchronized boolean createBond(String address) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH_ADMIN permission");
        if (!isEnabledInternal()) return false;

        if (!BluetoothAdapter.checkBluetoothAddress(address)) {
            return false;
        }
@@ -919,6 +931,8 @@ public class BluetoothService extends IBluetooth.Stub {
    public synchronized boolean cancelBondProcess(String address) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH_ADMIN permission");
        if (!isEnabledInternal()) return false;

        if (!BluetoothAdapter.checkBluetoothAddress(address)) {
            return false;
        }
@@ -936,6 +950,8 @@ public class BluetoothService extends IBluetooth.Stub {
    public synchronized boolean removeBond(String address) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH_ADMIN permission");
        if (!isEnabledInternal()) return false;

        if (!BluetoothAdapter.checkBluetoothAddress(address)) {
            return false;
        }
@@ -960,6 +976,8 @@ public class BluetoothService extends IBluetooth.Stub {
    }

    /*package*/ String[] getRemoteDeviceProperties(String address) {
        if (!isEnabledInternal()) return null;

        String objectPath = getObjectPathFromAddress(address);
        return (String [])getDevicePropertiesNative(objectPath);
    }
@@ -1055,6 +1073,8 @@ public class BluetoothService extends IBluetooth.Stub {
            return false;
        }

        if (!isEnabledInternal()) return false;

        return setDevicePropertyBooleanNative(getObjectPathFromAddress(address), "Trusted",
                value ? 1 : 0);
    }
@@ -1144,6 +1164,8 @@ public class BluetoothService extends IBluetooth.Stub {
    public synchronized boolean fetchRemoteUuids(String address, ParcelUuid uuid,
            IBluetoothCallback callback) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        if (!isEnabledInternal()) return false;

        if (!BluetoothAdapter.checkBluetoothAddress(address)) {
            return false;
        }
@@ -1198,6 +1220,8 @@ public class BluetoothService extends IBluetooth.Stub {
     */
    public int getRemoteServiceChannel(String address, ParcelUuid uuid) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        if (!isEnabledInternal()) return -1;

        if (!BluetoothAdapter.checkBluetoothAddress(address)) {
            return BluetoothDevice.ERROR;
        }
@@ -1216,6 +1240,8 @@ public class BluetoothService extends IBluetooth.Stub {
    public synchronized boolean setPin(String address, byte[] pin) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH_ADMIN permission");
        if (!isEnabledInternal()) return false;

        if (pin == null || pin.length <= 0 || pin.length > 16 ||
            !BluetoothAdapter.checkBluetoothAddress(address)) {
            return false;
@@ -1242,6 +1268,8 @@ public class BluetoothService extends IBluetooth.Stub {
    public synchronized boolean setPasskey(String address, int passkey) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH_ADMIN permission");
        if (!isEnabledInternal()) return false;

        if (passkey < 0 || passkey > 999999 || !BluetoothAdapter.checkBluetoothAddress(address)) {
            return false;
        }
@@ -1259,6 +1287,8 @@ public class BluetoothService extends IBluetooth.Stub {
    public synchronized boolean setPairingConfirmation(String address, boolean confirm) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH_ADMIN permission");
        if (!isEnabledInternal()) return false;

        address = address.toUpperCase();
        Integer data = mEventLoop.getPasskeyAgentRequestData().remove(address);
        if (data == null) {
@@ -1273,6 +1303,8 @@ public class BluetoothService extends IBluetooth.Stub {
    public synchronized boolean cancelPairingUserInput(String address) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                "Need BLUETOOTH_ADMIN permission");
        if (!isEnabledInternal()) return false;

        if (!BluetoothAdapter.checkBluetoothAddress(address)) {
            return false;
        }
@@ -1289,7 +1321,7 @@ public class BluetoothService extends IBluetooth.Stub {
        return cancelPairingUserInputNative(address, data.intValue());
    }

    public void updateDeviceServiceChannelCache(String address) {
    /*package*/ void updateDeviceServiceChannelCache(String address) {
        ParcelUuid[] deviceUuids = getRemoteUuids(address);
        // We are storing the rfcomm channel numbers only for the uuids
        // we are interested in.
@@ -1364,8 +1396,9 @@ public class BluetoothService extends IBluetooth.Stub {
     */
    public synchronized int addRfcommServiceRecord(String serviceName, ParcelUuid uuid,
            int channel, IBinder b) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM,
                                                "Need BLUETOOTH permission");
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        if (!isEnabledInternal()) return -1;

        if (serviceName == null || uuid == null || channel < 1 ||
                channel > BluetoothSocket.MAX_RFCOMM_CHANNEL) {
            return -1;
+1 −1
Original line number Diff line number Diff line
@@ -432,7 +432,7 @@ public class QwertyKeyListener extends BaseKeyListener {
        PICKER_SETS.put('y', "\u00FD\u00FF");
        PICKER_SETS.put('z', "\u017A\u017C\u017E");
        PICKER_SETS.put(KeyCharacterMap.PICKER_DIALOG_INPUT,
                             "\u2026\u00A5\u2022\u00AE\u00A9\u00B1[]{}\\");
                             "\u2026\u00A5\u2022\u00AE\u00A9\u00B1[]{}\\|");
        PICKER_SETS.put('/', "\\");

        // From packages/inputmethods/LatinIME/res/xml/kbd_symbols.xml
+42 −40
Original line number Diff line number Diff line
@@ -120,6 +120,14 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
        int CONTACT_STATUS_LABEL = 9;
    }
    
    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,
@@ -144,6 +152,7 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
    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);
@@ -229,9 +238,34 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
        protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
            try{
                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);
                        }
                        mPhotoView.setImageBitmap(photoBitmap);
                        if (cookie != null && cookie instanceof Uri) {
                            mPhotoView.assignContactUri((Uri) cookie);
                        }
                        invalidate();
                        break;
                    }
                    case TOKEN_CONTACT_INFO: {
                        if (cursor != null && cursor.moveToFirst()) {
                            bindContactInfo(cursor);
                            Uri lookupUri = Contacts.getLookupUri(cursor.getLong(ContactQuery._ID), 
                                    cursor.getString(ContactQuery.LOOKUP_KEY));
                            startPhotoQuery(cursor.getLong(ContactQuery.PHOTO_ID), lookupUri);
                            invalidate();
                        }
                        break;
                    }
                    case TOKEN_PHONE_LOOKUP: {
@@ -375,8 +409,6 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
     */
    public void bindFromContactUri(Uri contactUri) {
        mContactUri = contactUri;
        long contactId = ContentUris.parseId(contactUri);

        startContactQuery(contactUri);
    }

@@ -424,30 +456,24 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
                null, null, null);
    }

    protected void startPhotoQuery(long photoId, Uri lookupKey) {
        mQueryHandler.startQuery(TOKEN_PHOTO_QUERY, lookupKey, 
                ContentUris.withAppendedId(Data.CONTENT_URI, photoId), PhotoQuery.COLUMNS,
                null, null, null);
    }
    
    /**
     * Bind the contact details provided by the given {@link Cursor}.
     */
    protected void bindContactInfo(Cursor c) {
        if (c == null || !c.moveToFirst()) return;

        // TODO: Bring back phonetic name
        final String displayName = c.getString(ContactQuery.DISPLAY_NAME);
        final long contactId = c.getLong(ContactQuery._ID);
        final String lookupKey = c.getString(ContactQuery.LOOKUP_KEY);
        final String phoneticName = null;
        this.setDisplayName(displayName, null);

        final boolean starred = c.getInt(ContactQuery.STARRED) != 0;
        mStarredView.setChecked(starred);

        //Set the photo
        Bitmap photoBitmap = loadContactPhoto(c.getLong(ContactQuery.PHOTO_ID), null);
        if (photoBitmap == null) {
            photoBitmap = loadPlaceholderPhoto(null);
        }
        mPhotoView.setImageBitmap(photoBitmap);
        mPhotoView.assignContactUri(Contacts.getLookupUri(contactId, lookupKey));

        //Set the presence status
        if (!c.isNull(ContactQuery.CONTACT_PRESENCE_STATUS)) {
            int presence = c.getInt(ContactQuery.CONTACT_PRESENCE_STATUS);
@@ -554,30 +580,6 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
        }
    }

    private Bitmap loadContactPhoto(long photoId, BitmapFactory.Options options) {
        Cursor photoCursor = null;
        Bitmap photoBm = null;

        try {
            photoCursor = mContentResolver.query(
                    ContentUris.withAppendedId(Data.CONTENT_URI, photoId),
                    new String[] { Photo.PHOTO },
                    null, null, null);

            if (photoCursor != null && photoCursor.moveToFirst() && !photoCursor.isNull(0)) {
                byte[] photoData = photoCursor.getBlob(0);
                photoBm = BitmapFactory.decodeByteArray(photoData, 0,
                        photoData.length, options);
            }
        } finally {
            if (photoCursor != null) {
                photoCursor.close();
            }
        }

        return photoBm;
    }

    private Bitmap loadPlaceholderPhoto(BitmapFactory.Options options) {
        if (mNoPhotoResource == 0) {
            return null;
+14 −14
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_marginTop="6dip"
            android:layout_alignParentRight="true"
            android:layout_marginRight="8dip"
            android:textAppearance="?android:attr/textAppearanceMedium"
@@ -46,17 +47,18 @@
        <com.android.internal.widget.DigitalClock android:id="@+id/time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/carrier"
            android:layout_alignParentLeft="true"
            android:layout_marginBottom="8dip"
            android:layout_marginLeft="24dip"
            android:layout_alignParentTop="true"
            android:layout_marginTop="15dip"
            android:layout_marginBottom="6dip"
            android:layout_marginLeft="20dip"
            >

            <TextView android:id="@+id/timeDisplay"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="bottom"
                android:textSize="72sp"
                android:textSize="56sp"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:shadowColor="#C0000000"
                android:shadowDx="0"
@@ -64,14 +66,13 @@
                android:shadowRadius="3.0"
                />


            <TextView android:id="@+id/am_pm"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:gravity="bottom"
                android:textSize="22sp"
                android:textSize="18sp"
                android:singleLine="true"
                android:layout_marginLeft="8dip"
                android:layout_marginLeft="4dip"
                android:layout_marginBottom="-6dip"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:shadowColor="#C0000000"
@@ -87,7 +88,7 @@
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/time"
            android:layout_marginLeft="16dip"
            android:layout_marginLeft="24dip"
            android:textAppearance="?android:attr/textAppearanceMedium"
            />
    
@@ -95,7 +96,6 @@

    <View
        android:id="@+id/divider"
        android:layout_below="@id/date"
        android:layout_width="fill_parent"
        android:layout_height="1dip"
        android:layout_marginTop="8dip"
@@ -109,8 +109,8 @@
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="3dip"
        android:layout_marginLeft="16dip"
        android:layout_marginTop="0dip"
        android:layout_marginLeft="12dip"
        android:gravity="left"
        >
        <TextView
@@ -118,7 +118,7 @@
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="17sp"
            android:textSize="18sp"
            android:drawablePadding="4dip"
            />
        <TextView
@@ -128,7 +128,7 @@
            android:layout_marginLeft="5dip"
            android:layout_marginRight="5dip"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="17sp"
            android:textSize="18sp"
            />
        <TextView
            android:id="@+id/status2"
@@ -136,7 +136,7 @@
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="17sp"
            android:textSize="18sp"
            android:drawablePadding="4dip"
            />
    </LinearLayout>
+5 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ public class RenderScript {
    native void nContextDestroy(int con);
    native void nContextSetSurface(int w, int h, Surface sur);
    native void nContextSetPriority(int p);
    native void nContextDump(int bits);

    native void nContextBindRootScript(int script);
    native void nContextBindSampler(int sampler, int slot);
@@ -304,6 +305,10 @@ public class RenderScript {
        nContextSetSurface(w, h, mSurface);
    }

    public void contextDump(int bits) {
        nContextDump(bits);
    }

    public void destroy() {
        nContextDeinitToClient();
        mMessageThread.mRun = false;
Loading