Search in sources :

Example 1 with ContentProviderHolder

use of android.app.IActivityManager.ContentProviderHolder in project android_frameworks_base by ParanoidAndroid.

the class ContentProviderRecord method newHolder.

public ContentProviderHolder newHolder(ContentProviderConnection conn) {
    ContentProviderHolder holder = new ContentProviderHolder(info);
    holder.provider = provider;
    holder.noReleaseNeeded = noReleaseNeeded;
    holder.connection = conn;
    return holder;
}
Also used : ContentProviderHolder(android.app.IActivityManager.ContentProviderHolder)

Example 2 with ContentProviderHolder

use of android.app.IActivityManager.ContentProviderHolder in project platform_frameworks_base by android.

the class ContentProviderRecord method newHolder.

public ContentProviderHolder newHolder(ContentProviderConnection conn) {
    ContentProviderHolder holder = new ContentProviderHolder(info);
    holder.provider = provider;
    holder.noReleaseNeeded = noReleaseNeeded;
    holder.connection = conn;
    return holder;
}
Also used : ContentProviderHolder(android.app.IActivityManager.ContentProviderHolder)

Example 3 with ContentProviderHolder

use of android.app.IActivityManager.ContentProviderHolder in project android_frameworks_base by DirtyUnicorns.

the class ShellUiAutomatorBridge method getSystemLongPressTime.

public long getSystemLongPressTime() {
    // Read the long press timeout setting.
    long longPressTimeout = 0;
    try {
        IContentProvider provider = null;
        Cursor cursor = null;
        IActivityManager activityManager = ActivityManagerNative.getDefault();
        String providerName = Settings.Secure.CONTENT_URI.getAuthority();
        IBinder token = new Binder();
        try {
            ContentProviderHolder holder = activityManager.getContentProviderExternal(providerName, UserHandle.USER_SYSTEM, token);
            if (holder == null) {
                throw new IllegalStateException("Could not find provider: " + providerName);
            }
            provider = holder.provider;
            cursor = provider.query(null, Settings.Secure.CONTENT_URI, new String[] { Settings.Secure.VALUE }, "name=?", new String[] { Settings.Secure.LONG_PRESS_TIMEOUT }, null, null);
            if (cursor.moveToFirst()) {
                longPressTimeout = cursor.getInt(0);
            }
        } finally {
            if (cursor != null) {
                cursor.close();
            }
            if (provider != null) {
                activityManager.removeContentProviderExternal(providerName, token);
            }
        }
    } catch (RemoteException e) {
        String message = "Error reading long press timeout setting.";
        Log.e(LOG_TAG, message, e);
        throw new RuntimeException(message, e);
    }
    return longPressTimeout;
}
Also used : IBinder(android.os.IBinder) Binder(android.os.Binder) IBinder(android.os.IBinder) IContentProvider(android.content.IContentProvider) ContentProviderHolder(android.app.IActivityManager.ContentProviderHolder) Cursor(android.database.Cursor) RemoteException(android.os.RemoteException) IActivityManager(android.app.IActivityManager)

Example 4 with ContentProviderHolder

use of android.app.IActivityManager.ContentProviderHolder in project android_frameworks_base by DirtyUnicorns.

the class ContentProviderRecord method newHolder.

public ContentProviderHolder newHolder(ContentProviderConnection conn) {
    ContentProviderHolder holder = new ContentProviderHolder(info);
    holder.provider = provider;
    holder.noReleaseNeeded = noReleaseNeeded;
    holder.connection = conn;
    return holder;
}
Also used : ContentProviderHolder(android.app.IActivityManager.ContentProviderHolder)

Example 5 with ContentProviderHolder

use of android.app.IActivityManager.ContentProviderHolder in project android_frameworks_base by AOSPA.

the class ShellUiAutomatorBridge method getSystemLongPressTime.

public long getSystemLongPressTime() {
    // Read the long press timeout setting.
    long longPressTimeout = 0;
    try {
        IContentProvider provider = null;
        Cursor cursor = null;
        IActivityManager activityManager = ActivityManagerNative.getDefault();
        String providerName = Settings.Secure.CONTENT_URI.getAuthority();
        IBinder token = new Binder();
        try {
            ContentProviderHolder holder = activityManager.getContentProviderExternal(providerName, UserHandle.USER_SYSTEM, token);
            if (holder == null) {
                throw new IllegalStateException("Could not find provider: " + providerName);
            }
            provider = holder.provider;
            cursor = provider.query(null, Settings.Secure.CONTENT_URI, new String[] { Settings.Secure.VALUE }, "name=?", new String[] { Settings.Secure.LONG_PRESS_TIMEOUT }, null, null);
            if (cursor.moveToFirst()) {
                longPressTimeout = cursor.getInt(0);
            }
        } finally {
            if (cursor != null) {
                cursor.close();
            }
            if (provider != null) {
                activityManager.removeContentProviderExternal(providerName, token);
            }
        }
    } catch (RemoteException e) {
        String message = "Error reading long press timeout setting.";
        Log.e(LOG_TAG, message, e);
        throw new RuntimeException(message, e);
    }
    return longPressTimeout;
}
Also used : IBinder(android.os.IBinder) Binder(android.os.Binder) IBinder(android.os.IBinder) IContentProvider(android.content.IContentProvider) ContentProviderHolder(android.app.IActivityManager.ContentProviderHolder) Cursor(android.database.Cursor) RemoteException(android.os.RemoteException) IActivityManager(android.app.IActivityManager)

Aggregations

ContentProviderHolder (android.app.IActivityManager.ContentProviderHolder)17 IActivityManager (android.app.IActivityManager)11 IContentProvider (android.content.IContentProvider)11 Binder (android.os.Binder)11 IBinder (android.os.IBinder)11 RemoteException (android.os.RemoteException)11 Cursor (android.database.Cursor)5