admin管理员组

文章数量:1123185

Scenario:

I am using /packages/android_content_provider and I have created a class

public class MyContentProvider extends AndroidContentProvider{
    @NonNull
    @Override
    public String getAuthority() {
        return "provider.authority.name";
    }

    @NonNull
    @Override
    public String getEntrypointName() {
        return "providerEntryPoint";
    }
    
    @Override
    public boolean onCreate() {
        super.onCreate();
        System.out.println("SyncProgFlutter: onCreate called");
        return true;
    }

    @Nullable
    @Override
    public Uri insert(@NonNull Uri uri, @Nullable ContentValues contentValues) {
        System.out.println("SyncProgFlutter: insert called with " + uri.toString()
                + " and " + contentValues);
        return super.insert(uri, contentValues);
    }
}

The onCreate log prints, so that override is working, but the insert log doesn't. Instead, I'm guessing, it just calls insert in the kotlin class because my dart code still gets the call, but I don't get the log. I'd like to override here so I can grant some file permissions to a requesting application. Is this possible?

本文标签: androidHow can I override methods from AndroidContentProvider in my Java codeStack Overflow