Improvement of notification and cancel method--look at the system security optimization of Android system

Source: Internet
Author: User

becauseAndroidMarket management is not sound, manyAPPall by advertising to the notification bar to induce users to click, more ads, it is annoying.

So a lot of security software provides the ability to go to the notification bar AD, even
Androidin the4.2later provided theDisableaAppof theNotificationfunction to purify the notification bar. The visibility of the notification bar is critical for the user.


Android Security Squadin the study of this function, we hope to make some constructive comments for your reference.
I. Organizational Structure
1. Notificationmanagerservice
Notificationmanagerserviceis the main manager of the notification bar, responsible for handling allAPPthe notification message that is sent. Its features are very simple to viewNotificationmanagerservice.javathe code can be learned.
Nmsthe work done can be broadly divided into:
A.Enquiry/set aAPPthe ability to send notifications (you can disable aAPPSend notifications,4.2version is available);
B.AcceptAPPthe notification sent;
C.RecordNotificationdata;
D.send notifications that should be displayed to the notification bar (StatusBar)
E.delete a notification;
2. Notificationrecord
if people thinkNotificationclass isNMSused to storeNotificationdata structure of the information that was wrong, inNMSThe interior is usedNotificationrecordto be stored, including theNotificationclass.

Except
Notificationoutside the classNmsadditional information on this notice is also recorded, includingPackageName, tag, ID, scoreand so on. So if a security software needs to query the system for anyNotification, light to checkNotificationclass itself is not enough, should go to queryNotificationrecordTo correctly find the notification that needs to be deleted. But thisa classis defined inNmsinternal, and the property isPrivate, security software wants to get is extremely hard.
Second,CancelMethod
Nmsof theCancelThere are two ways of doing this.
1. Cancelnotificationwithtag ((String pkg,string tag, int id). ThroughTagand theIdcombination to delete a specific notification.
2. Cancelallnotifications (String pkg). Delete aPackageunder the allNotification.
Neither of these methods is exposed to the external, ordinaryAPPonly throughNotificationmanagerof theCancelmethod toCancelnotice of their own sending out (NotificationmanagerIt will eventually be called to theNmsthe two in theCancelmethod). If the security software to move other people's notice, it will need to do some extra effort, we learned that can be inRootthen called by reflection.
Third, our ideas
there is a need to be realized, in4.0times, the notification bar also does not support disabling aAPPpush notification feature. But it could be the appeal of many users,4.2Times,Googleadded aSetnotificationsenabledforpackage (String pkg, Boolean enabled)function that allows users to disable their annoying advertising messages. The call to this function is in "settings", as shown in the preceding illustration, to removeShow NotificationThe TickAPPyou won't be able to push the message again.
in the same vein, I think, for the security software vendors, in the system to open a number of queries and deleteNotificationinterface for both users and security software, and the system is open for "Setup"Setnotificationsenabledforpackageinterface is the same as the original. Our philosophy is to avoid cell phones beingRoot, for security software, just open the right permissions and provide the necessary interfaces to meet the security needs is enough. This way, you can prevent your phone from beingRootafter a variety of unscrupulous software kidnapping mobile phones, wanton destruction, and also give excellent formal security software to the door, let them in a humane, user-friendly way to provide us with security services.
on the queryNotificationfunction, we canNmsRecord ofNotificationThe information is organized together, exposing the interface to the outside to facilitate query. The caller's signature is verified in the query interface to ensure that only qualified security software is available.
Similarly, forCancelmethod, we can also use the same principle, after checking the signature directly callNmsof twoCancelmethod.
AndroidThe system itself should be a security-oriented system, with the user active or passiveRoothis cell phone, it's against theAndroidthe original intention, leading to the emergence of various sequelae. Let go.AndroidThe system regulates the software so thatAndroidThe system becomes unsafe. Like opening Pandora's Box, the system is more vulnerable to attack while being facilitated.
so we still reiterate our claim that mobile phone security or to start from the system, as long as the system itself can provide security software functions, or targeted to the system interface to the security software use, then the security of the Android system "acclimatized" will be able to solve the .

Reprinted from Http://bbs.51cto.com/thread-1035850-1.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.