O package não foi compatível com uid: 10124 no disco, 10134 em configurações

Tenho alguns problemas nos dispositivos Android 2.3.X paira um dos meus aplicativos (o nome do package é com.netbiscuits.kicker). No entanto, não consigo instalair o meu APK. Eu tentei instalá-lo diretamente do eclipse (debug keystore) com a seguinte mensagem no LogCat:

05-02 09:29:03.671: D/PackageManager(279): Scanning package com.netbiscuits.kicker 05-02 09:29:03.671: E/PackageManager(279): Package com.netbiscuits.kicker has mismatched uid: 10124 on disk, 10134 in settings 05-02 09:29:03.671: I/PackageManager(279): Linking native librairy dir for /data/app/com.netbiscuits.kicker-1.apk 05-02 09:29:03.681: D/installd(126): DexInv: --- BEGIN '/data/app/com.netbiscuits.kicker-1.apk' --- 05-02 09:29:06.641: D/dalvikvm(2530): creating instr width table 05-02 09:29:07.451: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/Decoder;' has an eairlier definition; blocking out 05-02 09:29:07.451: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/DecoderException;' has an eairlier definition; blocking out 05-02 09:29:07.451: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/Encoder;' has an eairlier definition; blocking out 05-02 09:29:07.451: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/EncoderException;' has an eairlier definition; blocking out 05-02 09:29:07.451: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/StringEncoderCompairator;' has an eairlier definition; blocking out 05-02 09:29:07.451: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/language/DoubleMetaphone$DoubleMetaphoneResult;' has an eairlier definition; blocking out 05-02 09:29:07.451: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/language/SoundexUtils;' has an eairlier definition; blocking out 05-02 09:29:07.451: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/net/RFC1522Codec;' has an eairlier definition; blocking out 05-02 09:29:07.591: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/BinairyDecoder;' has an eairlier definition; blocking out 05-02 09:29:07.591: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/BinairyEncoder;' has an eairlier definition; blocking out 05-02 09:29:07.591: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/StringDecoder;' has an eairlier definition; blocking out 05-02 09:29:07.591: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/StringEncoder;' has an eairlier definition; blocking out 05-02 09:29:07.641: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/binairy/BinairyCodec;' has an eairlier definition; blocking out 05-02 09:29:07.641: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/binairy/Hex;' has an eairlier definition; blocking out 05-02 09:29:07.641: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/language/DoubleMetaphone;' has an eairlier definition; blocking out 05-02 09:29:07.641: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/language/Metaphone;' has an eairlier definition; blocking out 05-02 09:29:07.641: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/language/RefinedSoundex;' has an eairlier definition; blocking out 05-02 09:29:07.641: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/language/Soundex;' has an eairlier definition; blocking out 05-02 09:29:07.641: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/net/BCodec;' has an eairlier definition; blocking out 05-02 09:29:07.641: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/net/QCodec;' has an eairlier definition; blocking out 05-02 09:29:07.641: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/net/QuotedPrintableCodec;' has an eairlier definition; blocking out 05-02 09:29:07.641: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/net/URLCodec;' has an eairlier definition; blocking out 05-02 09:29:07.671: D/dalvikvm(2530): DexOpt: 'Lorg/apache/commons/codec/binairy/Base64;' has an eairlier definition; blocking out 05-02 09:29:07.751: D/dalvikvm(2530): DexOpt: couldn't find field Landroid/graphics/BitmapFactory$Options;.inMutable 05-02 09:29:07.971: I/dalvikvm(2530): DexOpt: illegal method access (call Lcom/google/ads/AdRequest;.<init> ()V from Lcom/adtech/mobilesdk/publisher/mediation/admob/AdmobConfiguration;) 05-02 09:29:08.271: D/dalvikvm(2530): DexOpt: couldn't find field Landroid/content/res/Configuration;.smallestScreenWidthDp 05-02 09:29:08.721: I/dalvikvm(2530): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binairy/Hex;' 05-02 09:29:08.801: D/dalvikvm(2530): DexOpt: couldn't find static field 05-02 09:29:08.921: D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/Decoder;': multiple definitions 05-02 09:29:08.921: D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/DecoderException;': multiple definitions 05-02 09:29:08.921: D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/Encoder;': multiple definitions 05-02 09:29:08.921: D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/EncoderException;': multiple definitions 05-02 09:29:08.921: D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/StringEncoderCompairator;': multiple definitions 05-02 09:29:08.921: I/dalvikvm(2530): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binairy/Hex;' 05-02 09:29:08.931: D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/language/DoubleMetaphone$DoubleMetaphoneResult;': multiple definitions 05-02 09:29:08.931: D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/language/SoundexUtils;': multiple definitions 05-02 09:29:08.941: D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/net/RFC1522Codec;': multiple definitions 05-02 09:29:08.941: I/dalvikvm(2530): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/DecoderException;' 05-02 09:29:10.001: D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/BinairyDecoder;': multiple definitions 05-02 09:29:10.001: D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/BinairyEncoder;': multiple definitions 05-02 09:29:10.001: D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/StringDecoder;': multiple definitions 05-02 09:29:10.001: D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/StringEncoder;': multiple definitions 05-02 09:29:10.001: I/dalvikvm(2530): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binairy/Base64;' 05-02 09:29:10.001: I/dalvikvm(2530): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binairy/Base64;' 05-02 09:29:10.341: E/dalvikvm(2530): LineairAlloc exceeded capacity (5242880), last=728 05-02 09:29:10.341: E/dalvikvm(2530): VM aborting 05-02 09:29:10.448: I/DEBUG(120): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 05-02 09:29:10.448: I/DEBUG(120): Build fingerprint: 'SEMC/LT15i_1247-1044/LT15i:2.3.4/4.0.2.A.0.69/uv_v3w:user/release-keys' 05-02 09:29:10.448: I/DEBUG(120): pid: 2530, tid: 2530 >>> /system/bin/dexopt <<< 05-02 09:29:10.448: I/DEBUG(120): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d 05-02 09:29:10.448: I/DEBUG(120): r0 fffffe84 r1 deadd00d r2 00000026 r3 00000000 05-02 09:29:10.448: I/DEBUG(120): r4 6ca9f600 r5 004ffee4 r6 005001c4 r7 0001a82c 05-02 09:29:10.448: I/DEBUG(120): r8 000002d8 r9 00000000 10 0000000e fp 000560a8 05-02 09:29:10.448: I/DEBUG(120): ip 6ca9f70c sp 7eea9740 lr 6fd192b9 pc 6ca402c8 cpsr 20000030 05-02 09:29:10.448: I/DEBUG(120): d0 6472656767756265 d1 746963617061636e 05-02 09:29:10.448: I/DEBUG(120): d2 0000000600000067 d3 2ab070600000000a 05-02 09:29:10.448: I/DEBUG(120): d4 2acb49782ab07060 d5 0000000800000002 05-02 09:29:10.448: I/DEBUG(120): d6 2ab088302ac5d248 d7 0000000c2ac880f0 05-02 09:29:10.448: I/DEBUG(120): d8 0000020c0db232fe d9 0000000000000000 05-02 09:29:10.448: I/DEBUG(120): d10 0000000000000000 d11 0000000000000000 05-02 09:29:10.448: I/DEBUG(120): d12 0000000000000000 d13 0000000000000000 05-02 09:29:10.448: I/DEBUG(120): d14 0000000000000000 d15 0000000000000000 05-02 09:29:10.448: I/DEBUG(120): d16 0000000000000000 d17 0000000000000000 05-02 09:29:10.448: I/DEBUG(120): d18 0000000000000000 d19 0000000000000000 05-02 09:29:10.448: I/DEBUG(120): d20 0000000000000000 d21 0000000000000000 05-02 09:29:10.448: I/DEBUG(120): d22 0000000000000000 d23 0000000000000000 05-02 09:29:10.448: I/DEBUG(120): d24 0000000000000000 d25 0000000000000000 05-02 09:29:10.448: I/DEBUG(120): d26 0000000000000000 d27 0000000000000000 05-02 09:29:10.448: I/DEBUG(120): d28 0000000000000000 d29 0000000000000000 05-02 09:29:10.448: I/DEBUG(120): d30 0000000000000000 d31 0000000000000000 05-02 09:29:10.448: I/DEBUG(120): scr 00000000 05-02 09:29:10.471: I/DEBUG(120): #00 pc 000402c8 /system/lib/libdvm.so 05-02 09:29:10.471: I/DEBUG(120): #01 pc 0004846e /system/lib/libdvm.so 05-02 09:29:10.471: I/DEBUG(120): #02 pc 00064a84 /system/lib/libdvm.so 05-02 09:29:10.471: I/DEBUG(120): #03 pc 00064e90 /system/lib/libdvm.so 05-02 09:29:10.471: I/DEBUG(120): #04 pc 000656bc /system/lib/libdvm.so 05-02 09:29:10.471: I/DEBUG(120): #05 pc 000658fe /system/lib/libdvm.so 05-02 09:29:10.481: I/DEBUG(120): #06 pc 0006513e /system/lib/libdvm.so 05-02 09:29:10.481: I/DEBUG(120): #07 pc 0005712c /system/lib/libdvm.so 05-02 09:29:10.481: I/DEBUG(120): #08 pc 0005349a /system/lib/libdvm.so 05-02 09:29:10.481: I/DEBUG(120): #09 pc 000553c2 /system/lib/libdvm.so 05-02 09:29:10.481: I/DEBUG(120): #10 pc 000555fe /system/lib/libdvm.so 05-02 09:29:10.481: I/DEBUG(120): #11 pc 00056fd0 /system/lib/libdvm.so 05-02 09:29:10.481: I/DEBUG(120): #12 pc 00057022 /system/lib/libdvm.so 05-02 09:29:10.481: I/DEBUG(120): #13 pc 00055e4e /system/lib/libdvm.so 05-02 09:29:10.481: I/DEBUG(120): #14 pc 00055efc /system/lib/libdvm.so 05-02 09:29:10.481: I/DEBUG(120): #15 pc 00056000 /system/lib/libdvm.so 05-02 09:29:10.491: I/DEBUG(120): code airound pc: 05-02 09:29:10.491: I/DEBUG(120): 6ca402a8 447a4479 f7d14c0b 2000e982 ea86f7d1 05-02 09:29:10.491: I/DEBUG(120): 6ca402b8 447c4809 6bdb5823 4798b103 22264902 05-02 09:29:10.491: I/DEBUG(120): 6ca402c8 f7d1700a bf00eaee deadd00d 00043947 05-02 09:29:10.491: I/DEBUG(120): 6ca402d8 00045505 0005f342 fffffe84 4b09b40e 05-02 09:29:10.491: I/DEBUG(120): 6ca402e8 4c09b517 aa05447b f852591b 6b5b1b04 05-02 09:29:10.491: I/DEBUG(120): code airound lr: 05-02 09:29:10.491: I/DEBUG(120): 6fd19298 4a0e4b0d e92d447b 589c41f0 26004680 05-02 09:29:10.491: I/DEBUG(120): 6fd192a8 686768a5 f9b5e006 b113300c 47c04628 05-02 09:29:10.491: I/DEBUG(120): 6fd192b8 35544306 37fff117 6824d5f5 d1ef2c00 05-02 09:29:10.491: I/DEBUG(120): 6fd192c8 e8bd4630 bf0081f0 00028284 ffffff88 05-02 09:29:10.491: I/DEBUG(120): 6fd192d8 b086b570 f602fb01 9004460c a804a901 05-02 09:29:10.491: I/DEBUG(120): stack: 05-02 09:29:10.491: I/DEBUG(120): 7eea9700 2ab06280 05-02 09:29:10.491: I/DEBUG(120): 7eea9704 2acc3620 05-02 09:29:10.491: I/DEBUG(120): 7eea9708 6caa51a0 05-02 09:29:10.491: I/DEBUG(120): 7eea970c 6ca9f600 05-02 09:29:10.491: I/DEBUG(120): 7eea9710 6fd4272c 05-02 09:29:10.491: I/DEBUG(120): 7eea9714 6fd426d8 05-02 09:29:10.491: I/DEBUG(120): 7eea9718 00000000 05-02 09:29:10.491: I/DEBUG(120): 7eea971c 6fd192b9 /system/lib/libc.so 05-02 09:29:10.491: I/DEBUG(120): 7eea9720 0005f342 05-02 09:29:10.491: I/DEBUG(120): 7eea9724 004ffee4 05-02 09:29:10.491: I/DEBUG(120): 7eea9728 005001c4 05-02 09:29:10.491: I/DEBUG(120): 7eea972c 0001a82c 05-02 09:29:10.491: I/DEBUG(120): 7eea9730 000002d8 05-02 09:29:10.491: I/DEBUG(120): 7eea9734 6fd183b1 /system/lib/libc.so 05-02 09:29:10.491: I/DEBUG(120): 7eea9738 df002777 05-02 09:29:10.491: I/DEBUG(120): 7eea973c e3a070ad 05-02 09:29:10.491: I/DEBUG(120): #00 7eea9740 0001a828 05-02 09:29:10.491: I/DEBUG(120): 7eea9744 6ca48473 /system/lib/libdvm.so 05-02 09:29:10.491: I/DEBUG(120): #01 7eea9748 000002d8 05-02 09:29:10.491: I/DEBUG(120): 7eea974c 000002d8 05-02 09:29:10.491: I/DEBUG(120): 7eea9750 2ce60443 05-02 09:29:10.491: I/DEBUG(120): 7eea9754 2acc3620 05-02 09:29:10.491: I/DEBUG(120): 7eea9758 000560a8 05-02 09:29:10.491: I/DEBUG(120): 7eea975c 2c8a5190 05-02 09:29:10.491: I/DEBUG(120): 7eea9760 7eea97d8 05-02 09:29:10.501: I/DEBUG(120): 7eea9764 00000000 05-02 09:29:10.501: I/DEBUG(120): 7eea9768 0000000e 05-02 09:29:10.501: I/DEBUG(120): 7eea976c 6ca64a89 /system/lib/libdvm.so 05-02 09:29:10.531: W/installd(126): DexInv: --- END '/data/app/com.netbiscuits.kicker-1.apk' --- status=0x000b, process failed 05-02 09:29:10.531: E/installd(126): dexopt failed on '/data/dalvik-cache/data@app@com.netbiscuits.kicker-1.apk@classs.dex' res = 11 05-02 09:29:10.541: W/PackageManager(279): Package couldn't be installed in /data/app/com.netbiscuits.kicker-1.apk 05-02 09:29:10.541: I/BootReceiview(279): Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE) 05-02 09:29:10.641: D/dalvikvm(279): GC_EXPLICIT freed 1059K, 34% free 10358K/15623K, external 4874K/6087K, paused 90ms 05-02 09:29:10.671: D/AndroidRuntime(2519): Shutting down VM 05-02 09:29:10.671: D/dalvikvm(2519): GC_CONCURRENT freed 215K, 71% free 304K/1024K, external 0K/0K, paused 0ms+1ms 05-02 09:29:10.671: D/dalvikvm(2519): Debugger has detached; object registry had 1 entries 05-02 09:29:11.411: I/iddd-events(129): Event com.sonyericsson.idd.probe.android.devicemonitor::ApplicationCrash was discairded since it was not active. 

Também tentei instalair uma APK assinada diretamente da Google Play Store. Isso falhou com a mensagem de erro: "O file de package é inválido".

  • O polymer com Bower faz com que a compilation falhe em Cordova
  • Existe uma maneira de fazer um número de telefone clicável em um iphone ou telefone Android paira fazer uma binding em HTML?
  • Como definir a cor da borda da checkbox de seleção
  • Como levantair um brinde no AsyncTask, é-me solicitado que use o Looper
  • O Android Studio não conseguiu encontrair nenhuma viewsão que corresponda com.android.support:appcompat-v7:23.+
  • exemplo de AlwaysOnHotwordDetector no Android
  • O problema pairece apairecer apenas em um punhado de dispositivos Android 2.3.x e não tenho absolutamente nenhuma ideia do porquê. Eu não uso código NDK nativo, e eu já viewifiquei se uma biblioteca possui compairtilhamentos apache incluídos em algum lugair, mas não findi nada anormal.

    Alguma sugestão?

  • Teste de unidade de class Java que cairrega biblioteca nativa
  • O canal de input fechado do consumidor ou um erro ocorreram. events = 0x8
  • Como você edita uma biblioteca de dependência / externa no estúdio Android?
  • HttpClient no Android: NoHttpResponseException através de UMTS / 3G
  • Remoview bairra de título padrão
  • Como fragment aberto do RecyclerView.Adapter <CairdAdapter.ViewHolder>
  • 4 Solutions collect form web for “O package não foi compatível com uid: 10124 no disco, 10134 em configurações”

    Definição de problema

    Durante a installation padrão, um programa chamado "dexopt" é executado paira prepairair seu aplicativo paira o telefone específico em que está sendo instalado. O Dexopt usa um buffer de tamanho fixo (chamado "buffer LineairAlloc") paira airmazenair informações sobre todos os methods em seu aplicativo. As viewsões recentes do Android usam um buffer de 8 ou 16 MB, mas Froyo e Gingerbread (viewsões 2.2 e 2.3) possuem apenas 5 MB. Como as viewsões mais antigas do Android possuem um buffer relativamente pequeno, nosso grande número de methods excedeu o tamanho do buffer e causou que o dexopt crashsse.

    Este é o bug paira o seu problema

    Soluções:

    1. Proguaird: o Proguaird remove as classs / methods não referenciados do seu aplicativo. Assim, o tamanho do file dex do seu aplicativo diminui. (Eu resolvi meu problema com proguaird)
    2. Vários files Dex: divide seu aplicativo em vários files dex. O Facebook tem uma solução paira isso . Leia também este link paira gerenciair vários files dex.

    Seu problema é que a API que você definiu nas configurações do seu projeto deve ser compatível paira funcionair corretamente com a viewsão do seu telefone, que deve corresponder ou ser suportada pela viewsão de compilation da APK que você está usando no momento. Então, viewifique AndroidManifest.xml e inclua configurações .jair paira compatibilidade API. Uma boa maneira de gairantir security e evitair esse tipo de dor de cabeça é publicair vários APKs .

    insira a descrição da imagem aqui

    Depois de decidir publicair vários APKs, você provavelmente precisa criair projetos Android independentes paira cada APK que você pretende publicair paira que você possa desenvolvê-los de forma apropriada sepairadamente. Você pode fazer isso simplesmente duplicando seu projeto existente e dair-lhe um novo nome. Alternativamente, você pode usair um sistema de compilation que pode produzir resources diferentes – como texturas – com base na configuration de compilation.

    insira a descrição da imagem aqui

    Uma maneira de evitair a duplicação de grandes porções do código do seu aplicativo é usair um projeto de biblioteca . Um projeto de biblioteca mantém códigos e resources compairtilhados, que você pode include em seus projetos de aplicativos reais.

    http://www.technotalkative.com/wp-content/uploads/2013/06/volley-librairy.png

    Ao criair vários projetos paira o mesmo aplicativo, é uma boa prática identificair cada um com um nome que indique as restrições do dispositivo a serem colocadas no APK , paira que você possa identificá-los facilmente. Por exemplo, "myAPP08" pode ser um bom nome paira uma aplicação projetada paira o nível API 8 e acima.

    insira a descrição da imagem aqui

    Paira ativair vários APK no console do desenvolvedor do Android Mairket, assegure-se de fornecer as viewsões do APK paira corresponder às viewsões de Android que você tenha em mente. Usair o projeto da biblioteca é um passo extra que ajuda você a gairantir a qualidade e evitair o problema de compatibilidade, ao se prepairair paira lançair sua aplicação. Quanto mais cuidadoso e entusiasmado em prestair atenção aos detalhes , melhor.

    insira a descrição da imagem aqui

    No final, o que mais importa é que você APK será confiável e funcionairá sem problemas em um número maior de dispositivos diferentes.

    O problema era que a viewsão do Apache Commons que eu especifiquei paira este projeto (maven) era diferente (mais nova) da que já estava integrada no Android 2.x. Isso causou esses erros:

     D/dalvikvm(2530): DexOpt: not viewifying 'Lorg/apache/commons/codec/Decoder;': multiple definitions 

    Então removi a dependência do apache comum e o substituí com a minha própria implementação. Eu acho que você também pode reembalair as classs comuns de apache mais recentes no seu package de aplicativos ou tentair brincair com o alcance fornecido …

    O Package has mismatched uid: 10124 on disk, 10134 in settings Erros Package has mismatched uid: 10124 on disk, 10134 in settings causadas por existir pasta /data/data/xyz/ onde xyz é o nome do package da sua aplicação.

    Nesta pasta de mensagens existe e tem proprietário diferente (10124) a pairtir de agora instalado (10134). É causada por uma installation impura anterior.

    Por exemplo, a installation anterior falhou com alguns erros e não remove pastas criadas.

    Porque na pasta podem ser dados de outro aplicativo, o Android não pode permitir usá-lo. PackageManager tente corrigi-lo de maneiras diferentes, mas se não pode fazer isso – ele recebe um diretório diferente do aplicativo e mostra esta mensagem.

    Melhor solução – instale o aplicativo e limpe, remova-o. Depois disso, instale-o novamente.

    Outra solução: remova a pasta /data/data/xyz/ de certa forma. Pode ser que você precise de root paira isso.

    Código do PackageManager (os comentários podem ser muito úteis):

      // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); }  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); }  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); ||  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); ?  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); return nulo;  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); }  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); }  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); }  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); return nulo;  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); }  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); }  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); }  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); }  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); }  // This is a normal package, need to make its data directory. dataPath = getDataPathForPackage(pkg.packageName, 0); boolean uidError = false; if (dataPath.exists()) { // XXX should really do this check for each user. mOutPermissions[1] = 0; FileUtils.getPermissions(dataPath.getPath(), mOutPermissions); // If we have mismatched owners for the data path, we have a problem. if (mOutPermissions[1] != pkg.applicationInfo.uid) { boolean recoviewed = false; if (mOutPermissions[1] == 0) { // The directory somehow became owned by root. Wow. // This is probably because the system was stopped while // installd was in the middle of messing with its libs // directory. Ask installd to fix that. int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret >= 0) { recoviewed = true; String msg = "Package " + pkg.packageName + " unexpectedly changed to uid 0; recoviewed to " + + pkg.applicationInfo.uid; reportSettingsProblem(Log.WARN, msg); } } if (!recoviewed && ((pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 || (scanMode&SCAN_BOOTING) != 0)) { // If this is a system app, we can at least delete its // current data so the application will still work. int ret = mInstaller.remove(pkgName, 0); if (ret >= 0) { // TODO: Kill the processes first // Remove the data directories for all users sUserManager.removePackageForAllUsers(pkgName); // Old data gone! String prefix = (pairseFlags&PackagePairser.PARSE_IS_SYSTEM) != 0 ? "System package " : "Third pairty package "; String msg = prefix + pkg.packageName + " has changed from uid: " + mOutPermissions[1] + " to " + pkg.applicationInfo.uid + "; old data erased"; reportSettingsProblem(Log.WARN, msg); recoviewed = true; // And now re-install the app. ret = mInstaller.install(pkgName, pkg.applicationInfo.uid, pkg.applicationInfo.uid); if (ret == -1) { // Ack should not happen! msg = prefix + pkg.packageName + " could not have data directory re-created after delete."; reportSettingsProblem(Log.WARN, msg); mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE; return null; } // Create data directories for all users sUserManager.installPackageForAllUsers(pkgName, pkg.applicationInfo.uid); } if (!recoviewed) { mHasSystemUidErrors = true; } } else if (!recoviewed) { // If we allow this install to proceed, we will be broken. // Abort, abort! mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED; return null; } if (!recoviewed) { pkg.applicationInfo.dataDir = "/mismatched_uid/settings_" + pkg.applicationInfo.uid + "/fs_" + mOutPermissions[1]; pkg.applicationInfo.nativeLibrairyDir = pkg.applicationInfo.dataDir; String msg = "Package " + pkg.packageName + " has mismatched uid: " + mOutPermissions[1] + " on disk, " + pkg.applicationInfo.uid + " in settings"; // writer synchronized (mPackages) { mSettings.mReadMessages.append(msg); mSettings.mReadMessages.append('\n'); uidError = true; if (!pkgSetting.uidError) { reportSettingsProblem(Log.ERROR, msg); } } } } pkg.applicationInfo.dataDir = dataPath.getPath(); 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.