Home | History | Annotate | Download | only in packages
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, versionCode 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 #define DEBUG false  // STOPSHIP if true
     17 #include "Log.h"
     18 
     19 #include "hash.h"
     20 #include "stats_log_util.h"
     21 #include "guardrail/StatsdStats.h"
     22 #include "packages/UidMap.h"
     23 
     24 #include <android/os/IStatsCompanionService.h>
     25 #include <binder/IServiceManager.h>
     26 #include <utils/Errors.h>
     27 
     28 #include <inttypes.h>
     29 
     30 using namespace android;
     31 
     32 using android::base::StringPrintf;
     33 using android::util::FIELD_COUNT_REPEATED;
     34 using android::util::FIELD_TYPE_BOOL;
     35 using android::util::FIELD_TYPE_FLOAT;
     36 using android::util::FIELD_TYPE_INT32;
     37 using android::util::FIELD_TYPE_INT64;
     38 using android::util::FIELD_TYPE_UINT64;
     39 using android::util::FIELD_TYPE_MESSAGE;
     40 using android::util::FIELD_TYPE_STRING;
     41 using android::util::ProtoOutputStream;
     42 
     43 namespace android {
     44 namespace os {
     45 namespace statsd {
     46 
     47 const int FIELD_ID_SNAPSHOT_PACKAGE_NAME = 1;
     48 const int FIELD_ID_SNAPSHOT_PACKAGE_VERSION = 2;
     49 const int FIELD_ID_SNAPSHOT_PACKAGE_UID = 3;
     50 const int FIELD_ID_SNAPSHOT_PACKAGE_DELETED = 4;
     51 const int FIELD_ID_SNAPSHOT_PACKAGE_NAME_HASH = 5;
     52 const int FIELD_ID_SNAPSHOT_PACKAGE_VERSION_STRING = 6;
     53 const int FIELD_ID_SNAPSHOT_PACKAGE_VERSION_STRING_HASH = 7;
     54 const int FIELD_ID_SNAPSHOT_PACKAGE_INSTALLER = 8;
     55 const int FIELD_ID_SNAPSHOT_PACKAGE_INSTALLER_HASH = 9;
     56 const int FIELD_ID_SNAPSHOT_TIMESTAMP = 1;
     57 const int FIELD_ID_SNAPSHOT_PACKAGE_INFO = 2;
     58 const int FIELD_ID_SNAPSHOTS = 1;
     59 const int FIELD_ID_CHANGES = 2;
     60 const int FIELD_ID_CHANGE_DELETION = 1;
     61 const int FIELD_ID_CHANGE_TIMESTAMP = 2;
     62 const int FIELD_ID_CHANGE_PACKAGE = 3;
     63 const int FIELD_ID_CHANGE_UID = 4;
     64 const int FIELD_ID_CHANGE_NEW_VERSION = 5;
     65 const int FIELD_ID_CHANGE_PREV_VERSION = 6;
     66 const int FIELD_ID_CHANGE_PACKAGE_HASH = 7;
     67 const int FIELD_ID_CHANGE_NEW_VERSION_STRING = 8;
     68 const int FIELD_ID_CHANGE_PREV_VERSION_STRING = 9;
     69 const int FIELD_ID_CHANGE_NEW_VERSION_STRING_HASH = 10;
     70 const int FIELD_ID_CHANGE_PREV_VERSION_STRING_HASH = 11;
     71 
     72 UidMap::UidMap() : mBytesUsed(0) {}
     73 
     74 UidMap::~UidMap() {}
     75 
     76 sp<UidMap> UidMap::getInstance() {
     77     static sp<UidMap> sInstance = new UidMap();
     78     return sInstance;
     79 }
     80 
     81 bool UidMap::hasApp(int uid, const string& packageName) const {
     82     lock_guard<mutex> lock(mMutex);
     83 
     84     auto it = mMap.find(std::make_pair(uid, packageName));
     85     return it != mMap.end() && !it->second.deleted;
     86 }
     87 
     88 string UidMap::normalizeAppName(const string& appName) const {
     89     string normalizedName = appName;
     90     std::transform(normalizedName.begin(), normalizedName.end(), normalizedName.begin(), ::tolower);
     91     return normalizedName;
     92 }
     93 
     94 std::set<string> UidMap::getAppNamesFromUid(const int32_t& uid, bool returnNormalized) const {
     95     lock_guard<mutex> lock(mMutex);
     96     return getAppNamesFromUidLocked(uid,returnNormalized);
     97 }
     98 
     99 std::set<string> UidMap::getAppNamesFromUidLocked(const int32_t& uid, bool returnNormalized) const {
    100     std::set<string> names;
    101     for (const auto& kv : mMap) {
    102         if (kv.first.first == uid && !kv.second.deleted) {
    103             names.insert(returnNormalized ? normalizeAppName(kv.first.second) : kv.first.second);
    104         }
    105     }
    106     return names;
    107 }
    108 
    109 int64_t UidMap::getAppVersion(int uid, const string& packageName) const {
    110     lock_guard<mutex> lock(mMutex);
    111 
    112     auto it = mMap.find(std::make_pair(uid, packageName));
    113     if (it == mMap.end() || it->second.deleted) {
    114         return 0;
    115     }
    116     return it->second.versionCode;
    117 }
    118 
    119 void UidMap::updateMap(const int64_t& timestamp, const vector<int32_t>& uid,
    120                        const vector<int64_t>& versionCode, const vector<String16>& versionString,
    121                        const vector<String16>& packageName, const vector<String16>& installer) {
    122     vector<wp<PackageInfoListener>> broadcastList;
    123     {
    124         lock_guard<mutex> lock(mMutex);  // Exclusively lock for updates.
    125 
    126         std::unordered_map<std::pair<int, string>, AppData, PairHash> deletedApps;
    127 
    128         // Copy all the deleted apps.
    129         for (const auto& kv : mMap) {
    130             if (kv.second.deleted) {
    131                 deletedApps[kv.first] = kv.second;
    132             }
    133         }
    134 
    135         mMap.clear();
    136         for (size_t j = 0; j < uid.size(); j++) {
    137             string package = string(String8(packageName[j]).string());
    138             mMap[std::make_pair(uid[j], package)] =
    139                     AppData(versionCode[j], string(String8(versionString[j]).string()),
    140                             string(String8(installer[j]).string()));
    141         }
    142 
    143         for (const auto& kv : deletedApps) {
    144             auto mMapIt = mMap.find(kv.first);
    145             if (mMapIt != mMap.end()) {
    146                 // Insert this deleted app back into the current map.
    147                 mMap[kv.first] = kv.second;
    148             }
    149         }
    150 
    151         ensureBytesUsedBelowLimit();
    152         StatsdStats::getInstance().setCurrentUidMapMemory(mBytesUsed);
    153         getListenerListCopyLocked(&broadcastList);
    154     }
    155     // To avoid invoking callback while holding the internal lock. we get a copy of the listener
    156     // list and invoke the callback. It's still possible that after we copy the list, a
    157     // listener removes itself before we call it. It's then the listener's job to handle it (expect
    158     // the callback to be called after listener is removed, and the listener should properly
    159     // ignore it).
    160     for (const auto& weakPtr : broadcastList) {
    161         auto strongPtr = weakPtr.promote();
    162         if (strongPtr != NULL) {
    163             strongPtr->onUidMapReceived(timestamp);
    164         }
    165     }
    166 }
    167 
    168 void UidMap::updateApp(const int64_t& timestamp, const String16& app_16, const int32_t& uid,
    169                        const int64_t& versionCode, const String16& versionString,
    170                        const String16& installer) {
    171     vector<wp<PackageInfoListener>> broadcastList;
    172     string appName = string(String8(app_16).string());
    173     {
    174         lock_guard<mutex> lock(mMutex);
    175         int32_t prevVersion = 0;
    176         string prevVersionString = "";
    177         string newVersionString = string(String8(versionString).string());
    178         bool found = false;
    179         auto it = mMap.find(std::make_pair(uid, appName));
    180         if (it != mMap.end()) {
    181             found = true;
    182             prevVersion = it->second.versionCode;
    183             prevVersionString = it->second.versionString;
    184             it->second.versionCode = versionCode;
    185             it->second.versionString = newVersionString;
    186             it->second.installer = string(String8(installer).string());
    187             it->second.deleted = false;
    188         }
    189         if (!found) {
    190             // Otherwise, we need to add an app at this uid.
    191             mMap[std::make_pair(uid, appName)] =
    192                     AppData(versionCode, newVersionString, string(String8(installer).string()));
    193         } else {
    194             // Only notify the listeners if this is an app upgrade. If this app is being installed
    195             // for the first time, then we don't notify the listeners.
    196             // It's also OK to split again if we're forming a partial bucket after re-installing an
    197             // app after deletion.
    198             getListenerListCopyLocked(&broadcastList);
    199         }
    200         mChanges.emplace_back(false, timestamp, appName, uid, versionCode, newVersionString,
    201                               prevVersion, prevVersionString);
    202         mBytesUsed += kBytesChangeRecord;
    203         ensureBytesUsedBelowLimit();
    204         StatsdStats::getInstance().setCurrentUidMapMemory(mBytesUsed);
    205         StatsdStats::getInstance().setUidMapChanges(mChanges.size());
    206     }
    207 
    208     for (const auto& weakPtr : broadcastList) {
    209         auto strongPtr = weakPtr.promote();
    210         if (strongPtr != NULL) {
    211             strongPtr->notifyAppUpgrade(timestamp, appName, uid, versionCode);
    212         }
    213     }
    214 }
    215 
    216 void UidMap::ensureBytesUsedBelowLimit() {
    217     size_t limit;
    218     if (maxBytesOverride <= 0) {
    219         limit = StatsdStats::kMaxBytesUsedUidMap;
    220     } else {
    221         limit = maxBytesOverride;
    222     }
    223     while (mBytesUsed > limit) {
    224         ALOGI("Bytes used %zu is above limit %zu, need to delete something", mBytesUsed, limit);
    225         if (mChanges.size() > 0) {
    226             mBytesUsed -= kBytesChangeRecord;
    227             mChanges.pop_front();
    228             StatsdStats::getInstance().noteUidMapDropped(1);
    229         }
    230     }
    231 }
    232 
    233 void UidMap::getListenerListCopyLocked(vector<wp<PackageInfoListener>>* output) {
    234     for (auto weakIt = mSubscribers.begin(); weakIt != mSubscribers.end();) {
    235         auto strongPtr = weakIt->promote();
    236         if (strongPtr != NULL) {
    237             output->push_back(*weakIt);
    238             weakIt++;
    239         } else {
    240             weakIt = mSubscribers.erase(weakIt);
    241             VLOG("The UidMap listener is gone, remove it now");
    242         }
    243     }
    244 }
    245 
    246 void UidMap::removeApp(const int64_t& timestamp, const String16& app_16, const int32_t& uid) {
    247     vector<wp<PackageInfoListener>> broadcastList;
    248     string app = string(String8(app_16).string());
    249     {
    250         lock_guard<mutex> lock(mMutex);
    251 
    252         int64_t prevVersion = 0;
    253         string prevVersionString = "";
    254         auto key = std::make_pair(uid, app);
    255         auto it = mMap.find(key);
    256         if (it != mMap.end() && !it->second.deleted) {
    257             prevVersion = it->second.versionCode;
    258             prevVersionString = it->second.versionString;
    259             it->second.deleted = true;
    260             mDeletedApps.push_back(key);
    261         }
    262         if (mDeletedApps.size() > StatsdStats::kMaxDeletedAppsInUidMap) {
    263             // Delete the oldest one.
    264             auto oldest = mDeletedApps.front();
    265             mDeletedApps.pop_front();
    266             mMap.erase(oldest);
    267             StatsdStats::getInstance().noteUidMapAppDeletionDropped();
    268         }
    269         mChanges.emplace_back(true, timestamp, app, uid, 0, "", prevVersion, prevVersionString);
    270         mBytesUsed += kBytesChangeRecord;
    271         ensureBytesUsedBelowLimit();
    272         StatsdStats::getInstance().setCurrentUidMapMemory(mBytesUsed);
    273         StatsdStats::getInstance().setUidMapChanges(mChanges.size());
    274         getListenerListCopyLocked(&broadcastList);
    275     }
    276 
    277     for (const auto& weakPtr : broadcastList) {
    278         auto strongPtr = weakPtr.promote();
    279         if (strongPtr != NULL) {
    280             strongPtr->notifyAppRemoved(timestamp, app, uid);
    281         }
    282     }
    283 }
    284 
    285 void UidMap::addListener(wp<PackageInfoListener> producer) {
    286     lock_guard<mutex> lock(mMutex);  // Lock for updates
    287     mSubscribers.insert(producer);
    288 }
    289 
    290 void UidMap::removeListener(wp<PackageInfoListener> producer) {
    291     lock_guard<mutex> lock(mMutex);  // Lock for updates
    292     mSubscribers.erase(producer);
    293 }
    294 
    295 void UidMap::assignIsolatedUid(int isolatedUid, int parentUid) {
    296     lock_guard<mutex> lock(mIsolatedMutex);
    297 
    298     mIsolatedUidMap[isolatedUid] = parentUid;
    299 }
    300 
    301 void UidMap::removeIsolatedUid(int isolatedUid) {
    302     lock_guard<mutex> lock(mIsolatedMutex);
    303 
    304     auto it = mIsolatedUidMap.find(isolatedUid);
    305     if (it != mIsolatedUidMap.end()) {
    306         mIsolatedUidMap.erase(it);
    307     }
    308 }
    309 
    310 int UidMap::getHostUidOrSelf(int uid) const {
    311     lock_guard<mutex> lock(mIsolatedMutex);
    312 
    313     auto it = mIsolatedUidMap.find(uid);
    314     if (it != mIsolatedUidMap.end()) {
    315         return it->second;
    316     }
    317     return uid;
    318 }
    319 
    320 void UidMap::clearOutput() {
    321     mChanges.clear();
    322     // Also update the guardrail trackers.
    323     StatsdStats::getInstance().setUidMapChanges(0);
    324     mBytesUsed = 0;
    325     StatsdStats::getInstance().setCurrentUidMapMemory(mBytesUsed);
    326 }
    327 
    328 int64_t UidMap::getMinimumTimestampNs() {
    329     int64_t m = 0;
    330     for (const auto& kv : mLastUpdatePerConfigKey) {
    331         if (m == 0) {
    332             m = kv.second;
    333         } else if (kv.second < m) {
    334             m = kv.second;
    335         }
    336     }
    337     return m;
    338 }
    339 
    340 size_t UidMap::getBytesUsed() const {
    341     return mBytesUsed;
    342 }
    343 
    344 void UidMap::writeUidMapSnapshot(int64_t timestamp, bool includeVersionStrings,
    345                                  bool includeInstaller, const std::set<int32_t>& interestingUids,
    346                                  std::set<string>* str_set, ProtoOutputStream* proto) {
    347     lock_guard<mutex> lock(mMutex);
    348 
    349     writeUidMapSnapshotLocked(timestamp, includeVersionStrings, includeInstaller, interestingUids,
    350                               str_set, proto);
    351 }
    352 
    353 void UidMap::writeUidMapSnapshotLocked(int64_t timestamp, bool includeVersionStrings,
    354                                        bool includeInstaller,
    355                                        const std::set<int32_t>& interestingUids,
    356                                        std::set<string>* str_set, ProtoOutputStream* proto) {
    357     proto->write(FIELD_TYPE_INT64 | FIELD_ID_SNAPSHOT_TIMESTAMP, (long long)timestamp);
    358     for (const auto& kv : mMap) {
    359         if (!interestingUids.empty() &&
    360             interestingUids.find(kv.first.first) == interestingUids.end()) {
    361             continue;
    362         }
    363         uint64_t token = proto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
    364                                       FIELD_ID_SNAPSHOT_PACKAGE_INFO);
    365         if (str_set != nullptr) {
    366             str_set->insert(kv.first.second);
    367             proto->write(FIELD_TYPE_UINT64 | FIELD_ID_SNAPSHOT_PACKAGE_NAME_HASH,
    368                          (long long)Hash64(kv.first.second));
    369             if (includeVersionStrings) {
    370                 str_set->insert(kv.second.versionString);
    371                 proto->write(FIELD_TYPE_UINT64 | FIELD_ID_SNAPSHOT_PACKAGE_VERSION_STRING_HASH,
    372                              (long long)Hash64(kv.second.versionString));
    373             }
    374             if (includeInstaller) {
    375                 str_set->insert(kv.second.installer);
    376                 proto->write(FIELD_TYPE_UINT64 | FIELD_ID_SNAPSHOT_PACKAGE_INSTALLER_HASH,
    377                              (long long)Hash64(kv.second.installer));
    378             }
    379         } else {
    380             proto->write(FIELD_TYPE_STRING | FIELD_ID_SNAPSHOT_PACKAGE_NAME, kv.first.second);
    381             if (includeVersionStrings) {
    382                 proto->write(FIELD_TYPE_STRING | FIELD_ID_SNAPSHOT_PACKAGE_VERSION_STRING,
    383                              kv.second.versionString);
    384             }
    385             if (includeInstaller) {
    386                 proto->write(FIELD_TYPE_STRING | FIELD_ID_SNAPSHOT_PACKAGE_INSTALLER,
    387                              kv.second.installer);
    388             }
    389         }
    390 
    391         proto->write(FIELD_TYPE_INT64 | FIELD_ID_SNAPSHOT_PACKAGE_VERSION,
    392                      (long long)kv.second.versionCode);
    393         proto->write(FIELD_TYPE_INT32 | FIELD_ID_SNAPSHOT_PACKAGE_UID, kv.first.first);
    394         proto->write(FIELD_TYPE_BOOL | FIELD_ID_SNAPSHOT_PACKAGE_DELETED, kv.second.deleted);
    395         proto->end(token);
    396     }
    397 }
    398 
    399 void UidMap::appendUidMap(const int64_t& timestamp, const ConfigKey& key, std::set<string>* str_set,
    400                           bool includeVersionStrings, bool includeInstaller,
    401                           ProtoOutputStream* proto) {
    402     lock_guard<mutex> lock(mMutex);  // Lock for updates
    403 
    404     for (const ChangeRecord& record : mChanges) {
    405         if (record.timestampNs > mLastUpdatePerConfigKey[key]) {
    406             uint64_t changesToken =
    407                     proto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_CHANGES);
    408             proto->write(FIELD_TYPE_BOOL | FIELD_ID_CHANGE_DELETION, (bool)record.deletion);
    409             proto->write(FIELD_TYPE_INT64 | FIELD_ID_CHANGE_TIMESTAMP,
    410                          (long long)record.timestampNs);
    411             if (str_set != nullptr) {
    412                 str_set->insert(record.package);
    413                 proto->write(FIELD_TYPE_UINT64 | FIELD_ID_CHANGE_PACKAGE_HASH,
    414                              (long long)Hash64(record.package));
    415                 if (includeVersionStrings) {
    416                     str_set->insert(record.versionString);
    417                     proto->write(FIELD_TYPE_UINT64 | FIELD_ID_CHANGE_NEW_VERSION_STRING_HASH,
    418                                  (long long)Hash64(record.versionString));
    419                     str_set->insert(record.prevVersionString);
    420                     proto->write(FIELD_TYPE_UINT64 | FIELD_ID_CHANGE_PREV_VERSION_STRING_HASH,
    421                                  (long long)Hash64(record.prevVersionString));
    422                 }
    423             } else {
    424                 proto->write(FIELD_TYPE_STRING | FIELD_ID_CHANGE_PACKAGE, record.package);
    425                 if (includeVersionStrings) {
    426                     proto->write(FIELD_TYPE_STRING | FIELD_ID_CHANGE_NEW_VERSION_STRING,
    427                                  record.versionString);
    428                     proto->write(FIELD_TYPE_STRING | FIELD_ID_CHANGE_PREV_VERSION_STRING,
    429                                  record.prevVersionString);
    430                 }
    431             }
    432 
    433             proto->write(FIELD_TYPE_INT32 | FIELD_ID_CHANGE_UID, (int)record.uid);
    434             proto->write(FIELD_TYPE_INT64 | FIELD_ID_CHANGE_NEW_VERSION, (long long)record.version);
    435             proto->write(FIELD_TYPE_INT64 | FIELD_ID_CHANGE_PREV_VERSION,
    436                          (long long)record.prevVersion);
    437             proto->end(changesToken);
    438         }
    439     }
    440 
    441     // Write snapshot from current uid map state.
    442     uint64_t snapshotsToken =
    443             proto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_SNAPSHOTS);
    444     writeUidMapSnapshotLocked(timestamp, includeVersionStrings, includeInstaller,
    445                               std::set<int32_t>() /*empty uid set means including every uid*/,
    446                               str_set, proto);
    447     proto->end(snapshotsToken);
    448 
    449     int64_t prevMin = getMinimumTimestampNs();
    450     mLastUpdatePerConfigKey[key] = timestamp;
    451     int64_t newMin = getMinimumTimestampNs();
    452 
    453     if (newMin > prevMin) {  // Delete anything possible now that the minimum has
    454                              // moved forward.
    455         int64_t cutoff_nanos = newMin;
    456         for (auto it_changes = mChanges.begin(); it_changes != mChanges.end();) {
    457             if (it_changes->timestampNs < cutoff_nanos) {
    458                 mBytesUsed -= kBytesChangeRecord;
    459                 it_changes = mChanges.erase(it_changes);
    460             } else {
    461                 ++it_changes;
    462             }
    463         }
    464     }
    465     StatsdStats::getInstance().setCurrentUidMapMemory(mBytesUsed);
    466     StatsdStats::getInstance().setUidMapChanges(mChanges.size());
    467 }
    468 
    469 void UidMap::printUidMap(int out) const {
    470     lock_guard<mutex> lock(mMutex);
    471 
    472     for (const auto& kv : mMap) {
    473         if (!kv.second.deleted) {
    474             dprintf(out, "%s, v%" PRId64 ", %s, %s (%i)\n", kv.first.second.c_str(),
    475                     kv.second.versionCode, kv.second.versionString.c_str(),
    476                     kv.second.installer.c_str(), kv.first.first);
    477         }
    478     }
    479 }
    480 
    481 void UidMap::OnConfigUpdated(const ConfigKey& key) {
    482     mLastUpdatePerConfigKey[key] = -1;
    483 }
    484 
    485 void UidMap::OnConfigRemoved(const ConfigKey& key) {
    486     mLastUpdatePerConfigKey.erase(key);
    487 }
    488 
    489 set<int32_t> UidMap::getAppUid(const string& package) const {
    490     lock_guard<mutex> lock(mMutex);
    491 
    492     set<int32_t> results;
    493     for (const auto& kv : mMap) {
    494         if (kv.first.second == package && !kv.second.deleted) {
    495             results.insert(kv.first.first);
    496         }
    497     }
    498     return results;
    499 }
    500 
    501 // Note not all the following AIDs are used as uids. Some are used only for gids.
    502 // It's ok to leave them in the map, but we won't ever see them in the log's uid field.
    503 // App's uid starts from 10000, and will not overlap with the following AIDs.
    504 const std::map<string, uint32_t> UidMap::sAidToUidMapping = {{"AID_ROOT", 0},
    505                                                              {"AID_SYSTEM", 1000},
    506                                                              {"AID_RADIO", 1001},
    507                                                              {"AID_BLUETOOTH", 1002},
    508                                                              {"AID_GRAPHICS", 1003},
    509                                                              {"AID_INPUT", 1004},
    510                                                              {"AID_AUDIO", 1005},
    511                                                              {"AID_CAMERA", 1006},
    512                                                              {"AID_LOG", 1007},
    513                                                              {"AID_COMPASS", 1008},
    514                                                              {"AID_MOUNT", 1009},
    515                                                              {"AID_WIFI", 1010},
    516                                                              {"AID_ADB", 1011},
    517                                                              {"AID_INSTALL", 1012},
    518                                                              {"AID_MEDIA", 1013},
    519                                                              {"AID_DHCP", 1014},
    520                                                              {"AID_SDCARD_RW", 1015},
    521                                                              {"AID_VPN", 1016},
    522                                                              {"AID_KEYSTORE", 1017},
    523                                                              {"AID_USB", 1018},
    524                                                              {"AID_DRM", 1019},
    525                                                              {"AID_MDNSR", 1020},
    526                                                              {"AID_GPS", 1021},
    527                                                              // {"AID_UNUSED1", 1022},
    528                                                              {"AID_MEDIA_RW", 1023},
    529                                                              {"AID_MTP", 1024},
    530                                                              // {"AID_UNUSED2", 1025},
    531                                                              {"AID_DRMRPC", 1026},
    532                                                              {"AID_NFC", 1027},
    533                                                              {"AID_SDCARD_R", 1028},
    534                                                              {"AID_CLAT", 1029},
    535                                                              {"AID_LOOP_RADIO", 1030},
    536                                                              {"AID_MEDIA_DRM", 1031},
    537                                                              {"AID_PACKAGE_INFO", 1032},
    538                                                              {"AID_SDCARD_PICS", 1033},
    539                                                              {"AID_SDCARD_AV", 1034},
    540                                                              {"AID_SDCARD_ALL", 1035},
    541                                                              {"AID_LOGD", 1036},
    542                                                              {"AID_SHARED_RELRO", 1037},
    543                                                              {"AID_DBUS", 1038},
    544                                                              {"AID_TLSDATE", 1039},
    545                                                              {"AID_MEDIA_EX", 1040},
    546                                                              {"AID_AUDIOSERVER", 1041},
    547                                                              {"AID_METRICS_COLL", 1042},
    548                                                              {"AID_METRICSD", 1043},
    549                                                              {"AID_WEBSERV", 1044},
    550                                                              {"AID_DEBUGGERD", 1045},
    551                                                              {"AID_MEDIA_CODEC", 1046},
    552                                                              {"AID_CAMERASERVER", 1047},
    553                                                              {"AID_FIREWALL", 1048},
    554                                                              {"AID_TRUNKS", 1049},
    555                                                              {"AID_NVRAM", 1050},
    556                                                              {"AID_DNS", 1051},
    557                                                              {"AID_DNS_TETHER", 1052},
    558                                                              {"AID_WEBVIEW_ZYGOTE", 1053},
    559                                                              {"AID_VEHICLE_NETWORK", 1054},
    560                                                              {"AID_MEDIA_AUDIO", 1055},
    561                                                              {"AID_MEDIA_VIDEO", 1056},
    562                                                              {"AID_MEDIA_IMAGE", 1057},
    563                                                              {"AID_TOMBSTONED", 1058},
    564                                                              {"AID_MEDIA_OBB", 1059},
    565                                                              {"AID_ESE", 1060},
    566                                                              {"AID_OTA_UPDATE", 1061},
    567                                                              {"AID_AUTOMOTIVE_EVS", 1062},
    568                                                              {"AID_LOWPAN", 1063},
    569                                                              {"AID_HSM", 1064},
    570                                                              {"AID_RESERVED_DISK", 1065},
    571                                                              {"AID_STATSD", 1066},
    572                                                              {"AID_INCIDENTD", 1067},
    573                                                              {"AID_SECURE_ELEMENT", 1068},
    574                                                              {"AID_LMKD", 1069},
    575                                                              {"AID_LLKD", 1070},
    576                                                              {"AID_IORAPD", 1071},
    577                                                              {"AID_NETWORK_STACK", 1073},
    578                                                              {"AID_SHELL", 2000},
    579                                                              {"AID_CACHE", 2001},
    580                                                              {"AID_DIAG", 2002}};
    581 
    582 }  // namespace statsd
    583 }  // namespace os
    584 }  // namespace android
    585