java.lang.SecurityException:under uid 10090 but it is really 10060

E/DatabaseUtils( 1255): java.lang.SecurityException: Package com.flyaudio.skin does not belong to 10090

E/DatabaseUtils( 1255):     at android.app.AppOpsManager.checkPackage(AppOpsManager.java:1133)

E/DatabaseUtils( 1255):     at android.content.ContentProvider.getCallingPackage(ContentProvider.java:570)

E/DatabaseUtils( 1255):     at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:635)

E/DatabaseUtils( 1255):     at android.content.ContentProvider$Transport.call(ContentProvider.java:325)

E/DatabaseUtils( 1255):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:275)

E/DatabaseUtils( 1255):     at android.os.Binder.execTransact(Binder.java:404)

E/DatabaseUtils( 1255):     at dalvik.system.NativeStart.run(Native Method)

W/AppOps  ( 1255): Bad call: specified package com.flyaudio.skin under uid 10090 but it is really 10060

android4.4.4高通平台出现这个问题。

跟踪代码知道是Settings.System.putInt(resolver, Settings.System.SCREEN_BRIGHTNESS, brightness);出错。

从网上找到解决办法:

修改/frameworks/base/core/java/android/app/ContextImpl.java

private ContextImpl(ContextImpl container, ActivityThread mainThread, LoadedApk packageInfo, IBinder activityToken, UserHandle user, boolean restricted, Display display, Configuration overrideConfiguration)改成如下:

private ContextImpl(ContextImpl container, ActivityThread mainThread,
            LoadedApk packageInfo, IBinder activityToken, UserHandle user, boolean restricted,
            Display display, Configuration overrideConfiguration) {
        mOuterContext = this;

        mMainThread = mainThread;
        mActivityToken = activityToken;
        mRestricted = restricted;

        if (user == null) {
            user = Process.myUserHandle();
        }
        mUser = user;

        mPackageInfo = packageInfo;

        mResourcesManager = ResourcesManager.getInstance();
        mDisplay = display;
        mOverrideConfiguration = overrideConfiguration;

        final int displayId = getDisplayId();
        CompatibilityInfo compatInfo = null;
        if (container != null) {
            compatInfo = container.getDisplayAdjustments(displayId).getCompatibilityInfo();
        }
        if (compatInfo == null && displayId == Display.DEFAULT_DISPLAY) {
            compatInfo = packageInfo.getCompatibilityInfo();
        }
        mDisplayAdjustments.setCompatibilityInfo(compatInfo);
        mDisplayAdjustments.setActivityToken(activityToken);

        Resources resources = packageInfo.getResources(mainThread);
        if (resources != null) {
            if (activityToken != null
                    || displayId != Display.DEFAULT_DISPLAY
                    || overrideConfiguration != null
                    || (compatInfo != null && compatInfo.applicationScale
                            != resources.getCompatibilityInfo().applicationScale)) {
                resources = mResourcesManager.getTopLevelResources(
                        packageInfo.getResDir(), displayId,
                        overrideConfiguration, compatInfo, activityToken);
            }
        }
        mResources = resources;

        if (container != null) {
            mBasePackageName = container.mBasePackageName;
            mOpPackageName = container.mOpPackageName;
        } else {
            mBasePackageName = packageInfo.mPackageName;
            ApplicationInfo ainfo = packageInfo.getApplicationInfo();
            if (ainfo.uid == Process.SYSTEM_UID && ainfo.uid != Process.myUid()) {
                // Special case: system components allow themselves to be loaded in to other
                // processes.  For purposes of app ops, we must then consider the context as
                // belonging to the package of this process, not the system itself, otherwise
                // the package+uid verifications in app ops will fail.
                mOpPackageName = ActivityThread.currentPackageName();
            } else {
                mOpPackageName = mBasePackageName;
            }
        }
	mContentResolver = new ApplicationContentResolver(this, mainThread, user);
    }

重新编译framework

时间: 2024-10-09 18:52:41

java.lang.SecurityException:under uid 10090 but it is really 10060的相关文章

java.lang.SecurityException: Permission Denial: opening provider

在测试调用外部提供的ContentProvider时候报一下错误: java.lang.SecurityException: Permission Denial: opening provider com.example.onehw.BookProvider from ProcessRecord{b2f1b230 8449:com.example.adtest/u0a53} (pid=8449, uid=10053) that is not exported from uid 10052 at

访问不了自己创建的Contentprovider,报错:java.lang.SecurityException: Permission Denial

情景:1.A,B两个程序,A程序提供ContentProvider:B程序访问A程序的ContendProvider 2.在A程序中已经添加权限: <provider android:name=".provider.UserProvider" android:authorities="com.example.listview.userprovider"></provider> 问题:A程序部署后,再运行B程序,报错: 03-11 21:48:

Android 4.4: java.lang.SecurityException: Package com.android.settings does not belong to 1001

问题描述: 在Android4.4.2上面定制的东西,今天code base改为Android4.4.4. 代码merge到新的Android 4.4.4 code base后,clean build后会报出下面错误: 1 W/dalvikvm( 3125): threadid=1: thread exiting with uncaught exception (group=0x415e8d58) 2 W/AppOps ( 1053): Bad call: specified package c

Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.HEADSET_PLUG

crash information:Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.HEADSET_PLUG from    at android.os.Parcel.readException(Parcel.java:1465)     at android.os.Parcel.readException(Parcel.j

java.lang.SecurityException: JCE cannot authenticate the provider BC

和X公司对接数据,他们的开发语言是java,我们是php,双方数据通信的时候采用的加密方法是:bouncycastle 由于这个时间大神的限制,我们暂时不用PHP开发自己的加密算法,而是采用对方已有的加密包. 具体思路是: 1.将java写的的加密方法封装成jar包: 2.然后在php里面直接调用:exec("java -jar encrypt.jar")系统命令执行,实现加密解密 这里主要遇到2个问题: 1.cannot load mian class 2.调试过程中报错:java.

Android 开发之错误整理java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10088 nor current process has android.permission.READ_PHONE_STATE.

java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10088 nor current process has android.permission.READ_PHONE_STATE. 今天写了一款发短信的软件,拿了个酷派5879,试了下,结果不能用,把try{}catch{}去掉了,报这个错误, android.permission.READ_PHONE_STATE.没有READ_PHONE_STATE权限,

Maven 3.3.3 with JDK1.7, java.lang.SecurityException

maven 3.3.3 with JDK1.7_79遇到java.lang.SecurityException问题 今天在另一台机器上安装了maven 3.3.3以及jdk1.7_79.在配置maven的时候,需要用到命令来生成password的加密code.如下: mvn -emp HelloWorld mvn -ep xxxxxxxxxx 但是,在windows command line下执行第一条命令时遇到如下错误: Caused by: java.lang.SecurityExcepti

AIDL 发生异常的原因 Android java.lang.SecurityException: Binder invocation to an incorrect interface

我建立了两个project.一个是activity 的 ,一个是service 的. 在进行两个project通信时,应该有以下几点注意: 1.在activity project中引入service project中aidl文件.注意引入后的aidl文件包名应该和service中aidl文件包名保持一致. 2.service project中manifest文件中,service 注册时要声明 android:process=":remote" action应该是aidl中接口的包名.

java.lang.SecurityException: Can&#39;t make field constructor accessible

原本使用GsonConvertor,在Android版本5.1.1上没有任何问题,结果切换到版本6.0.1上,出现以下所示问题: java.lang.IllegalArgumentException: Unable to create converter for java.util.List<model> ,StackOverFlow有个帖子谈这个问题http://stackoverflow.com/questions/34315499/unable-to-create-converter-f