android 6.0 SystemUI源码分析(6)-StorageNotification介绍

本文深入探讨了Android 6.0 SystemUI中的StorageNotification组件,它负责处理Storage事件,如设备的插入和移除。StorageNotification启动时会注册StorageEventListener,监听onVolumeStateChanged和onVolumeRecordChanged事件,以响应存储状态的变化。
摘要由CSDN通过智能技术生成

StorageNotification继承于SystemUI,主要处理Storage事件,比如Storage插拔等。

在StorageNotfication的start函数,会去注册StorageEventListener。

 @Override
    public void start() {
        mNotificationManager = mContext.getSystemService(NotificationManager.class);

        mStorageManager = mContext.getSystemService(StorageManager.class);
        mStorageManager.registerListener(mListener);
对于U盘或SD卡插拔事件,我们常用的是通过广播的方式去接收,具体可以参考:

http://blog.csdn.net/zhudaozhuan/article/details/7199799

StorageEventListener的实现如下:

    private final StorageEventListener mListener = new StorageEventListener() {
        @Override
        public void onVolumeStateChanged(VolumeInfo vol, int oldState, int newState) {
            onVolumeStateChangedInternal(vol);
        }

        @Override
        public void onVolumeRecordChanged(VolumeR
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值