android-rcs / rcsjta

RCS-e stack for Android with GSMA API
180 stars 74 forks source link

Permission Denial #221

Open gilshallem opened 7 years ago

gilshallem commented 7 years ago

Hi, I am trying to access all the RCS messages on the device. I get the following error:

Caused by: java.lang.SecurityException: Permission Denial: opening provider com.sec.internal.tapi.service.provider.HistoryLogProvider from ProcessRecord{e7c133 3845:com.gilapps.rcstest/u0a240} (pid=3845, uid=10240) requires com.gsma.services.permission.RCS or com.sec.imsservice.WRITE_IMS_PERMISSION

Even though i request the permission.

Permissions:

<uses-permission android:name="com.gsma.rcs.com.RCS" />
    <uses-permission android:name="com.gsma.rcs.permission.RCS" />
    <uses-permission android:name="com.gsma.services.permission.RCS" />
    <uses-permission android:name="com.gsma.rcs.com.gsma.services.permission.RCS" />
    <uses-permission android:name="com.gsma.services.permission.RCS_INTERNAL_ACCESS_ONLY" />

    <uses-permission android:name="com.samsung.rcs.im.READ_PERMISSION"/>
    <uses-permission android:name="com.sec.imsservice.WRITE_IMS_PERMISSION"/>

    <uses-permission android:name="android.permission.WRITE_SMS"/>
    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />

Code:

static final Uri CONTENT_URI = Uri.parse("content://com.gsma.services.rcs.provider.history/history");

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final String[] projection = new String[]{"*"};

        Cursor query = getContentResolver().query(CONTENT_URI, projection, null, null, null);
        if (query!=null) {
            ((TextView)findViewById(R.id.text)).setText("Found " + query.getCount());
            if (query.moveToFirst()) {
                do {
                    Log.i("testgil", "sss");

                } while (query.moveToNext());
            }
            query.close();
        }
        else {
            ((TextView)findViewById(R.id.text)).setText("None found");
        }
lgxace commented 7 years ago

Hi gilshallem,

both permissions should be requested in your RCS APP manifest instead of RCS Stack. please have a try and test again. com.gsma.services.permission.RCS or com.sec.imsservice.WRITE_IMS_PERMISSION

Thanks, Ace.

gilshallem commented 6 years ago

Hi, Thank you for replaying It is in the app manifest and I tried the other permissions with no success