Mickey Tin
Mickey Tin

Reputation: 3543

Android P Restrictions on non-SDK interfaces - dark greylist vs blacklist

Developer Preview 3 came out today and I've noticed some changes related to non-SDK interfaces:

Accessing the following API produces different logs on DP2 and DP3

Class<?> androidIdClass = Class.forName("com.android.internal.R$id");
Integer search_close_btn = getFieldValue(androidIdClass, null, "search_close_btn");

DP2: Accessing hidden field Lcom/android/internal/R$id;->search_close_btn:I (blacklist, reflection)

Result: NoSuchFieldException, unable to access the field

DP3: Accessing hidden field Lcom/android/internal/R$id;->search_close_btn:I (dark greylist, reflection)

Result: the field is accessible

Can please someone explain why this field become available in DP3 and what is difference between dark greylist and blacklist ?

Upvotes: 8

Views: 2824

Answers (1)

Avinash Shinde
Avinash Shinde

Reputation: 199

Can please someone explain why this field become available in DP3?

  • Google is continuously blocking non-SDK calls. But they have also opened the forum for developers where issues regarding these can be reported. So to answer your question someone might have created a ticket regarding this which Google might have thought to rollback. Make sense?

what is the difference between dark greylist and blacklist?

  • Blacklist are calls which are not going to work irrespective of what API level your application is going to target.

  • Dark greylist are calls which won't work if and only if your application is targeting API level 28 else they would work normally.

Upvotes: 3

Related Questions