Java Code Examples for android.os.PersistableBundle#getInt()
The following examples show how to use
android.os.PersistableBundle#getInt() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlatformScheduler.java From MediaSDK with Apache License 2.0 | 6 votes |
@Override public boolean onStartJob(JobParameters params) { logd("PlatformSchedulerService started"); PersistableBundle extras = params.getExtras(); Requirements requirements = new Requirements(extras.getInt(KEY_REQUIREMENTS)); if (requirements.checkRequirements(this)) { logd("Requirements are met"); String serviceAction = extras.getString(KEY_SERVICE_ACTION); String servicePackage = extras.getString(KEY_SERVICE_PACKAGE); Intent intent = new Intent(Assertions.checkNotNull(serviceAction)).setPackage(servicePackage); logd("Starting service action: " + serviceAction + " package: " + servicePackage); Util.startForegroundService(this, intent); } else { logd("Requirements are not met"); jobFinished(params, /* needsReschedule */ true); } return false; }
Example 2
Source File: SystemUpdateManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@Override public void updateSystemUpdateInfo(PersistableBundle infoBundle) { mContext.enforceCallingOrSelfPermission(Manifest.permission.RECOVERY, TAG); int status = infoBundle.getInt(KEY_STATUS, STATUS_UNKNOWN); if (status == STATUS_UNKNOWN) { Slog.w(TAG, "Invalid status info. Ignored"); return; } // There could be multiple updater apps running on a device. But only one at most should // be active (i.e. with a pending update), with the rest reporting idle status. We will // only accept the reported status if any of the following conditions holds: // a) none has been reported before; // b) the current on-file status was last reported by the same caller; // c) an active update is being reported. int uid = Binder.getCallingUid(); if (mLastUid == UID_UNKNOWN || mLastUid == uid || status != STATUS_IDLE) { synchronized (mLock) { saveSystemUpdateInfoLocked(infoBundle, uid); } } else { Slog.i(TAG, "Inactive updater reporting IDLE status. Ignored"); } }
Example 3
Source File: PlatformScheduler.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public boolean onStartJob(JobParameters params) { logd("PlatformSchedulerService started"); PersistableBundle extras = params.getExtras(); Requirements requirements = new Requirements(extras.getInt(KEY_REQUIREMENTS)); if (requirements.checkRequirements(this)) { logd("Requirements are met"); String serviceAction = extras.getString(KEY_SERVICE_ACTION); String servicePackage = extras.getString(KEY_SERVICE_PACKAGE); Intent intent = new Intent(serviceAction).setPackage(servicePackage); logd("Starting service action: " + serviceAction + " package: " + servicePackage); Util.startForegroundService(this, intent); } else { logd("Requirements are not met"); jobFinished(params, /* needsReschedule */ true); } return false; }
Example 4
Source File: PlatformScheduler.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public boolean onStartJob(JobParameters params) { logd("PlatformSchedulerService started"); PersistableBundle extras = params.getExtras(); Requirements requirements = new Requirements(extras.getInt(KEY_REQUIREMENTS)); if (requirements.checkRequirements(this)) { logd("Requirements are met"); String serviceAction = extras.getString(KEY_SERVICE_ACTION); String servicePackage = extras.getString(KEY_SERVICE_PACKAGE); Intent intent = new Intent(serviceAction).setPackage(servicePackage); logd("Starting service action: " + serviceAction + " package: " + servicePackage); Util.startForegroundService(this, intent); } else { logd("Requirements are not met"); jobFinished(params, /* needsReschedule */ true); } return false; }
Example 5
Source File: PlatformScheduler.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public boolean onStartJob(JobParameters params) { logd("PlatformSchedulerService started"); PersistableBundle extras = params.getExtras(); Requirements requirements = new Requirements(extras.getInt(KEY_REQUIREMENTS)); if (requirements.checkRequirements(this)) { logd("Requirements are met"); String serviceAction = extras.getString(KEY_SERVICE_ACTION); String servicePackage = extras.getString(KEY_SERVICE_PACKAGE); Intent intent = new Intent(Assertions.checkNotNull(serviceAction)).setPackage(servicePackage); logd("Starting service action: " + serviceAction + " package: " + servicePackage); Util.startForegroundService(this, intent); } else { logd("Requirements are not met"); jobFinished(params, /* needsReschedule */ true); } return false; }
Example 6
Source File: PlatformScheduler.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public boolean onStartJob(JobParameters params) { logd("PlatformSchedulerService started"); PersistableBundle extras = params.getExtras(); Requirements requirements = new Requirements(extras.getInt(KEY_REQUIREMENTS)); if (requirements.checkRequirements(this)) { logd("Requirements are met"); String serviceAction = extras.getString(KEY_SERVICE_ACTION); String servicePackage = extras.getString(KEY_SERVICE_PACKAGE); Intent intent = new Intent(Assertions.checkNotNull(serviceAction)).setPackage(servicePackage); logd("Starting service action: " + serviceAction + " package: " + servicePackage); Util.startForegroundService(this, intent); } else { logd("Requirements are not met"); jobFinished(params, /* needsReschedule */ true); } return false; }
Example 7
Source File: SystemUpdateManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void saveSystemUpdateInfoLocked(PersistableBundle infoBundle, int uid) { // Wrap the incoming bundle with extra info (e.g. version, uid, boot count). We use nested // PersistableBundle to avoid manually parsing XML attributes when loading the info back. PersistableBundle outBundle = new PersistableBundle(); outBundle.putPersistableBundle(KEY_INFO_BUNDLE, infoBundle); outBundle.putInt(KEY_VERSION, INFO_FILE_VERSION); outBundle.putInt(KEY_UID, uid); outBundle.putInt(KEY_BOOT_COUNT, getBootCount()); // Only update the info on success. if (writeInfoFileLocked(outBundle)) { mLastUid = uid; mLastStatus = infoBundle.getInt(KEY_STATUS); } }
Example 8
Source File: DocumentCentricActivity.java From user-interface-samples with Apache License 2.0 | 5 votes |
@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); } }
Example 9
Source File: Location.java From your-local-weather with GNU General Public License v3.0 | 5 votes |
public Location(PersistableBundle persistentBundle) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { id = persistentBundle.getLong("id"); latitude = persistentBundle.getDouble("latitude"); longitude = persistentBundle.getDouble("longitude"); orderId = persistentBundle.getInt("orderId"); localeAbbrev = persistentBundle.getString("locale"); locale = new Locale(localeAbbrev); nickname = persistentBundle.getString("nickname");; accuracy = new Double(persistentBundle.getDouble("accuracy")).floatValue(); locationSource = persistentBundle.getString("locationSource"); lastLocationUpdate = persistentBundle.getLong("lastLocationUpdate"); address = PersistableBundleBuilder.toAddress(persistentBundle.getPersistableBundle("address")); } }
Example 10
Source File: VoiceSettingParameter.java From your-local-weather with GNU General Public License v3.0 | 5 votes |
public VoiceSettingParameter(PersistableBundle persistentBundle) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { id = persistentBundle.getLong("id"); voiceSettingId = persistentBundle.getLong("voiceSettingId"); paramTypeId = persistentBundle.getInt("paramTypeId"); paramBooleanValue = mapIntToBoolean(persistentBundle.getInt("paramBooleanValue")); paramLongValue = persistentBundle.getLong("paramLongValue"); paramStringValue = persistentBundle.getString("paramStringValue"); } }
Example 11
Source File: SyncDelegate.java From materialistic with Apache License 2.0 | 5 votes |
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) Job(PersistableBundle bundle) { id = bundle.getString(EXTRA_ID); connectionEnabled = bundle.getInt(EXTRA_CONNECTION_ENABLED) == 1; readabilityEnabled = bundle.getInt(EXTRA_READABILITY_ENABLED) == 1; articleEnabled = bundle.getInt(EXTRA_ARTICLE_ENABLED) == 1; commentsEnabled = bundle.getInt(EXTRA_COMMENTS_ENABLED) == 1; notificationEnabled = bundle.getInt(EXTRA_NOTIFICATION_ENABLED) == 1; }
Example 12
Source File: DocumentCentricActivity.java From android-DocumentCentricApps with Apache License 2.0 | 5 votes |
@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); } }