-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ChickenHook/feature/content_provider_api
Feature/content provider api
- Loading branch information
Showing
8 changed files
with
119 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="org.chickenhook.restrictionbypass" /> | ||
package="org.chickenhook.restrictionbypass"> | ||
|
||
<application> | ||
<provider | ||
android:name=".BypassProvider" | ||
android:authorities="org.chickenhook.restrictionbypass" | ||
android:enabled="true" | ||
android:exported="false"></provider> | ||
</application> | ||
|
||
</manifest> |
56 changes: 56 additions & 0 deletions
56
restrictionbypass/src/main/java/org/chickenhook/restrictionbypass/BypassProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.chickenhook.restrictionbypass; | ||
|
||
import android.content.ContentProvider; | ||
import android.content.ContentValues; | ||
import android.content.Context; | ||
import android.content.pm.ProviderInfo; | ||
import android.database.Cursor; | ||
import android.net.Uri; | ||
import android.util.Log; | ||
|
||
public class BypassProvider extends ContentProvider { | ||
public BypassProvider() { | ||
} | ||
|
||
@Override | ||
public int delete(Uri uri, String selection, String[] selectionArgs) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public String getType(Uri uri) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Uri insert(Uri uri, ContentValues values) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean onCreate() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public Cursor query(Uri uri, String[] projection, String selection, | ||
String[] selectionArgs, String sortOrder) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public int update(Uri uri, ContentValues values, String selection, | ||
String[] selectionArgs) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void attachInfo(Context context, ProviderInfo info) { | ||
super.attachInfo(context, info); | ||
try { | ||
Unseal.unseal(); | ||
} catch (Exception e) { | ||
Log.e("BypassProvider", "Unable to unseal hidden api access", e); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
restrictionbypass/src/main/java/org/chickenhook/restrictionbypass/Unseal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.chickenhook.restrictionbypass; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
public class Unseal { | ||
|
||
public static void unseal() throws Exception { | ||
Method getRuntime = RestrictionBypass.getDeclaredMethod( | ||
Class.forName("dalvik.system.VMRuntime"), | ||
"getRuntime" | ||
); | ||
getRuntime.setAccessible(true); | ||
Object vmRuntime = getRuntime.invoke(null); | ||
|
||
Method setHiddenApiExemptions = RestrictionBypass.getDeclaredMethod( | ||
vmRuntime.getClass(), | ||
"setHiddenApiExemptions", | ||
String[].class | ||
); | ||
setHiddenApiExemptions.setAccessible(true); | ||
|
||
String[] list = new String[1]; | ||
list[0] = "L"; | ||
Object[] args = new Object[1]; | ||
args[0] = list; | ||
setHiddenApiExemptions.invoke(vmRuntime, args); | ||
// setHiddenApiExemptions | ||
} | ||
} |