Fix logic error in atrace when detecting available categories.

A category should be marked as available "only if all its required /sys/
files are writeable and if enabling the category will enable one or more
tracing tags or /sys/ files". The previous code didn't check that one or
more file was enabled, and therefore would always mark a category available
if all of their files were optional, even if none of those were
writeable.

Bug: 120621110
Test: Manual
Change-Id: Iee2984f7cb3591dcd0b3a376d95754d1abaea5be
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 8685009..53b3a00 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -439,14 +439,10 @@
         const char* path = category.sysfiles[i].path;
         bool req = category.sysfiles[i].required == REQ;
         if (path != nullptr) {
-            if (req) {
-                if (!fileIsWritable(path)) {
-                    return false;
-                } else {
-                    ok = true;
-                }
-            } else {
+            if (fileIsWritable(path)) {
                 ok = true;
+            } else if (req) {
+                return false;
             }
         }
     }