Post Reply

[ How-to ] Enable App Ops again in 4.4.2 / KOT49H

OP Calkulin

12th December 2013, 04:19 PM   |  #1  
Calkulin's Avatar
OP Recognized Developer
Thanks Meter: 7,041
 
1,437 posts
Join Date:Joined: Sep 2008
Donate to Me
More
Here's a quick guide on how to enable App Ops in 4.4.2 / KOT49H. Decompile Settings.apk, open the Settings.smali and make these changes. Now if you want to keep ART working, don't deodex and just use the classes.dex that already included in the apk.

1.
Code:
.method static constructor <clinit>()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 126
    sput-boolean v2, Lcom/android/settings/Settings;->sShowNoHomeNotice:Z

    .line 309
    const/16 v0, 0x2c

    new-array v0, v0, [Ljava/lang/String;
Change to - +1

Code:
.method static constructor <clinit>()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 126
    sput-boolean v2, Lcom/android/settings/Settings;->sShowNoHomeNotice:Z

    .line 309
    const/16 v0, 0x2d

    new-array v0, v0, [Ljava/lang/String;
2.
Code:
    const/16 v1, 0x2b

    const-class v2, Lcom/android/settings/inputmethod/KeyboardLayoutPickerFragment;

    invoke-virtual {v2}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v2

    aput-object v2, v0, v1

    sput-object v0, Lcom/android/settings/Settings;->ENTRY_FRAGMENTS:[Ljava/lang/String;
Add this - What's marked in red should be 1 less than what you changed in the previous step (Or the previous number before adding 1)

Code:
    const/16 v1, 0x2b

    const-class v2, Lcom/android/settings/inputmethod/KeyboardLayoutPickerFragment;

    invoke-virtual {v2}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v2

    aput-object v2, v0, v1

    const/16 v1, 0x2c

    const-class v2, Lcom/android/settings/applications/AppOpsSummary;

    invoke-virtual {v2}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v2

    aput-object v2, v0, v1

    sput-object v0, Lcom/android/settings/Settings;->ENTRY_FRAGMENTS:[Ljava/lang/String;

EDIT: Here's how to add it to Settings/Security

Added this to values/strings.xml
Code:
    <string name="app_ops_settings_summary">Manage app permissions</string>
Add this to xml/security_settings_misc.xml under the device admin title
Code:
        <Preference android:title="@string/app_ops_settings" android:key="app_ops_summary" android:summary="@string/app_ops_settings_summary" android:fragment="com.android.settings.applications.AppOpsSummary" />
Last edited by Calkulin; 28th December 2013 at 06:26 PM.
The Following 28 Users Say Thank You to Calkulin For This Useful Post: [ View ]
13th December 2013, 08:04 PM   |  #2  
Recognized Developer
Thanks Meter: 1,628
 
1,021 posts
Join Date:Joined: Jun 2007
Donate to Me
Great tutorial, but you left out the line that makes the first change actually make sense. The one that initializes the collection to a certain size. I.E. 0x2d instead of 0x2c
Other than that, easy to follow, and useful. Thank you very much for this.
13th December 2013, 08:39 PM   |  #3  
Calkulin's Avatar
OP Recognized Developer
Thanks Meter: 7,041
 
1,437 posts
Join Date:Joined: Sep 2008
Donate to Me
More
Quote:
Originally Posted by Fenny

Great tutorial, but you left out the line that makes the first change actually make sense. The one that initializes the collection to a certain size. I.E. 0x2d instead of 0x2c
Other than that, easy to follow, and useful. Thank you very much for this.


That was actually the first step

Quote:
Originally Posted by Calkulin

1.

Code:
.method static constructor <clinit>()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 126
    sput-boolean v2, Lcom/android/settings/Settings;->sShowNoHomeNotice:Z

    .line 309
    const/16 v0, 0x2c
Change to

Code:
.method static constructor <clinit>()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 126
    sput-boolean v2, Lcom/android/settings/Settings;->sShowNoHomeNotice:Z

    .line 309
    const/16 v0, 0x2d

13th December 2013, 08:41 PM   |  #4  
Recognized Developer
Thanks Meter: 1,628
 
1,021 posts
Join Date:Joined: Jun 2007
Donate to Me
Quote:
Originally Posted by Calkulin

That was actually the first step

Right, but there is a line after the end of the code snippet that actually uses the constant /16 that is being defined to initialize the array. Without that, it's just changing an arbitrary constant.
13th December 2013, 08:42 PM   |  #5  
XBlackChaosX's Avatar
Senior Member
Flag New York
Thanks Meter: 23
 
238 posts
Join Date:Joined: Oct 2011
You can also just use AppOpsXposed module for xposed framework.

Sent from my Droid Razr Maxx HD (GSM)
13th December 2013, 08:44 PM   |  #6  
Recognized Developer
Thanks Meter: 1,628
 
1,021 posts
Join Date:Joined: Jun 2007
Donate to Me
Quote:
Originally Posted by XBlackChaosX

You can also just use AppOpsXposed module for xposed framework.

Sent from my Droid Razr Maxx HD (GSM)

That would break ART.
13th December 2013, 08:55 PM   |  #7  
Calkulin's Avatar
OP Recognized Developer
Thanks Meter: 7,041
 
1,437 posts
Join Date:Joined: Sep 2008
Donate to Me
More
Quote:
Originally Posted by Fenny

Right, but there is a line after the end of the code snippet that actually uses the constant /16 that is being defined to initialize the array. Without that, it's just changing an arbitrary constant.


Both the Nexus 4 and 5 builds that I did, did not have that, so post it and let me see it
13th December 2013, 09:06 PM   |  #8  
XBlackChaosX's Avatar
Senior Member
Flag New York
Thanks Meter: 23
 
238 posts
Join Date:Joined: Oct 2011
True, I haven't gotten the chance to try ART, and I won't until xposed framework somehow starts working with ART. Does ART improve anything on your phone?

Sent from my Droid Razr Maxx HD (GSM)
13th December 2013, 09:17 PM   |  #9  
Senior Member
Thanks Meter: 63
 
261 posts
Join Date:Joined: Jul 2010
Quote:
Originally Posted by XBlackChaosX

True, I haven't gotten the chance to try ART, and I won't until xposed framework somehow starts working with ART. Does ART improve anything on your phone?

Sent from my Droid Razr Maxx HD (GSM)

Less memory usage,faster loading of some applications,and phone had quicker response.
13th December 2013, 09:18 PM   |  #10  
Recognized Developer
Thanks Meter: 1,628
 
1,021 posts
Join Date:Joined: Jun 2007
Donate to Me
Quote:
Originally Posted by Calkulin

Both the Nexus 4 and 5 builds that I did, did not have that, so post it and let me see it

Code:
.method static constructor <clinit>()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 126
    sput-boolean v2, Lcom/android/settings/Settings;->sShowNoHomeNotice:Z

    .line 309
    const/16 v0, 0x2c

    new-array v0, v0, [Ljava/lang/String;
Quite literally, it is the line after it.
I am just suggesting that it should be included for context.

That way we know that this is referring to the array we defined as v0:

Code:
 aput-object v2, v0, v1
Don't mind me though. I just have this thing about people blindly following tutorials while not really knowing why they are doing what they are doing...
Last edited by Fenny; 13th December 2013 at 09:25 PM.

The Following User Says Thank You to Fenny For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android Software Development by ThreadRank