/*! Ads Here */

Should I disable or force stop an app? -Thủ Thuật Mới

Mẹo về Should I disable or force stop an app? Mới Nhất


Quý khách đang tìm kiếm từ khóa Should I disable or force stop an app? được Update vào lúc : 2022-11-30 20:59:12 . Với phương châm chia sẻ Mẹo Hướng dẫn trong nội dung bài viết một cách Chi Tiết Mới Nhất. Nếu sau khi tìm hiểu thêm tài liệu vẫn ko hiểu thì hoàn toàn có thể lại Comments ở cuối bài để Tác giả lý giải và hướng dẫn lại nha.


The code behind the Force stop button is complex and undocumented. I’ll reproduce it verbatim and then go through it one piece a time.


private void checkForceStop()

if (mDpm.packageHasActiveAdmins(mPackageInfo.packageName))

// User can’t force stop device admin.

updateForceStopButton(false);

else if ((mAppEntry.info.flags&ApplicationInfo.FLAG_STOPPED) == 0)

// If the app isn’t explicitly stopped, then always show the

// force stop button.

updateForceStopButton(true);

else

Intent intent = new Intent(Intent.ACTION_QUERY_PACKAGE_RESTART,

Uri.fromParts(“package”, mAppEntry.info.packageName, null));

intent.putExtra(Intent.EXTRA_PACKAGES, new String[] mAppEntry.info.packageName );

intent.putExtra(Intent.EXTRA_UID, mAppEntry.info.uid);

intent.putExtra(Intent.EXTRA_USER_HANDLE, UserHandle.getUserId(mAppEntry.info.uid));

getActivity().sendOrderedBroadcast(intent, null, mCheckKillProcessesReceiver, null,

Activity.RESULT_CANCELED, null, null);


The first if line checks if any component of the package is a device admin (that is, if it’s checked in the Device administrators list in the Security page of the Settings app). If so, the button is disabled (greyed out) so you can’t stop device admins.


Then, the else if checks if the package is already stopped. Here, stopped doesn’t just mean “not running”. As far as I can tell, a package is in the stopped state if you’ve never run any component from it (such as by launching it from the menu), or if you’ve pressed a Force stop button (this one or in a “stopped working” dialog) and not run any of its components again. If the package hasn’t been stopped, the button is enabled.


The else case covers the rare eventuality that an app has been stopped and isn’t a device admin. In this case, it gives other system services a chance to enable the button. For example, the app might have an alarm set and pending, which would later cause the app to be started again even from the stopped state. In this case, the button will be enabled. If no other system service has a reason to enable the button, it will be disabled.


Summary


The Force stop button is enabled if the package is not a device admin and either you haven’t already force-stopped this app or you have force-stopped it but a system service thinks it will run it again.


If the app is running (and it isn’t a device admin), the Force stop button will definitely be enabled, but the button being enabled doesn’t mean the app is running.


Reply

3

0

Chia sẻ


Chia Sẻ Link Cập nhật Should I disable or force stop an app? miễn phí


Bạn vừa Read nội dung bài viết Với Một số hướng dẫn một cách rõ ràng hơn về Review Should I disable or force stop an app? tiên tiến và phát triển nhất Chia SẻLink Tải Should I disable or force stop an app? Free.


Thảo Luận vướng mắc về Should I disable or force stop an app?


Nếu sau khi đọc nội dung bài viết Should I disable or force stop an app? vẫn chưa hiểu thì hoàn toàn có thể lại phản hồi ở cuối bài để Mình lý giải và hướng dẫn lại nha

#disable #force #stop #app

*

Đăng nhận xét (0)
Mới hơn Cũ hơn

Responsive Ad

/*! Ads Here */

Billboard Ad

/*! Ads Here */