Android异常分析(转)


http://www.cnblogs.com/xiyuan2016/p/6740623.html 


Mtklog 分析(学习)

http://www.cnblogs.com/xiyuan2016/p/6740521.html

===================================================================================

frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java

final void processNextBroadcast(boolean fromMsg) {

  boolean skip = false; 下边添加

final String action = r.intent.getAction();final String clsName = info.activityInfo.name;if("android.intent.action.CONFIGURATION_CHANGED".equals(action) &&        "应用类名".equals(clsName)){    skip = true;}
===================================================================================



去掉多用户后想让下拉单的多用户图标显示出来

/code2/lq80/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java

protected void updateVisibilities() {    updateAlarmVisibilities();    mEmergencyOnly.setVisibility(mExpanded && mShowEmergencyCallsOnly            ? View.VISIBLE : View.INVISIBLE);    mSettingsContainer.setVisibility(mExpanded ? View.VISIBLE : View.INVISIBLE);    mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility(            TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE);    mMultiUserSwitch.setVisibility(mExpanded && mMultiUserSwitch.hasMultipleUsers()            ? View.VISIBLE : View.INVISIBLE);}


    mMultiUserSwitch.setVisibility(mExpanded && mMultiUserSwitch.hasMultipleUsers()            ? View.VISIBLE : View.INVISIBLE);
这句话就是控制那个多用户现实不显示的

不支持多用户后点击多用户按钮会进入添加联系人的界面

frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java

的onClick方法里的else里将原来的intent替换为

        Intent intent = new Intent(Intent.ACTION_INSERT);
        intent.setType("vnd.android.cursor.dir/person");
        intent.setType("vnd.android.cursor.dir/contact");
        intent.setType("vnd.android.cursor.dir/raw_contact");

就可以了。

设置里边多去掉多用户的菜单

packages/apps/Settings/AndroidManifest.xml

android:name="Settings$UserSettingsActivity"
这个activity里注释掉

android:name="com.android.settings.category"    android:value="com.android.settings.category.device" />
就可以了。这个以后解释。

==============================================================================

播放声音

int max = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL);mAudioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, max, 0);mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 16, 0);setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);//A: zhaopenglin for cannot play mp3 at once 20170607if (mMediaPlayer != null) {    mMediaPlayer.stop();    mMediaPlayer.release();    mMediaPlayer = null;}try {    mMediaPlayer = new MediaPlayer();    AssetFileDescriptor assetFileDescriptor = this.getResources().openRawResourceFd(R.raw.testmusic);    if (assetFileDescriptor == null) return;    mMediaPlayer.setDataSource(assetFileDescriptor.getFileDescriptor(), assetFileDescriptor.getStartOffset(),            assetFileDescriptor.getLength());    assetFileDescriptor.close();    mMediaPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);    mMediaPlayer.prepare();} catch (IllegalStateException e) {    e.printStackTrace();} catch (Exception e) {    e.printStackTrace();}mMediaPlayer.setVolume(max, max);mMediaPlayer.start();mMediaPlayer.setLooping(true);

==========================================================================================================================

可分屏应用调用不能分屏应用,分屏报错

frameworks/base/packages/SystemUI/src/com/android/systemui/recents/Recents.java

@Overridepublic boolean dockTopTask(int dragMode, int stackCreateMode, Rect initialBounds,        int metricsDockAction) {
…………………………

boolean screenPinningActive = ssp.isScreenPinningActive();boolean isRunningTaskInHomeStack = runningTask != null &&        SystemServicesProxy.isHomeStack(runningTask.stackId);//add startif(runningTask != null && runningTask.topActivity.getPackageName().equals("不能分屏应用的包名")) {    Toast.makeText(mContext, R.string.recents_incompatible_app_message,            Toast.LENGTH_SHORT).show();    return false;}//add end

/code1/lq80/frameworks/base/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java

public final void onBusEvent(DragStartEvent event) {

……………………

if (!event.task.isDockable        || event.task.getTopComponent().getPackageName().equals("不能分屏应用的包名")) {    EventBus.getDefault().send(new ShowIncompatibleAppOverlayEvent());} else {

public final void onBusEvent(DragEndEvent event) {

……………………

if (!mDragTask.isDockable        || mDragTask.getTopComponent().getPackageName().equals("不能分屏应用包名")) {     EventBus.getDefault().send(new HideIncompatibleAppOverlayEvent());}

===========================================================================

8.0 USB窗口解锁白屏

frameworks/base/services/core/java/com/android/server/am/KeyguardController.java

 mStackSupervisor.addStartingWindowsForVisibleActivities(false /* taskSwitch */);

================================================================================================

默认打开launcher3在设置里的通知

frameworks\base\services\core\java\com\android\server\notification\ManagedServices.java

private void rebuildRestoredPackages() {    mRestoredPackages.clear();    String secureSettingName = restoredSettingName(mConfig.secureSettingName);    String secondarySettingName = mConfig.secondarySettingName == null            ? null : restoredSettingName(mConfig.secondarySettingName);    //add by zhaopenglin start    try {        if ((Settings.System.getInt(mContext.getContentResolver(), "lalalaal", 0) == 0)                && Settings.Secure.ENABLED_NOTIFICATION_LISTENERS.equals(mConfig.secureSettingName)) {            Settings.Secure.putString(mContext.getContentResolver(), mConfig.secureSettingName,                    "com.android.launcher3/com.android.launcher3.notification.NotificationListener");            Settings.System.putInt(mContext.getContentResolver(), "lalalaal", 1);        }    }catch (Exception e){}    //add by zhaopenglin  end    int[] userIds = mUserProfiles.getCurrentProfileIds();    final int N = userIds.length;    for (int i = 0; i < N; ++i) {        ArraySet names =                loadComponentNamesFromSetting(secureSettingName, userIds[i]);        if (secondarySettingName != null) {            names.addAll(loadComponentNamesFromSetting(secondarySettingName, userIds[i]));        }        for (ComponentName name : names) {            mRestoredPackages.add(name.getPackageName());        }    }}












更多相关文章

  1. Android 的res/values/colors自定义颜色列表和注释表及布局文件
  2. Android 总结:打造Android中的流式布局和热门标签(源码有详细注释)
  3. android 禁用解锁
  4. Android监听屏幕屏幕锁屏与解锁
  5. Android实现九宫格图案解锁
  6. IllegalStateException,PatternSyntaxException,Android studio 注
  7. Android studio中新建类时自动生成注释的设置
  8. android 亮屏及屏幕解锁代码
  9. android屏幕解锁

随机推荐

  1. 专用服务器模式(MTS)和共享服务器模式
  2. 磁盘文件系统损坏怎么解决?
  3. 【收藏】JavaScript本地存储localStorage
  4. 【收藏】最全JavaScript中所有的内置对象
  5. JS中的值传递,模板字面量,数组、对象、传参
  6. 0408作业-Ajax、选项卡和换肤案例
  7. js2 解构,访问器属性
  8. 上传个图片都能拿下服务器!赶紧自检!
  9. 自动调节AWS的步骤
  10. 开源情报(OSINT)侦察指北