2
2
3
3
import java .lang .reflect .Method ;
4
4
import java .util .ArrayList ;
5
+ import java .util .HashMap ;
6
+ import java .util .Set ;
5
7
6
8
import android .content .ContentProviderOperation ;
7
9
import android .content .ContentValues ;
8
10
import android .database .ContentObserver ;
9
11
import android .net .Uri ;
10
- import android .os .CancellationSignal ;
11
12
import android .text .TextUtils ;
12
13
import com .android .reverse .hook .HookParam ;
13
14
import com .android .reverse .util .Logger ;
@@ -71,7 +72,7 @@ private String concatenateInsert(Uri uri, ContentValues cv) {
71
72
sb .append ("[" + uri .toString () + "]" );
72
73
sb .append (" ( " );
73
74
String [] keysArray = new String [cv .size ()];
74
- keysArray = cv . keySet ( ).toArray (keysArray );
75
+ keysArray = this . getContentValuesKeySet ( cv ).toArray (keysArray );
75
76
sb .append (concatenateStringArray (keysArray , "," ));
76
77
sb .append (" ) " );
77
78
sb .append (" values (" );
@@ -109,7 +110,7 @@ private String concatenateUpdate(Uri uri, ContentValues cv, String selection, St
109
110
sb .append (" update " );
110
111
sb .append ("[" + uri .toString () + "]" );
111
112
sb .append (" set " );
112
- String [] keysArray = (String []) cv . keySet ( ).toArray ();
113
+ String [] keysArray = (String []) this . getContentValuesKeySet ( cv ).toArray ();
113
114
for (int i = 0 ; i < keysArray .length ; i ++) {
114
115
if (i == keysArray .length - 1 )
115
116
sb .append (" " + keysArray [i ] + "=" + cv .get (keysArray [i ]));
@@ -135,7 +136,7 @@ private String concatenateUpdate(Uri uri, ContentValues cv, String selection, St
135
136
public void startHook () {
136
137
137
138
Method querymethod = RefInvoke .findMethodExact ("android.content.ContentResolver" , ClassLoader .getSystemClassLoader (), "query" , Uri .class ,
138
- String [].class , String .class , String [].class , String .class , CancellationSignal . class );
139
+ String [].class , String .class , String [].class , String .class );
139
140
hookhelper .hookMethod (querymethod , new AbstractBahaviorHookCallBack () {
140
141
141
142
@ Override
@@ -252,6 +253,11 @@ public void descParam(HookParam param) {
252
253
});
253
254
254
255
}
256
+
257
+ private Set <String > getContentValuesKeySet (ContentValues cv ){
258
+ HashMap <String ,Object > mValue = (HashMap <String ,Object >) RefInvoke .getFieldOjbect ("android.content.ContentValues" , cv , "mValues" );
259
+ return mValue .keySet ();
260
+ }
255
261
256
262
private final static int TYPE_INSERT = 1 ;
257
263
private final static int TYPE_UPDATE = 2 ;
0 commit comments