You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
108 lines
3.4 KiB
Java
108 lines
3.4 KiB
Java
package android.content;
|
|
|
|
import java.io.File;
|
|
import java.io.FileNotFoundException;
|
|
|
|
import android.accounts.Account;
|
|
import android.database.ContentObserver;
|
|
import android.database.Cursor;
|
|
import android.database.MatrixCursor;
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import android.os.CancellationSignal;
|
|
import android.os.ParcelFileDescriptor;
|
|
|
|
public class ContentResolver {
|
|
public static final String SYNC_EXTRAS_IGNORE_SETTINGS = "ignore_settings";
|
|
|
|
public final void registerContentObserver(Uri uri, boolean notifyForDescendants, ContentObserver observer) {
|
|
}
|
|
public final void unregisterContentObserver(ContentObserver observer) {
|
|
}
|
|
public void notifyChange(Uri uri, ContentObserver observer) {
|
|
}
|
|
public int getUserId() {
|
|
return 0;
|
|
}
|
|
public final void registerContentObserver(Uri uri, boolean notifyForDescendants, ContentObserver observer, int userHandle) {
|
|
}
|
|
|
|
public ParcelFileDescriptor openFileDescriptor(Uri uri, String mode) throws FileNotFoundException {
|
|
if ("file".equals(uri.getScheme())) {
|
|
return ParcelFileDescriptor.open(new File(uri.getPath()), ParcelFileDescriptor.parseMode(mode));
|
|
} else {
|
|
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
|
|
if (provider != null)
|
|
return provider.openFile(uri, mode);
|
|
else
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
|
|
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
|
|
if (provider != null) {
|
|
return provider.query(uri, projection, selection, selectionArgs, sortOrder);
|
|
} else if ("file".equals(uri.getScheme())) {
|
|
MatrixCursor cursor = new MatrixCursor(projection);
|
|
Object[] row = new Object[projection.length];
|
|
native_query_file_info(uri.getPath(), projection, row);
|
|
cursor.addRow(row);
|
|
return cursor;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder, CancellationSignal cancellationSignal) {
|
|
return query(uri, projection, selection, selectionArgs, sortOrder);
|
|
}
|
|
|
|
public int delete(Uri uri, String selection, String[] selectionArgs) {
|
|
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
|
|
if (provider != null)
|
|
return provider.delete(uri, selection, selectionArgs);
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
public Uri insert(Uri uri, ContentValues values) {
|
|
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
|
|
if (provider != null)
|
|
return provider.insert(uri, values);
|
|
else
|
|
return null;
|
|
}
|
|
|
|
public String getType(Uri uri) {
|
|
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
|
|
if (provider != null)
|
|
return provider.getType(uri);
|
|
else
|
|
return null;
|
|
}
|
|
|
|
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
|
|
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
|
|
if (provider != null)
|
|
return provider.update(uri, values, selection, selectionArgs);
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
public static void requestSync(Account account, String authority, Bundle extras) {
|
|
}
|
|
|
|
public static void cancelSync(Account account, String authority) {
|
|
}
|
|
|
|
public static void setMasterSyncAutomatically(boolean sync) {
|
|
}
|
|
|
|
public static boolean isSyncActive(Account account, String authority) {
|
|
return false;
|
|
}
|
|
|
|
private static native void native_query_file_info(String path, String[] attributes, Object[] result);
|
|
}
|