Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 274
Mickey Tin Avatar asked Jun 07 '18 13:06

Mickey Tin


1 Answers

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.

like image 109
Avinash Shinde Avatar answered Sep 23 '22 00:09

Avinash Shinde