use of android.database.MatrixCursor in project android_frameworks_base by ResurrectionRemix.
the class ExternalStorageProvider method queryRoots.
@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
synchronized (mRootsLock) {
for (RootInfo root : mRoots.values()) {
final RowBuilder row = result.newRow();
row.add(Root.COLUMN_ROOT_ID, root.rootId);
row.add(Root.COLUMN_FLAGS, root.flags);
row.add(Root.COLUMN_TITLE, root.title);
row.add(Root.COLUMN_DOCUMENT_ID, root.docId);
row.add(Root.COLUMN_AVAILABLE_BYTES, root.reportAvailableBytes ? root.path.getFreeSpace() : -1);
}
}
return result;
}
use of android.database.MatrixCursor in project android_frameworks_base by ResurrectionRemix.
the class SettingsProvider method getAllGlobalSettings.
private Cursor getAllGlobalSettings(String[] projection) {
if (DEBUG) {
Slog.v(LOG_TAG, "getAllGlobalSettings()");
}
synchronized (mLock) {
// Get the settings.
SettingsState settingsState = mSettingsRegistry.getSettingsLocked(SETTINGS_TYPE_GLOBAL, UserHandle.USER_SYSTEM);
List<String> names = settingsState.getSettingNamesLocked();
final int nameCount = names.size();
String[] normalizedProjection = normalizeProjection(projection);
MatrixCursor result = new MatrixCursor(normalizedProjection, nameCount);
// Anyone can get the global settings, so no security checks.
for (int i = 0; i < nameCount; i++) {
String name = names.get(i);
Setting setting = settingsState.getSettingLocked(name);
appendSettingToCursor(result, setting);
}
return result;
}
}
use of android.database.MatrixCursor in project android_frameworks_base by ResurrectionRemix.
the class SettingsProvider method getAllSecureSettings.
private Cursor getAllSecureSettings(int userId, String[] projection) {
if (DEBUG) {
Slog.v(LOG_TAG, "getAllSecureSettings(" + userId + ")");
}
// Resolve the userId on whose behalf the call is made.
final int callingUserId = resolveCallingUserIdEnforcingPermissionsLocked(userId);
synchronized (mLock) {
List<String> names = mSettingsRegistry.getSettingsNamesLocked(SETTINGS_TYPE_SECURE, callingUserId);
final int nameCount = names.size();
String[] normalizedProjection = normalizeProjection(projection);
MatrixCursor result = new MatrixCursor(normalizedProjection, nameCount);
for (int i = 0; i < nameCount; i++) {
String name = names.get(i);
// Determine the owning user as some profile settings are cloned from the parent.
final int owningUserId = resolveOwningUserIdForSecureSettingLocked(callingUserId, name);
// Special case for location (sigh).
if (isLocationProvidersAllowedRestricted(name, callingUserId, owningUserId)) {
continue;
}
Setting setting = mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_SECURE, owningUserId, name);
appendSettingToCursor(result, setting);
}
return result;
}
}
use of android.database.MatrixCursor in project android_frameworks_base by ResurrectionRemix.
the class MusicProvider method getRootContainerCurser.
public MatrixCursor getRootContainerCurser() {
MatrixCursor matrixCursor = new MatrixCursor(BrowserService.MEDIA_CONTAINER_PROJECTION);
Uri.Builder pianoBuilder = new Uri.Builder();
pianoBuilder.authority(BrowserService.AUTHORITY);
pianoBuilder.appendPath(BrowserService.PIANO_BASE_PATH);
matrixCursor.addRow(new Object[] { pianoBuilder.build(), BrowserService.PIANO_BASE_PATH, "subtitle", null, 0 });
Uri.Builder voiceBuilder = new Uri.Builder();
voiceBuilder.authority(BrowserService.AUTHORITY);
voiceBuilder.appendPath(BrowserService.VOICE_BASE_PATH);
matrixCursor.addRow(new Object[] { voiceBuilder.build(), BrowserService.VOICE_BASE_PATH, "subtitle", null, 0 });
return matrixCursor;
}
use of android.database.MatrixCursor in project android_frameworks_base by ResurrectionRemix.
the class TestDocumentsProvider method queryRecentDocuments.
@Override
public Cursor queryRecentDocuments(String rootId, String[] projection) throws FileNotFoundException {
if (LAG)
lagUntilCanceled(null);
if (RECENT_WEDGE)
wedgeUntilCanceled(null);
// Pretend to take a super long time to respond
SystemClock.sleep(3000);
final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
includeFile(result, "It was /worth/ the_wait for?the file:with the&incredibly long name", 0);
return result;
}
Aggregations