1. Check out our app, Forums for Android! Download and leave feedback here!

Root Fix apk UID Mismatches

Discussion in 'Android Devices' started by Romparoo, Jun 23, 2010.

  1. Romparoo

    Romparoo Well-Known Member
    Thread Starter
    98

    Feb 13, 2010
    615
    74
    98
    Investment Banker
    Arizona
    What does this do? And why would I want to do it?

    I am trying to figure out my silent bug issue. I have read some people doing a factory wipe (which I always do when installing a ROM) and not having the problem ever again. I figure I would see what this Fix apk thing means and does before I do it.

    Found, in recovery under other.

    Thanks.
     

    Advertisement

  2. erisuser1

    erisuser1 Well-Known Member
    223

    Nov 11, 2009
    1,644
    759
    223

    Probably it's unlikely to have any bearing on your "silent bug" problem.

    But, you asked, so I will tell you. It's a little subtle, but not too bad.

    [ BTW, I haven't personally verified all of this - there is some speculation going on by me, but I think it's pretty good speculation ;) ]

    Under all versions of Unix & Linux since the early 70's, when you "logged on" to your account, all of your personal files were owned by a single user, or UID for short. Similarly, when you would run programs, they would have your UID, and thus have the correct privileges to read, write, or destroy files owned by you (having the same UID). Other users of the system would have different UIDs, and each user could set permissions on their files that would either allow or deny other users from reading, writing or deleting those files.

    So, the basic idea there was to "protect Users from each other". (There is a similar mechanism for groups of users called a GID, but we'll skip over that for now)

    Android is a little bit different, however. Instead, the idea is to "protect applications from each other". What this means is that when you install a new application, that application gets a unique UID. And so, when it reads or write files into it's own private data area, they are automatically "safe" from mischievous behavior of other applications - even though there might only be one "user" of the phone - you! So, the "User Identity" in Unix/Linux has been hijacked a bit in Android; but that's OK, because usually there's only one user of the phone anyway - and many applications.

    Now normally Android just takes care of all of this automatically the first time it boots up, after a factory reset, or when you add or drop applications to/from the phone from the marketplace, and you don't need to pay any attention to it.

    Now, let's suppose that two users decide to use Astro as a file manager. One of them installs it as the second market app they download, and the other installs it as the twentieth. Both phones will work just fine for both users .... but the private data stores for the same application will be owned by different "UIDs" on the two phones.

    Clearly that's not a problem. But what happens if somehow the "data stores" were swapped between two phones? All of a sudden, Astro would be unable to access it's own files on both phones!

    Now, you're probably thinking, "What? How would that ever happen?". And you would be right; it won't.

    But something similar can happen - if you use A2SD (or APPS2SD) and multiple ROMs. Because you are now potentially sharing the same applications (on the SD card), if you add or delete applications from the SD card in one ROM, you haven't made the corresponding changes with the other ROMs for which you have backups - that is, you added or deleted an app without Android knowing about it (for those backed-up ROMs).

    Here's where it gets a little fuzzy for me - apparently in the housekeeping that Android does during every boot cycle, it becomes possible for files in /data/data to end up "owned" by the wrong application.... so the "Fix apk UIDs" menu entry can (somehow magically) rectify this while Android is offline by figuring out which apps are supposed to own which data areas, etc.

    In any event, it is something similar to that. It is unlikely to have any relevance at all on a ROM that has never used A2SD, or never "shared" the SD card via A2SD with another ROM - where the other ROM did app installs & deletes of apps on the SD card.

    eu1


    Now that I have speculated about it in such great detail, I better go and figure out what it really does. I'll update this post if I am substantially in error.

    [ Edit ] Yep, that's pretty much what it does. Source code can be found either on your phone (in recovery boot) or at the Cyanogen/packetlss github.
     
    scary alien and escape21 like this.
  3. Romparoo

    Romparoo Well-Known Member
    Thread Starter
    98

    Feb 13, 2010
    615
    74
    98
    Investment Banker
    Arizona
    Great explanation. Sounds good to me. I am learning Linux and Android as I go along. The A2SD makes a lot of sense to me as to how it could really miss things up.
     
  4. ohryansbelt2302

    ohryansbelt2302 New Member
    5

    Oct 12, 2013
    1
    0
    5
    Crew Trainer
    Thanks for the thorough explanation. I had rooted my brother's Evo for him a while back and he does things on it and doesn't realize the consequnces of his actions. I know he has A2SD, so the possibility you suggested is highly plausible in resulting in his situation.

    He came to me with his phone showing me how it was just stuck on the boot up screen (would play boot graphics over and over without stop). I got into download mode and when the phone analyzes the .img file for that half-second, you could see it said "wrong or corrupt .img file". So I tried reflashing the PC36IMG file but when I got to the flashing part in the command prompt it just was stuck on "waiting for device". Well I tried to go into his recovery and see if he still had his PC36IMG file on his SD but of course he didn't, so just through the options on the root screen of recovery I see this option of "Fix uid apk mismatches" and figured what the heck, why not, and lo and behold that was all it needed. Booted right up normal as ever.

    Thanks to your explanation I now know how to help him prevent it again.
     
  5. Bob Cat

    Bob Cat Careful, They're sharp!!
    513

    Nov 17, 2010
    7,048
    4,288
    513
    Midland's, South Carolina
    Holy, opening a 3+ year old thread, Batman! :eek:

    In case you didn't realize it your in the Eris forum. :)

    Welcome to Android Forums, ohryansbelt 2302! :D
     
    scary alien likes this.

Share This Page

Loading...