Java 类android.os.PersistableBundle 实例源码

项目:androidtv-sample    文件:SyncUtils.java   
public static void requestSync(Context context, String inputId, boolean currentProgramOnly) {
    PersistableBundle pBundle = new PersistableBundle();
    pBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    pBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    pBundle.putString(SyncJobService.BUNDLE_KEY_INPUT_ID, inputId);
    pBundle.putBoolean(SyncJobService.BUNDLE_KEY_CURRENT_PROGRAM_ONLY, currentProgramOnly);
    JobInfo.Builder builder = new JobInfo.Builder(REQUEST_SYNC_JOB_ID,
            new ComponentName(context, SyncJobService.class));
    JobInfo jobInfo = builder
            .setExtras(pBundle)
            .setOverrideDeadline(SyncJobService.OVERRIDE_DEADLINE_MILLIS)
            .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
            .build();
    scheduleJob(context, jobInfo);
    Intent intent = new Intent(SyncJobService.ACTION_SYNC_STATUS_CHANGED);
    intent.putExtra(SyncJobService.BUNDLE_KEY_INPUT_ID, inputId);
    intent.putExtra(SyncJobService.SYNC_STATUS, SyncJobService.SYNC_STARTED);
    LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
}
项目:chaosflix    文件:AboutActivity.java   
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
    super.onCreate(savedInstanceState, persistentState);
    setContentView(R.layout.fragment_about);

    webView = findViewById(R.id.web_view);
    webView.setNetworkAvailable(false);
    webView.setWebViewClient(new WebViewClient(){
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url){
            if(url.startsWith("http")){
                depth++;
                return false;
            } else {
                url = url.replace("file:///android_asset/","");
                loadAsset(url);
                return true;
            }
        }
    });
    loadAsset("file:///android_asset/about.html");
}
项目:leanback-homescreen-channels    文件:AddWatchNextService.java   
public static void scheduleAddWatchNextRequest(Context context, ClipData clipData) {
    JobScheduler scheduler = (JobScheduler) context.getSystemService(JOB_SCHEDULER_SERVICE);

    PersistableBundle bundle = new PersistableBundle();
    bundle.putString(ID_KEY, clipData.getClipId());
    bundle.putString(CONTENT_ID_KEY, clipData.getContentId());
    bundle.putLong(DURATION_KEY, clipData.getDuration());
    bundle.putLong(PROGRESS_KEY, clipData.getProgress());
    bundle.putString(TITLE_KEY, clipData.getTitle());
    bundle.putString(DESCRIPTION_KEY, clipData.getDescription());
    bundle.putString(CARD_IMAGE_URL_KEY, clipData.getCardImageUrl());

    scheduler.schedule(new JobInfo.Builder(1,
            new ComponentName(context, AddWatchNextService.class))
            .setMinimumLatency(0)
            .setExtras(bundle)
            .build());
}
项目:android-perftracking    文件:ActivityMixin.java   
@ReplaceMethod
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
  if (!com_rakuten_tech_mobile_perf_onCreate_tracking) {
    com_rakuten_tech_mobile_perf_onCreate_tracking = true;

    int id = Tracker.startMethod(this, "onCreate");

    try {
      onCreate(savedInstanceState, persistentState);
    } finally {
      Tracker.endMethod(id);
      com_rakuten_tech_mobile_perf_onCreate_tracking = false;
    }
  } else {
    onCreate(savedInstanceState, persistentState);
  }
}
项目:buildAPKsSamples    文件:DocumentCentricActivity.java   
@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
    /*
    To maintain activity state across reboots the system saves and restore critical information for
    all tasks and their activities. Information known by the system includes the activity stack order,
    each task’s thumbnails and each activity’s and task's Intents. For Information that cannot be retained
    because they contain Bundles which can’t be persisted a new constrained version of Bundle,
    PersistableBundle is added. PersistableBundle can store only basic data types. To use it
    in your Activities you must declare the new activity:persistableMode attribute in the manifest.
     */
    outPersistentState.putInt(KEY_EXTRA_NEW_DOCUMENT_COUNTER, mDocumentCounter);
    super.onSaveInstanceState(outState, outPersistentState);
}
项目:nifi-android-s2s    文件:SiteToSiteJobService.java   
public static JobInfo.Builder createProcessJobInfoBuilder(Context context, int jobId, QueuedSiteToSiteClientConfig queuedSiteToSiteClientConfig, ParcelableQueuedOperationResultCallback parcelableQueuedOperationResultCallback) {
    JobInfo.Builder builder = new JobInfo.Builder(jobId, new ComponentName(context, SiteToSiteJobService.class));
    PersistableBundle persistableBundle = new PersistableBundle();
    SerializationUtils.putParcelable(queuedSiteToSiteClientConfig, persistableBundle, "config");
    SerializationUtils.putParcelable(parcelableQueuedOperationResultCallback, persistableBundle, "callback");
    builder.setExtras(persistableBundle);
    return builder;
}
项目:NovelReader    文件:OtherBillBookActivity.java   
/***************************************************/
@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
    super.onSaveInstanceState(outState, outPersistentState);
    outState.putString(EXTRA_BILL_ID,mBillId);
    outState.putString(EXTRA_BILL_NAME,mBillName);
}
项目:nifi-android-s2s    文件:SerializationUtils.java   
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public static <T extends Parcelable> void putParcelable(T parcelable, PersistableBundle persistableBundle, String name) {
    if (parcelable == null) {
        return;
    }
    PersistableBundle bundle = new PersistableBundle();
    bundle.putString("class", parcelable.getClass().getCanonicalName());
    bundle.putString("data", Base64.encodeToString(marshallParcelable(parcelable), 0));
    persistableBundle.putPersistableBundle(name, bundle);
}
项目:buildAPKsSamples    文件:DocumentCentricActivity.java   
@Override
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
    super.onPostCreate(savedInstanceState, persistentState);
    // Restore state from PersistableBundle
    if (persistentState != null) {
        mDocumentCounter = persistentState.getInt(KEY_EXTRA_NEW_DOCUMENT_COUNTER);
    }
}
项目:MobileAppForPatient    文件:PCLinkLibraryCommuTestActivity.java   
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
    super.onCreate(savedInstanceState, persistentState);/*
    setContentView(R.layout.measurement_activity);

    findViews();
    setListener();*/
}
项目:leanback-homescreen-channels    文件:AddWatchNextService.java   
@Override
protected Void doInBackground(Void... params) {
    PersistableBundle bundle = mJobParameters.getExtras();
    if (bundle == null) {
        Log.e(TAG, "No data passed to task for job " + mJobParameters.getJobId());
        return null;
    }

    String id = bundle.getString(ID_KEY);
    String contentId = bundle.getString(CONTENT_ID_KEY);
    long duration = bundle.getLong(DURATION_KEY);
    long progress = bundle.getLong(PROGRESS_KEY);
    String title = bundle.getString(TITLE_KEY);
    String description = bundle.getString(DESCRIPTION_KEY);
    String cardImageURL = bundle.getString(CARD_IMAGE_URL_KEY);

    ClipData clipData = new ClipData.Builder().setClipId(id)
            .setContentId(contentId)
            .setDuration(duration)
            .setProgress(progress)
            .setTitle(title)
            .setDescription(description)
            .setCardImageUrl(cardImageURL)
            .build();

    SampleTvProvider.addWatchNextContinue(getApplicationContext(), clipData);
    return null;

}
项目:androidtv-sample    文件:SyncUtils.java   
public static void setUpPeriodicSync(Context context, String inputId) {
    PersistableBundle pBundle = new PersistableBundle();
    pBundle.putString(SyncJobService.BUNDLE_KEY_INPUT_ID, inputId);
    JobInfo.Builder builder = new JobInfo.Builder(PERIODIC_SYNC_JOB_ID,
            new ComponentName(context, SyncJobService.class));
    JobInfo jobInfo = builder
            .setExtras(pBundle)
            .setPeriodic(SyncJobService.FULL_SYNC_FREQUENCY_MILLIS)
            .setPersisted(true)
            .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
            .build();
    scheduleJob(context, jobInfo);
}
项目:NITKart    文件:newUser.java   
@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
    super.onSaveInstanceState(outState, outPersistentState);
    outState.putString("firstname", firstname.getText().toString());
    outState.putString("lastname", lastname.getText().toString());
    outState.putString("email", username.getText().toString());
    setViews(false);
}
项目:TPlayer    文件:AppInstrumentation.java   
@Override
public void callActivityOnCreate(Activity activity, Bundle icicle, PersistableBundle persistentState) {
    if (icicle != null) {
        BundleCompat.clearParcelledData(icicle);
    }
    super.callActivityOnCreate(activity, icicle, persistentState);
}
项目:ywApplication    文件:WellcomeAddOurActivity.java   
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
    setContentView(R.layout.activity_wellcomeinour);

    ViewUtils.inject(this);
    httpUtils=new HttpUtils();
    mobile=telephoneNum.getText().toString();

}
项目:BilibiliClient    文件:RxBaseActivity.java   
@Override
public void onPostCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
    super.onPostCreate(savedInstanceState, persistentState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(ThemeUtils.getColorById(this, R.color.theme_color_primary_dark));
        ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription
                (null, null, ThemeUtils.getThemeAttrColor(this, android.R.attr.colorPrimary));
        setTaskDescription(taskDescription);
    }
}
项目:2017.2-codigo    文件:JobSchedulerActivity.java   
private void agendarJob() {
    JobInfo.Builder b = new JobInfo.Builder(JOB_ID, new ComponentName(this, DownloadJobService.class));
    PersistableBundle pb=new PersistableBundle();
    pb.putBoolean(KEY_DOWNLOAD, true);
    b.setExtras(pb);

    //criterio de rede
    b.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY);
    //b.setRequiredNetworkType(JobInfo.NETWORK_TYPE_NONE);

    //define intervalo de periodicidade
    //b.setPeriodic(getPeriod());

    //exige (ou nao) que esteja conectado ao carregador
    b.setRequiresCharging(false);

    //persiste (ou nao) job entre reboots
    //se colocar true, tem que solicitar permissao action_boot_completed
    b.setPersisted(false);

    //exige (ou nao) que dispositivo esteja idle
    b.setRequiresDeviceIdle(false);

    //backoff criteria (linear ou exponencial)
    //b.setBackoffCriteria(1500, JobInfo.BACKOFF_POLICY_EXPONENTIAL);

    //periodo de tempo minimo pra rodar
    //so pode ser chamado se nao definir setPeriodic...
    b.setMinimumLatency(3000);

    //mesmo que criterios nao sejam atingidos, define um limite de tempo
    //so pode ser chamado se nao definir setPeriodic...
    b.setOverrideDeadline(6000);

    jobScheduler.schedule(b.build());
}
项目:QuickPeriodicJobScheduler    文件:QuickPeriodicJobScheduler.java   
/**
 * Start a QuickPeriodicJob
 * @param jobId The id of the QuickPeriodicJob to start.  It must match an id of a QuickPeriodicJob that was added using QuickPeriodicJobCollection.add().  If the job does not exist, nothing will happen.
 * @param periodicInterval The interval in milliseconds that you want this job to run (example 30000 would be 30 seconds)
 */
public void start(int jobId, long periodicInterval) {
    ComponentName component = new ComponentName(context, QuickPeriodicJobRunner.class);
    JobInfo.Builder builder = new JobInfo.Builder(jobId, component);
    builder.setOverrideDeadline(periodicInterval);
    builder.setMinimumLatency(periodicInterval);
    PersistableBundle bundle = new PersistableBundle();
    bundle.putLong("interval",periodicInterval);
    builder.setExtras(bundle);
    JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
    jobScheduler.schedule(builder.build());
    storeIsJobScheduled(jobId, true, periodicInterval);
}
项目:GitHub    文件:BaseActivity.java   
@CallSuper
@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
    super.onSaveInstanceState(outState, outPersistentState);
    LogUtils.verbose(className + " onSaveInstanceState");
}
项目:okuki    文件:MainActivity.java   
@Override
public void onRestoreInstanceState(Bundle savedInstanceState, PersistableBundle persistentState) {
    super.onRestoreInstanceState(savedInstanceState, persistentState);
}
项目:chaosflix-leanback    文件:LeanbackBaseActivity.java   
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
    super.onCreate(savedInstanceState, persistentState);
    serverUrl = getIntent().getStringExtra("server_url");
}
项目:InstantAppStarter    文件:BaseActivityTwo.java   
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
    super.onCreate(savedInstanceState, persistentState);
}
项目:android-apkbox    文件:HookActivity_LifeCycle.java   
public static void onCreate(Activity target, Bundle icicle, PersistableBundle persistentState, boolean after) {
    if (DEBUG_LIFECYCLE)
        ApkLogger.get().debug("LifeCycle_onCreate " + (after ? "after" : ""), null);
}
项目:InstantAppStarter    文件:BaseActivityOthers.java   
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
    super.onCreate(savedInstanceState, persistentState);
}
项目:Clases-2017c1    文件:SelectPictureActivity.java   
@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
    super.onSaveInstanceState(outState, outPersistentState);
    outState.putString(SELECTED_PICTURE, currentPhotoPath);
}
项目:VirtualHook    文件:VJobSchedulerService.java   
JobConfig(Parcel in) {
    this.virtualJobId = in.readInt();
    this.serviceName = in.readString();
    this.extras = in.readParcelable(PersistableBundle.class.getClassLoader());
}
项目:container    文件:InstrumentationDelegate.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void callActivityOnSaveInstanceState(Activity activity, Bundle outState,
        PersistableBundle outPersistentState) {
    base.callActivityOnSaveInstanceState(activity, outState, outPersistentState);
}
项目:chaosflix-leanback    文件:EventDetailsActivity.java   
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
    super.onCreate(savedInstanceState, persistentState);
    setContentView(R.layout.activity_event_details);
}
项目:VirtualHook    文件:InstrumentationDelegate.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void callActivityOnSaveInstanceState(Activity activity, Bundle outState,
        PersistableBundle outPersistentState) {
    base.callActivityOnSaveInstanceState(activity, outState, outPersistentState);
}
项目:android-apkbox    文件:HookActivityInstrumentationHnadler.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void callActivityOnRestoreInstanceState(Activity activity, Bundle savedInstanceState, PersistableBundle persistentState) {
    HookActivity_LifeCycle.onRestoreInstanceState(activity, savedInstanceState, persistentState, false);
    mInstrumentation.callActivityOnRestoreInstanceState(activity, savedInstanceState, persistentState);
    HookActivity_LifeCycle.onRestoreInstanceState(activity, savedInstanceState, persistentState, true);
}
项目:container    文件:VJobSchedulerService.java   
JobConfig(Parcel in) {
    this.virtualJobId = in.readInt();
    this.serviceName = in.readString();
    this.extras = in.readParcelable(PersistableBundle.class.getClassLoader());
}
项目:PicShow-zhaipin    文件:WEActivity.java   
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
    super.onCreate(savedInstanceState, persistentState);
    PushAgent.getInstance(this).onAppStart();//友盟关于推送的统计
}
项目:ProgressManager    文件:a.java   
final void performCreate(Bundle icicle, PersistableBundle persistentState) {
    restoreHasCurrentPermissionRequest(icicle);
    onCreate(icicle, persistentState);
    mActivityTransitionState.readState(icicle);
    performCreateCommon();
}
项目:android-apkbox    文件:HookActivity_LifeCycle.java   
public static void onSaveInstanceState(Activity activity, Bundle outState, PersistableBundle persistentState, boolean after) {
    if (DEBUG_LIFECYCLE)
        ApkLogger.get().debug("LifeCycle_onSaveInstanceState " + (after ? "after" : ""), null);
}
项目:tiny    文件:BaseActivity.java   
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
    super.onCreate(savedInstanceState, persistentState);
    gcAndFinalize();
}
项目:VirtualHook    文件:InstrumentationDelegate.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void callActivityOnRestoreInstanceState(Activity activity, Bundle savedInstanceState,
        PersistableBundle persistentState) {
    base.callActivityOnRestoreInstanceState(activity, savedInstanceState, persistentState);
}
项目:ProgressManager    文件:a.java   
final void performCreate(Bundle icicle, PersistableBundle persistentState) {
    restoreHasCurrentPermissionRequest(icicle);
    onCreate(icicle, persistentState);
    mActivityTransitionState.readState(icicle);
    performCreateCommon();
}
项目:android-apkbox    文件:HookActivity_LifeCycle.java   
public static void onRestoreInstanceState(Activity activity, Bundle outState, PersistableBundle persistentState, boolean after) {
    if (DEBUG_LIFECYCLE)
        ApkLogger.get().debug("LifeCycle_onRestoreInstanceState " + (after ? "after" : ""), null);
}
项目:ChocoPie    文件:ReparativeActivity.java   
@Deprecated
@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
    super.onSaveInstanceState(outState, outPersistentState);
    handleSave(outState);
}
项目:ProgressManager    文件:a.java   
final void performCreate(Bundle icicle, PersistableBundle persistentState) {
    restoreHasCurrentPermissionRequest(icicle);
    onCreate(icicle, persistentState);
    mActivityTransitionState.readState(icicle);
    performCreateCommon();
}