android 修改桌面widget开机后,加载慢的问题

AppwidgetServiceImpl.java

    private void sendEnableIntentLocked(Provider p) {
        Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_ENABLED);
        intent.setComponent(p.info.provider);
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);//hujiye 20181225 add
        sendBroadcastAsUser(intent, p.info.getProfile());
    }

    private void sendUpdateIntentLocked(Provider provider, int[] appWidgetIds) {
        Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
        intent.setComponent(provider.info.provider);
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);//hujiye 20181225 add
        sendBroadcastAsUser(intent, provider.info.getProfile());
    }

你可能感兴趣的:(Android)